免费注册 查看新帖 |

Chinaunix

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

[C] help pthread_tryjoin_np函数 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-10 10:36 |只看该作者 |倒序浏览
10可用积分
我在ubuntu上调试程序,内核比较新,线程库中有pthread_tryjoin_np函数。但是实际环境是FC2, 里面没有pthread_tryjion_np这个函数:
内核是2.6.17, gcc (GCC) 3.3.3

线程库是:
/lib/tls/libpthread.so.0
NPTL 0.61 by Ulrich Drepper
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Forced unwind support include

编译程序:
gcc -Wall -g -std=c99 -D_GNU_SOURCE -pthread -c *.c

程序如下:

@:~$ cat 1.c
#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void fun()
{
    printf("aaaaa\n");
    sleep(10);
}
int
main()
{
// int pthread_create(pthread_t * thread, pthread_attr_t * attr, void * (*start_routine)(void *), void * arg);

//extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;

    pthread_t pid;
    printf("create\n");
    pthread_create(&pid, NULL, (void *)fun, NULL);

    int i;
    i=pthread_tryjoin_np(pid, NULL);
    printf("i = %d \n", i);

    exit(0);
}




有解决方案吗?

能不能升级一下线程库,只升级线程库,别升级glibc,那样动作太大。谢谢各位,在线等。。。

[ 本帖最后由 79hy 于 2009-6-10 11:50 编辑 ]

论坛徽章:
1
寅虎
日期:2014-11-30 21:25:54
2 [报告]
发表于 2009-06-10 11:27 |只看该作者
你的问题是什么? 你用这个函数做什么
/* Check whether thread TH has terminated.  If yes return the status of
    the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL.  */
extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;

论坛徽章:
0
3 [报告]
发表于 2009-06-10 11:31 |只看该作者
没说明白你的问题

论坛徽章:
0
4 [报告]
发表于 2009-06-10 11:52 |只看该作者
在FC2中旧版本的线程库没有这个函数,我想通过是不是可以某种方法只升级线程库,来获取这个函数。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP