Exemplo n.º 1
0
        private void Provider()
        {
            DataBlock db;

            while (running)
            {
                if (m_ring.putLock(out db))
                {
                    while (running)
                    {
                        try
                        {
                            //set some standard values
                            db.m_result = DataBlock.RESULT.TIMEOUT;
                            db.m_sample = SampleID++;
                            db.m_start  = DateTime.Now;

                            bool res = m_Oscillo.GetDataBlock(ref db);

                            db.m_stop = DateTime.Now;

                            //Console.WriteLine("{3} {0} {1}ms  {2}", db.m_sample, (db.m_stop - db.m_start).Milliseconds, m_ring.GetLength(), res);

                            if (res == true)
                            {
                                break;
                            }

                            m_Oscillo.Reset();
                            Console.WriteLine("Reset");
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("{0} ", e.Message);
                            m_Oscillo.Reset();
                        }
                    }
                    m_ring.putUnlock();
                }
            }
        }