首页 / 类库组件 / 正文

分享一个用C#(.NET)实现的多功能线程池管理组件--Smart Thread Pool

37309 发布于: 2014-08-20 读完约需4分钟

今天在Codeproject上发现一个关于线程和线程池的好东东—Smart Thread Pool,在此与大家一起分享。

smartthreadpool

这个组件实现了很多关于线程的高级功能,并且作者Ami Bar 提供了实现的源码,实例,测试以及Demo。

Smart Thread Pool的主要功能如下(原文,翻译过来感觉怪怪的):

  • The number of threads dynamically changes according to the workload on the threads in the pool.
  • Work items can return a value.
  • A work item can be cancelled if it hasn’t been executed yet.
  • The caller thread’s context is used when the work item is executed (limited).
  • Usage of minimum number of Win32 event handles, so the handle count of the application won’t explode.
  • The caller can wait for multiple or all the work items to complete.
  • A work item can have a PostExecute callback, which is called as soon the work item is completed.
  • The state object that accompanies the work item can be disposed automatically.
  • Work item exceptions are sent back to the caller.
  • Work items have priority.
  • Work items group.
  • The caller can suspend the start of a thread pool and work items group.
  • Threads have priority.
  • Threads have initialization and termination events.
  • WinCE platform is supported (limited).
  • Action<T> and Func<T> generic methods are supported.
  • Silverlight is supported.
  • Mono is supported.
  • Performance counters (Windows and internal).
  • Work item timeout (passive).
  • Threads ApartmentState
  • Threads IsBakcground
  • Threads name template
  • Windows Phone is supported (limited)
  • Threads MaxStackSize

相信看完这个实例后,你会对线程的相关知识有个新的认识。

版权声明:本作品系原创,版权归码友网所有,如未经许可,禁止任何形式转载,违者必究。

上一篇: C#用Linq实现DataTable转换成List的方法实例详解

下一篇: 亚马逊(Amazon.com)进驻上海自贸区-跨境电子商务,可直邮中国

本文永久链接码友网 » 分享一个用C#(.NET)实现的多功能线程池管理组件--Smart Thread Pool

分享扩散:

发表评论

登录用户才能发表评论, 请 登 录 或者 注册