当前位置: 技术问答>linux和unix
《unix/linux编程实践教程》中碰到的关于线程的问题
来源: 互联网 发布时间:2016-05-23
本文导语: 源代码: #define NUM 5 int counter = 0; main() { pthread_t t1; /* one thread */ void *print_count(void *); /* its function */ int i; pthread_create(&t1, NULL, print_count, NULL); for( i = 0 ; i
源代码:
#define NUM 5
int counter = 0;
main()
{
pthread_t t1; /* one thread */
void *print_count(void *); /* its function */
int i;
pthread_create(&t1, NULL, print_count, NULL);
for( i = 0 ; i
#define NUM 5
int counter = 0;
main()
{
pthread_t t1; /* one thread */
void *print_count(void *); /* its function */
int i;
pthread_create(&t1, NULL, print_count, NULL);
for( i = 0 ; i