共 1,395 篇文章
共 6,621 篇文章及评论
博客分类
Blog Roll
- Association for Computing Machinery TechNews (ACM)
- Go Parallel! (Dr. Dobbs)
- HPCwire (Tabor Communications, Inc.)
- insideHPC (John West)
- Joe Duffy's Weblog (Microsoft)
- Microsoft Parallel Programming Development Center (Microsoft Germany)
- MultiCoreInfo.com
- scalability.org (Scalable Informatics)
- Software Dev Blog (Intel Germany)
- Soft Talk Blog (Intel United Kingdom)
- The Moth (Microsoft)
Archives
帖子来自 zgjxwl 
卖车票多线程示例 -- 互斥对象
作者: zgjxwl (1 篇文章) 日期: 四月 28, 2011 在 10:17 下午
评论 (0)
//多线程卖车票 | 互斥对象 #include #include int index=0; int tickets=100; HANDLE hMutex; DWORD WINAPI Thread1Proc(LPVOID lpParameter) { while(TRUE)//保证线程的不断执行 { WaitForSingleObject(hMutex,INFINITE);//获取互斥对象 if(tickets>0) { Sleep(1); cout<<"thread1 sells ...
