免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5834 | 回复: 12
打印 上一主题 下一主题

pthread_mutex_unlock 导致线程阻塞 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-08-15 14:32 |只看该作者 |倒序浏览
HP-UNIX  Proc
主线程中pthread_mutex_init()
pthread_create();
在创建的新线程中调用pthread_mutex_lock()返回0;
然后调用pthread_mutex_unlock 线程阻塞
那位牛人知道怎么回事啊

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2005-08-15 14:34 |只看该作者

pthread_mutex_unlock 导致线程阻塞

>;>;pthread_mutex_unlock

后面的代码没执行?

论坛徽章:
0
3 [报告]
发表于 2005-08-15 14:39 |只看该作者

pthread_mutex_unlock 导致线程阻塞

没有用GDB跟踪pthread_mutex_unlock 就没有返回

论坛徽章:
0
4 [报告]
发表于 2005-08-15 14:39 |只看该作者

pthread_mutex_unlock 导致线程阻塞

等等,我把当时 pthread_mutex_t 内容贴上来

论坛徽章:
0
5 [报告]
发表于 2005-08-15 14:41 |只看该作者

pthread_mutex_unlock 导致线程阻塞

{m_short = {54, 0}, m_int = 129, m_int1 = {0, 1, 1, 1}, m_pad = 0,
  m_ptr = 0x1 <Error reading address 0x1: Invalid argument>;, m_int2 = {1, 0}, m_int3 = {0,
    0, -1, 0}, m_short2 = {0, 2368}, m_int4 = {0, 1, 1, 0, 1}, m_int5 = {0, 0}}
SirFang 该用户已被删除
6 [报告]
发表于 2005-08-15 14:43 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
7 [报告]
发表于 2005-08-15 14:51 |只看该作者

pthread_mutex_unlock 导致线程阻塞

我也奇怪呢,那位老大救救我

论坛徽章:
0
8 [报告]
发表于 2005-08-15 14:51 |只看该作者

pthread_mutex_unlock 导致线程阻塞

上锁和解锁部分加上错误处理代码,看一下错误代码是什么。

论坛徽章:
0
9 [报告]
发表于 2005-08-15 14:57 |只看该作者

pthread_mutex_unlock 导致线程阻塞

pthread_mutex_lock 返回零 pthread_mutex_unlock 就阻塞不返回啦

论坛徽章:
0
10 [报告]
发表于 2005-08-15 15:08 |只看该作者

pthread_mutex_unlock 导致线程阻塞

把你pthread_mutex_init的代码看一下。互斥量是全局对象还是局部对象。加锁有可能阻塞,解锁阻塞没见过。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP