public void ProcessDataQueue() { // Note this will block if dataqueue is empty // and will end when CompleteAdding is called foreach (DataLog log in dataQueue.GetConsumingEnumerable()) { SerializeData(log); } // Wrap up the JSON file EndLogFile(); }