本身实现一个 线程池

咱们先来看看一个网友写的  SafeObjectPool :html

http://www.javashuo.com/article/p-wwlawmup-bp.htmlspa

 

从  SafeObjectPool , 咱们大概能够本身实现一个 线程池, 好比线程

 

var pool = new SafeObjectPool.ObjectPool<Thread>();htm

 

Thread thread = pool.Get();blog

thread.唤醒();队列

 

唤醒后, thread 会进入 就绪队列, 很快就能够执行了 。get

 

这样算能够实现一个 线程池 了吧 ?thread

相关文章
相关标签/搜索