| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 702 人关注过本帖
标题:问题求助 error: 'SIGQUIT' was not declared in this scope
只看楼主 加入收藏
QQ429229407
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2022-9-10
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
问题求助 error: 'SIGQUIT' was not declared in this scope
用的软件是vscode

程序代码:
#include "apue.h"

void *thread_fun(void *arg){
    sleep(1);
    printf("wo shi new thread\n");
    return (void *)0;
}

int main(int argc, char **argv){
    pthread_t tid;
    int err;
    int s;
    void *rval;
    err = pthread_create(&tid, NULL, thread_fun, NULL);
    if (err) {  
        printf("pthread_create error\n");
        return 0;
    }
    //sleep(1);
    s = pthread_kill(tid,SIGQUIT);    //向新线程发送信号
    if (s == ESRCH){    //检测线程是否存在
        printf("new thread is not found\n");
    }
    printf("new thread exit code is %d\n",pthread_join(tid,&rval));
   /// system("pause");
    return 0;
}

程序代码:
#include "apue.h"中包含的头文件如下
#include<pthread.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<unistd.h>
#include<sys/types.h>
#include <signal.h>



signal.h头文件中
#ifdef _POSIX
以下的显示为灰色
#define    SIGHUP    1    /* hangup */
#define    SIGQUIT    3    /* quit */
#define    SIGTRAP    5    /* trace trap (not reset when caught) */
#define SIGIOT  6       /* IOT instruction */
#define    SIGEMT    7    /* EMT instruction */
#define    SIGKILL    9    /* kill (cannot be caught or ignored) */
#define    SIGBUS    10    /* bus error */
#define    SIGSYS    12    /* bad argument to system call */
#define    SIGPIPE    13    /* write on a pipe with no one to read it */
搜索更多相关主题的帖子: not printf void define include 
2022-09-10 12:24
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
收藏
得分:20 
以下的显示为灰色
#ifdef _POSIX 不是写得很清楚嘛
2022-09-10 13:12
快速回复:问题求助 error: 'SIGQUIT' was not declared in this scope
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015433 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved