首页 > 其他 > 详细

Operating System: Three Easy Pieces ---An Example: Thread Creation (Note)

时间:2015-11-05 14:44:36      阅读:245      评论:0      收藏:0      [点我收藏+]

Let‘s say we wanted to run a program that created two threads, each of which was doing

some independently work, in this case printing "A" or "B". The code is shown in Figure 26.2.

The main program creates two threads, each of which will run the function mythread(), 

though with different arguments (the string A or B). Once a thread is created, it may start

running right away (depending on the whims of scheduler); alternatively, it may be put in a

"ready" but not "running" state and thus not run yet. After creating the two threads (T1 and

T2), the main thread calls pthread_join(), which waits for a particular thread to complete.

 

Operating System: Three Easy Pieces ---An Example: Thread Creation (Note)

原文:http://www.cnblogs.com/miaoyong/p/4939229.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!