2008年9月6日

一段使用 mutex 和 条件变量 pthread_cond_wait 的例子

摘要: http://blog.csdn.net/nightfallrove/archive/2008/05/26/2483403.aspx #include #include #include #include using namespace std;int Number = 0;pthread_mutex_t NMutex;pthread_cond_t NCond;void *thread1(void... 阅读全文

posted @ 2008-09-06 22:04 cy163 阅读(2968) 评论(1) 推荐(0) 编辑

在线程函数第一行调用 pthread_detach(pthread_self()) 返回值是22 不是 0

摘要: 近来发现 在线程函数第一行调用 pthread_detach(pthread_self()) 返回值是22 不是 0, 后来在网上找到以下话语 linux线程执行和windows不同,pthread有两种状态joinable状态和unjoinable状态, 如果线程是joinable状态,当线程函数自己返回退出时或pthread_exit时都不会释放线程所占用堆栈和线程描述符(总计8K多)。... 阅读全文

posted @ 2008-09-06 22:01 cy163 阅读(5879) 评论(0) 推荐(0) 编辑

导航