Esempio n. 1
0
        // 把累积的条目一次性写入日志文件
        public int WriteToLog(delegate_writeLog func_writeLog,
                              string style = "")
        {
            int count = 0;

            // List<string> keys = new List<string>();
            _lock.EnterReadLock();
            try
            {
                foreach (string key in _table.Keys)
                {
                    CompactEntry entry = _table[key];
                    lock (entry)
                    {
                        count += entry.WriteToLog(func_writeLog, style);
                    }
                }
            }
            finally
            {
                _lock.ExitReadLock();
            }

#if NO
            _lock.EnterWriteLock();
            try
            {
                foreach (string key in keys)
                {
                    _table.Remove(key);
                }
            }
            finally
            {
                _lock.ExitWriteLock();
            }
#endif

            return(count);
        }