public void AddDocument(Document1 doc) { lock (this) { document1Queue.Enqueue(doc); } }
public Document1 GetDocument() { Document1 doc = null; lock (this) { doc = document1Queue.Dequeue(); } return(doc); }
protected void Run() { while (true) { if (document1Manager.IsDocumentAvailable) { Document1 doc = document1Manager.GetDocument(); } Thread.Sleep(new Random().Next(20)); } }