免费注册 查看新帖 |

Chinaunix

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

hp11i 创建线程失败,请帮忙检查 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-03-23 19:38 |只看该作者 |倒序浏览
编译没有报错,但运行报错:created err code:251. 根据HP的错误解释251是
errno.h:#define ENOSYS          251     /* Function not implemented     */
程序代码是这样的:
#include <stdio.h>;
#include <string.h>;
#include <pthread.h>;

/* Th1 is a thread. */
void *Th1(void *arg)
{
  printf(\"ok.\\n\";
  return((void *)arg);
}
/* Main is a main program that creates the thread Th1. */
int main()
{
    pthread_t threadApp;
    char  *sd;
    pthread_attr_t attr;
    sd=NULL;       
   
    int ret=0;
   
    ret=pthread_create(&amp;threadApp,NULL,(Th1),(void *)1);
   
    if(ret!=0)
    {
        fprintf(stderr,\"created err code:%d.\\n\",ret);
        return 1;
    }
    printf(\"App thread created\\n\";
   
    if (pthread_join(threadApp,NULL) == 0)
    {
        printf(\"pthread fileprocess stop\\n\";
    }
    else
    {
        fprintf(stderr,\"pthread_join error\";
        return 1;
    }
    return 1;
}

mail: kans@21cn.com
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP