Esempio n. 1
0
        /// <summary>
        /// Retries specified serialize or deserialize event in case of file I/O failures.
        /// </summary>
        private void m_retryTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (m_disposed)
            {
                return;
            }

            LongSynchronizedOperation operation = null;

            lock (m_retryQueue)
            {
                // Reads should always occur first since you may need to load any
                // newly written data before saving new data. Users can override
                // load and save behavior to "merge" data sets if needed.
                if (m_retryQueue[ReadEvent])
                {
                    operation = m_loadOperation;
                    m_retryQueue[ReadEvent] = false;
                }
                else if (m_retryQueue[WriteEvent])
                {
                    operation = m_saveOperation;
                    m_retryQueue[WriteEvent] = false;
                }

                // If any events remain queued for retry, start timer for next event
                if (m_retryQueue.Any(true))
                {
                    m_retryTimer.Start();
                }
            }

            if ((object)operation != null)
            {
                operation.TryRunOnceAsync();
            }
        }
 public static bool None(this BitArray array)
 {
     return(!array.Any());
 }