Example #1
0
        void Process()
        {
            try
            {
                List <TimestampItem> timestampList = new List <TimestampItem>(32);
                bool stop;

                while (true)
                {
                    event_.WaitOne();

                    timestampList.Clear();

                    using (mutex_)
                    {
                        List <TimestampItem> tempTimestampList = timestampList_;
                        timestampList_ = timestampList;
                        timestampList  = tempTimestampList;

                        stop = stop_;
                    }

                    for (int index = 0; index < timestampList.Count; ++index)
                    {
                        TimestampItem timestampItem = timestampList[index];

                        if (timestampItem.type == TimestampItemType.Log)
                        {
                            timestampItem.logger.streamWriter_.WriteLine("{0};{1};{2}", timestampItem.id, timestampItem.timestamp, timestampItem.memo);
                            timestampItem.logger.streamWriter_.Flush();
                        }
                        else if (timestampItem.type == TimestampItemType.Signal)
                        {
                            timestampItem.logger.event_.Set();
                        }
                    }

                    if (stop)
                    {
                        break;
                    }
                }
            }
            catch
            {
            }
        }
Example #2
0
 public void AddBlock(TimestampItem item)
 {
     timestamp_index_add_block(_index, ref item);
 }
Example #3
0
 private static extern void timestamp_index_add_block(IntPtr index, ref TimestampItem item);