| 1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace parkMonitor.tools
- {
- public class BlockingQueue
- {
- private BlockingCollection<object> bQueue = new BlockingCollection<object>(new ConcurrentQueue<object>());
- public void Enqueue(object message)
- {
- bQueue.Add(message);
- }
- public object Dequeue()
- {
- //if(count() != 0)
- //{
- return bQueue.Take();
- //}
- //else
- //{
- // return null;
- //}
- }
- public int count()
- {
- return bQueue.Count();
- }
- }
- }
|