2013年6月28日

使用sem_post信号量进行线程同步

摘要: 写了一小段程序,测试一下线程同步的问题,如下:#include #include #include #include #include #include sem_t sp; int val = -1;int semPost(sem_t * pSem, int nMaxCount){ int nRet, nSemCount; sem_getvalue(pSem, &nSemCount); if (nSemCount>=nMaxCount) { return 0; } else { nRet=sem_post(pSem); ... 阅读全文

posted @ 2013-06-28 15:01 净坛使者 阅读(974) 评论(0) 推荐(0) 编辑

导航