Example #1
0
        static void TreeWorker()
        {
            var r = new TreeWorkerRequestQueue();
            var w = new TreeWorkerResultQueue();
            var l = new LogQueue();

            while (true)
            {
                TreeNode nodeRequested = r.Get();
                if (nodeRequested == null)
                {
                    return;
                }
                Utilities.Write(ConsoleColor.Gray, nodeRequested.Value.ToString());
                // processing...
                Thread.Sleep(10000);
                foreach (var child in nodeRequested)
                {
                    w.Put(new TreeWorkerResultMessage()
                    {
                        processed = false,
                        result    = child
                    });
                }
                l.Put("Visited node " + nodeRequested.Value);
                w.Put(new TreeWorkerResultMessage()
                {
                    processed = true,
                    result    = nodeRequested
                });
            }
        }
Example #2
0
 public void Info(string className, string methodName, object o)
 {
     model = new RecordModel(DateTime.Now.Date,
                             GetHeader(className, methodName, Level.Info) + o.ToString());
     queue.Put(model);
 }