简单的线程池实现
代码说明:
该实例是创建一些线程,使其处于睡眠状态,然后将要执行的任务放在一个链表中。当链表中有任务时,就唤醒一个线程执行一个任务,执行完后,该线程继续睡眠。运行结果如下:thread 0xb7f74b90 is waitingthread 0xb7573b90 is waitingthread 0xb6b72b90 is waitingthread 0xb6171b90 is waitingthread 0xb7f74b90, working on task 0 thread 0xb7f74b90 is waitingthread 0xb7573b90, working on task 1 thread 0xb7573b90 is waitingthread 0xb6b72b90, working on task 2 thread 0xb6b72b90 is waitingthread 0xb6171b90, working on task 3 thread 0xb6171b9
下载说明:请别用迅雷下载,失败请重下,重下不扣分!