当ThreadPool.QueueUserWorkItem返回false [英] When ThreadPool.QueueUserWorkItem returns false
本文介绍了当ThreadPool.QueueUserWorkItem返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MSDN指出该方法返回
The MSDN states that the method returns
true,如果该方法成功地 排队; NotSupportedException异常是 如果抛出的工作项目不排队。
true if the method is successfully queued; NotSupportedException is thrown if the work item is not queued.
有关测试的目的如何让该方法返回假
?或者它只是一个次优级的设计?
For testing purposes how to get the method to return false
? Or it is just a "suboptimal" class design?
推荐答案
在查看源$ C $ C的反射,似乎在code,可以返回假的唯一部件就是调用如下:
In looking at the source code in Reflector, it seems the only part of the code that could return "false" is a call to the following:
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool AdjustThreadsInPool(uint QueueLength);
这篇关于当ThreadPool.QueueUserWorkItem返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文