nsIThreadPool 编辑
xpcom/threads/nsIThreadPool.idl
Scriptable The nsIThreadPool
interface provides support for thread pools. 1.0 66 Introduced Gecko 1.9 Inherits from: nsIEventTarget
Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)A thread pool provides a convenient way to process events off the main thread. When you send events to the thread pool, the pool creates a new thread to process the event, up to the number of threads specified by the threadLimit
attribute.
Method overview
void shutdown(); |
Attributes
Attribute | Type | Description |
idleThreadLimit | unsigned long | Get/set the maximum number of idle threads that are kept alive. Once there are more than this many idle worker threads, the idle threads start getting destroyed. |
idleThreadTimeout | unsigned long | Get/set the amount of time in milliseconds that a thread must be idle before it becomes eligible to be destroyed. |
listener |
| An optional listener that will be notified when a thread is created or destroyed in the course of the thread pool's operation. A listener will only receive notifications about threads created after the listener is set so it is recommended that the consumer set the listener before dispatching the first event. A listener that receives an shutdown() method is called. Threads created after the listener is set will also take ownership of the listener so that the listener will be kept alive long enough to receive the guaranteed nsIThreadPoolListener.onThreadShuttingDown() notification. |
threadLimit | unsigned long | The maximum number of threads allowed at once in the pool; you may change this value by altering this attribute. |
Methods
shutdown()
Shuts down the thread pool.
You must not call this method from any thread within the thread pool. Instead, you should call it from another thread (typically the one that created the thread pool).
When this method returns, the thread pool and all its threads will have been shut down, and it is no longer be possible to dispatch events to the thread pool.
void shutdown();
Parameters
None.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论