我在串口上以较快的速度接收数据,而在其他线程中,我正在处理串行端口上接收的数据包。因此,对于线程安全的读写操作,我使用的是并发队列。下面是我在串行口上接收数据的代码,我将其存储在并发队列中。System.Collections.Concurrent.ConcurrentQueue<byte> receivedData = new System.Collections.Concurrent.ConcurrentQue
我想问一下c#中的队列,如果ConcurrentQueue是安全线程,为什么这个代码的结果是~98k?我做错什么了吗?class Program static int sum = 0;
static ConcurrentQueue<int> queue = new ConcurrentQueue<int