锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 / C语言开源技术 / Redhat Linux的pthread_kill问题
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。需要全文内容也请联系孙老师。

Redhat Linux的pthread_kill问题

What is wrong with pthread_kill on Redhat Linux??? 在Redhat Linux中 pthread_kill有什么问题吗? ? ?
Source: http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2004−01/0548.html
From: Anoop Kumar (anoop_kn_at_yahoo.com)
Date: 01/23/04
Date: 23 Jan 2004 03:39:18 −0800
来源:http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2004−01/0548.html
来自:安普库马尔(anoop_kn_at_yahoo.com)>
日期:01/23/04
日期:2004年1月23日03:39:18−0800


Hi,你好,
I have redhat 9.0 Linux installed on my system with gcc 3.2.3. 我已经在9.0 redhat Linux系统上安装了gcc 3.2.3。
This is the program i used, i compiled it with −lpthread option. 这是我使用的程序,我使用−lpthread选项编译。
Here i am starting 3 threads and then i am calling pthread_kill on athread which is non−existent , the signal being passed is '0'. 在这里,我开始3个线程,然后我在一个不存在的线程里调用pthread_kill,传递的信号是“0”。
According to the POSIX standard if the thread doesn't exist it shouldset errno to ESRCH. But instead it causes a segmentation fault. 根据POSIX标准,如果主题不存在应设置errno为搜索。但是,相反它会导致分段错误。
Why is that ??? 这是为什么呢? ? ?

Is there any work around to this problem ??? 有解决这个问题的吗? ? ?
Is this a linux problem or just Redhat 9.0 problem??? 这是linux的问题或者只是Redhat 9.0问题? ? ?

#include <stdio.h> #include <unistd.h> #include <pthread.h> #include<signal.h> #include <errno.h> void* do_loop(void* data) { long int i; int j; int me = *((int*)data); while (1) // infinite loop { i++; if( i%1000000== 0) printf("thread %d − i val %d\n", me, i); if(i==225000000) pthread_exit(NULL); } pthread_exit(NULL); // There is no point of this actually } int main()

友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内