文件名称:0.c.tar
- 所属分类:
- Linux/Unix编程
- 资源属性:
- [Linux] [C/C++] [源码]
- 上传时间:
- 2015-01-16
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- zju***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
经典的线程例子,使用 pthread 线程库创建两个线程,两个线程都要访问共享变量counter,按照源程序的逻辑,两个线程各循环 5 次,每次循环对 counter 变量加 1,最后打印的结果应该是 10。但是因为线程的特性,两个线程同步执行,所以结果是6,这是很有意思的事情。-The classic example of a thread, the thread using pthread library to create two threads, two threads must access a shared variable counter, according to the logic of the source, the two threads each cycle five times, each time adding a loop on the counter variable, the last printed The result should be 10. But because the characteristics of the thread, two threads to synchronize execution, so the result is 6, which is a very interesting thing.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
1151577120.c.tar