s********k 发帖数: 6180 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: silverhawk (silverhawk), 信区: JobHunting
标 题: 一直没有很好理解thread join itself,哪位解惑一下
发信站: BBS 未名空间站 (Wed May 2 20:30:51 2012, 美东)
thread join目的是block调用thread知道特定thread结束。那thread join itself是为
什么?难道自己block 自己?
下面是一个简单例子伪代码(几乎所有编程语言都支持)
t1=threadstart();
t2=threadstart();
t1.join()
t2.join()
这里面我首先开始thread t1,然后我调用t1.join,那意思是t1 被block?直到t1自己
运行完?不是太理解这个意思,哪位解惑一下? | k**********g 发帖数: 989 | 2 Thread creation and process forking are different. Do not be confused.
To create a thread, you must specify a starting point (usually a function
pointer) where the thread will start executing.
t1 will execute the starting function you specified, and will continue to
execute until it finishes.
The main thread will just continue with the next line. |
|