关于线程的两篇文章
2008-01-06 15:50
387 查看
1.Extended Threading: Do More with the Same Thread
让一个线程完成更多的任务。作者自己写了一个类,拦截System.Threading.Thread,试图让你在不同的线程执行同一个方法成为可能,如果你想执行多次,你不必每次都创建一个新线程来执行该方法,优势在于提高性能并且易于使用,毕竟创建线程的代价还是比较昂贵的。
作者完成了一个Demo,用自己实现的方案分别对普通线程,线程池实现方式的性能作了比较。
Download demo project - 8.3 KB
Download source - 16 KB
2.Smart Thread Pool
智能线程池。该线程池不同于.net framework提供的线程池,这个线程池完全重新实现,并增加了很多有用的特性。
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.
Work item can have a
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.
让一个线程完成更多的任务。作者自己写了一个类,拦截System.Threading.Thread,试图让你在不同的线程执行同一个方法成为可能,如果你想执行多次,你不必每次都创建一个新线程来执行该方法,优势在于提高性能并且易于使用,毕竟创建线程的代价还是比较昂贵的。
作者完成了一个Demo,用自己实现的方案分别对普通线程,线程池实现方式的性能作了比较。
Download demo project - 8.3 KB
Download source - 16 KB
2.Smart Thread Pool
智能线程池。该线程池不同于.net framework提供的线程池,这个线程池完全重新实现,并增加了很多有用的特性。
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.
Work item can have a
PostExecutecallback, 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.
相关文章推荐
- Android学习笔记-转载两篇关于线程更新UI的方法的文章
- 看到关于JS线程的两篇文章
- 两篇关于flash 职业和webgame的文章
- 关于Android中Message机制的两篇文章
- 关于线程与定时器的好文章!!
- 关于IC卡的两篇文章
- 两篇关于论文格式等问题的文章
- 收集的关于Splash Screen的两篇好文章
- 关于机器人抓取的两篇文章,基于深度学习和脉冲神经网络,以及大脑见图
- 关于翻译的两篇好文章
- 关于晚睡的两篇文章
- 关于AppScan GlassBox的两篇文章
- 关于java线程与线程池(看到文章的汇总)
- 刚才在CSDN看了两篇关于Borland走下坡路的文章,差点没哭出来
- 关于DataTable的两篇基础文章
- [转] 两篇关于flash 职业和webgame的文章
- 关于android内存泄漏的两篇好文章
- 两篇关于Oracle中后台进程中CKPT描述得比较好的文章
- [导入][阅读]关于Vista的两篇评论文章
- 关于杜曼和七田真早教的两篇文章