+ -
当前位置:首页 → 问答吧 → glibc-2.10.1下有没有人能使用pthread_mutex_timedlock()这个函数?

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

时间:2009-08-31

来源:互联网

例子如下:
代码:
/*
* compile: gcc example.c -lpthread -lrt
*/
#include <pthread.h>
#include <time.h>
#include <string.h>
#include <stdio.h>

pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
int main()
{
        struct timespec abs_time;
        pthread_mutex_lock(&lock);
        clock_gettime(CLOCK_REALTIME, &abs_time);
        abs_time.tv_sec += 2;
        int rc = pthread_mutex_timedlock (&lock, &abs_time);
        if (rc!=0) {
 printf("pthread_mutex_timedlock() returned: %s\n", strerror(rc));
        }
        return 0;
}
因为glibc不能降级,所以我这里测试不成,谢谢大家!

作者: whuwxl   发布时间: 2009-08-31

好像是不行
futex(0x80497c8, 0x180 /* FUTEX_??? */, 2, {1251711162, 69280622}) = -1 ENOSYS (Function not implemented)

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

作者: zhllg   发布时间: 2009-08-31

引用:
作者: zhllg
好像是不行
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

作者: whuwxl   发布时间: 2009-08-31

还好早就没用ace了

作者: 没本   发布时间: 2009-09-23

http://sources.redhat.com/bugzilla/s...g.cgi?id=10578
应该是glibc的问题吧,我找到了这个

作者: whuwxl   发布时间: 2009-09-23

热门下载

更多