LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1413|回复: 4

glibc-2.10.1下有没有人能使用pthread_mutex_timedlock()这个函数?

[复制链接]
发表于 2009-8-31 13:17:23 | 显示全部楼层 |阅读模式
例子如下:

  1. /*
  2. * compile: gcc example.c -lpthread -lrt
  3. */
  4. #include <pthread.h>
  5. #include <time.h>
  6. #include <string.h>
  7. #include <stdio.h>

  8. pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
  9. int main()
  10. {
  11.         struct timespec abs_time;
  12.         pthread_mutex_lock(&lock);
  13.         clock_gettime(CLOCK_REALTIME, &abs_time);
  14.         abs_time.tv_sec += 2;
  15.         int rc = pthread_mutex_timedlock (&lock, &abs_time);
  16.         if (rc!=0) {
  17.                 printf("pthread_mutex_timedlock() returned: %s\n", strerror(rc));
  18.         }
  19.         return 0;
  20. }
复制代码


因为glibc不能降级,所以我这里测试不成,谢谢大家!
发表于 2009-8-31 17:36:02 | 显示全部楼层
好像是不行
futex(0x80497c8, 0x180 /* FUTEX_??? */, 2, {1251711162, 69280622}) = -1 ENOSYS (Function not implemented)

可惜我所有机器都已经升级到了2.10.1
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-31 18:55:28 | 显示全部楼层
Post by zhllg;2022325
好像是不行
futex(0x80497c8, 0x180 /* FUTEX_??? */, 2, {1251711162, 69280622}) = -1 ENOSYS (Function not implemented)

可惜我所有机器都已经升级到了2.10.1


emerge dev-libs/ace, configure的时候卡在check mutex timeouts这里, 脚本里是检查pthread_mutex_timedlock的返回值, 我这里一台debian的glibc-2.9可以通过
http://bugs.gentoo.org/show_bug.cgi?id=279610
回复 支持 反对

使用道具 举报

发表于 2009-9-23 17:35:46 | 显示全部楼层
还好早就没用ace了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-9-23 18:30:46 | 显示全部楼层
http://sources.redhat.com/bugzilla/show_bug.cgi?id=10578
应该是glibc的问题吧,我找到了这个
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表