Example #1
0
        private void FlushLogsAndResetLogCounter(LogInfo[] logsInfo)
        {
            FlushingThreadData flushingThreadData = new FlushingThreadData(logsInfo);

            flushLogsThreadPool.AddThreadIdToPool(flushingThreadData.ThreadId);
            ThreadPool.QueueUserWorkItem(FlushLogsToTargets, flushingThreadData);
            ResetLogsCounter();
        }
 public void Flush(FlushingThreadData flushingThreadData)
 {
     lock (lockObj)
     {
         while (threadsQueue.Peek() != flushingThreadData.ThreadId)
         {
             Monitor.Wait(lockObj);
         }
         for (int i = 0; i < targets.Length; i++)
         {
             flushingTasks[i] = FlushAsync(targets[i], flushingThreadData.LogsInfo);
         }
         WaitFlushingTasksIsComplete();
         threadsQueue.Dequeue();
         Monitor.PulseAll(lockObj);
     }
 }