Skip to content
This repository has been archived by the owner on Jun 28, 2019. It is now read-only.

Commit

Permalink
sample/ch12/sharing.c: 消除一个编译器警告,增加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
mofaph committed Dec 17, 2013
1 parent ba6a91b commit 919205e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sample/ch12/sharing.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/*
* p662 -- code/conc/sharing.c
*
* 这段代码用来说明关于多线程程序中的共享变量。下面的代码由一个创建了两个对等线程
* 的主线程组成。主线程传递一个唯一的 ID 给每个对等线程,每个对等线程利用这个 ID
* 输出一条个性化的信息,以及调用该线程例程的总次数。
*
* 在 UNIX 系统下编译和运行:
*
* unix> make sharing
* unix> make sharing # 编译时可能会有警告,可以忽略
* unix> ./sharing
*/

Expand All @@ -28,6 +32,7 @@ int main()
for (i = 0; i < N; i++)
Pthread_create(&tid, NULL, thread, (void *)i);
Pthread_exit(NULL);
return 0;
}

void *thread(void *vargp)
Expand Down

0 comments on commit 919205e

Please sign in to comment.