Beispiel #1
0
        private void startWritingData()
        {
            while (true)
            {
                try
                {
                    T obj;
                    if (!this.dataToSend.TryDequeue(out obj) || obj == null)
                    {
                        Thread.Sleep(2000); // The data is not ready yet. So, try after some time.
                        continue;
                    }

                    Debug.WriteLine("[ WRITE ]: " + obj);
                    writer.write(obj);
                }
                catch
                {
                    Thread.Sleep(2000); // The reader got error. So, try after some time.
                    continue;
                }
            }
        }