积极答复者
Queue出列时锁定队列

问题
答案
-
默认的Query没有线程安全机制,除非你重写一个Query(里边引用原Query)的各个方法,并且利用lock机制实现。
或者你可以考虑安全现成的Query:
ConcurrentQueue<T>
If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer
Help by clicking:
Click here to donate your rice to the poor
Click to Donate
Click to feed Dogs & Cats- 已建议为答案 Jason Dot WangModerator 2013年4月9日 4:49
- 已标记为答案 Jason Dot WangModerator 2013年4月12日 10:24
-
Queue mySyncdQ = Queue.Synchronized( new Queue());
If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer
Help by clicking:
Click here to donate your rice to the poor
Click to Donate
Click to feed Dogs & Cats- 已建议为答案 Jason Dot WangModerator 2013年4月9日 4:49
- 已标记为答案 Jason Dot WangModerator 2013年4月12日 10:24
全部回复
-
默认的Query没有线程安全机制,除非你重写一个Query(里边引用原Query)的各个方法,并且利用lock机制实现。
或者你可以考虑安全现成的Query:
ConcurrentQueue<T>
If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer
Help by clicking:
Click here to donate your rice to the poor
Click to Donate
Click to feed Dogs & Cats- 已建议为答案 Jason Dot WangModerator 2013年4月9日 4:49
- 已标记为答案 Jason Dot WangModerator 2013年4月12日 10:24
-
Queue mySyncdQ = Queue.Synchronized( new Queue());
If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer
Help by clicking:
Click here to donate your rice to the poor
Click to Donate
Click to feed Dogs & Cats- 已建议为答案 Jason Dot WangModerator 2013年4月9日 4:49
- 已标记为答案 Jason Dot WangModerator 2013年4月12日 10:24