在接收节目的终端 - 信号SIG34,实时事件34 [英] Program terminating on receiving - signal SIG34, Real-time event 34

查看:1502
本文介绍了在接收节目的终端 - 信号SIG34,实时事件34的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序的主要功能调用功能可按 - F2它派生多个线程和应用工作正常。
现在,我想添加一个新功能F1 F2之前产卵一个新线程。这个新的线程打印屏幕上的东西,去为一个while循环睡眠。我正在打印一次,一段时间的应用程序终止后。从gdb调试同我得到了以下信息:

 (GDB)程序接收到的信号SIG34,实时事件34.Quit
(GDB)BT
#0 0x0fa97cc8在__nanosleep_nocancel()
从/export/home/disk4/omsn/401.03022010/montavista/pro/devkit/ppc/82xx/target/lib/tls/libc.so.6
在__sleep#1 0x0fa97a50在sleep.c(秒= 0):137
#2 0x10007098在main.c中F2(ARG =量0x204):152
#3 0x0fd2197c在pthread_create.c start_thread(ARG =量0x204):256
#4 0x0fac853c在克隆()
在../sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S:100警告:previous框架内与该帧(堆栈损坏?)

code段:

 的main(){
    F1(); / *新功能添加到生成一个新的任务* /
    F2(); / *现有功能派生多个任务* /
}

能否有人告诉我什么是信号SIG34,实时事件34有什么能引起相同的。

下面是详细的是什么呢F1:

  INT F1(){
    的pthread_t THREAD_ID;
    pthread_attr_t ATTR;
    为size_t STACK_SIZE;
    INT RET = 0;    pthread_attr_init(安培; attr指示);
    / *初始化堆栈大小* /
    pthread_attr_getstacksize(安培; attr指示,&安培; STACK_SIZE);
    的printf(缺省堆栈大小=%d个\\ N,STACK_SIZE);
    STACK_SIZE = 2000;
    pthread_attr_setstacksize(安培; attr指示,STACK_SIZE);    / *初始化分离状态* /
    pthread_attr_setdetachstate(安培; attr指示,PTHREAD_CREATE_DETACHED);    的printf(去产卵线程\\ n);
    RET =在pthread_create(安培; thread_id单,和放大器; attr指示,task_func,NULL);
    如果(RET){
        的printf(ERROR;从pthread_create的收益code()为%d \\ n,RET);
        返回RET;
    }其他{
        的printf(线程成功催生,线程ID - %d个\\ N的thread_id);
    }    pthread_attr_destroy(安培; attr指示);    返回RET;
}无效* task_func(无效* ARG){
    的printf(内部%回事长期睡眠\\ n,__ FUNCTION__);
    睡眠(100);
    而(1){
        的printf(内部%S \\ n,__ FUNCTION__);
        睡眠(5);
    }}


解决方案

Linux支持最初在POSIX.1b实时扩展定义的(现在包含在POSIX.1-2001)的实时信号。
支持实时信号的范围由宏定义的 SIGRTMIN SIGRTMAX
你是从信号34.And获取软件中断它的 SIGTEMI + 0
在终端下面的命令类型


  

$杀-l


您将获得的信号列表。
你会得到关于此链接这个信号的进一步信息。
http://www.freedesktop.org/software/systemd/man/systemd.html
我希望这些信息将帮助你找到后面越来越signal34.Because你有没有更新整个code在这里的原因,所以这是有点很难说为什么,你收到此SIGNAL34。

In my application the main function calls a funciton - f2 which spawns several threads and application works fine. Now I am trying to add a new function f1 before f2 to spawn a new thread. This new thread prints something on the screen and goes for a sleep in a while loop. I am getting the print once and after some time the application terminates. On debugging the same from GDB I got the following message:

(gdb) Program received signal SIG34, Real-time event 34.Quit
(gdb) bt
#0  0x0fa97cc8 in __nanosleep_nocancel ()
from /export/home/disk4/omsn/401.03022010/montavista/pro/devkit/ppc/82xx/target/lib/tls/libc.so.6
#1  0x0fa97a50 in __sleep (seconds=0) at sleep.c:137
#2  0x10007098 in f2 (arg=0x204) at main.c:152
#3  0x0fd2197c in start_thread (arg=0x204) at pthread_create.c:256
#4  0x0fac853c in clone ()
at ../sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S:100 warning: Previous frame inner to this frame (corrupt stack?)

Code Snippet:

main(){
    f1(); /*New function added to spawn a new task*/
    f2(); /*Existing function spawns several tasks*/
}

Can some one tell me what is "signal SIG34, Real-time event 34" and what could be causing the same.

Here are the details of what f1 does:

int f1(){
    pthread_t thread_id;
    pthread_attr_t attr;
    size_t stack_size;
    int ret=0;

    pthread_attr_init(&attr);
    /*Initialize the stack size*/
    pthread_attr_getstacksize (&attr, &stack_size);
    printf("Default Stack Size = %d\n", stack_size);
    stack_size = 2000;
    pthread_attr_setstacksize (&attr, stack_size);

    /*Initialize detach state*/
    pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);

    printf("Going to spawn thread\n");
    ret = pthread_create(&thread_id, &attr, task_func, NULL);
    if (ret){
        printf("ERROR; return code from pthread_create() is %d\n", ret);
        return ret;
    }else{
        printf("thread successfully spawned, thread id - %d\n", thread_id);
    }

    pthread_attr_destroy(&attr);

    return ret;
}

void* task_func(void* arg){
    printf ("Inside %s going for long sleep\n",__FUNCTION__);
    sleep(100);
    while(1){
        printf ("Inside %s\n",__FUNCTION__);
        sleep(5);
    }

}

解决方案

Linux supports real-time signals as originally defined in the POSIX.1b real-time extensions (and now included in POSIX.1-2001). The range of supported real-time signals is defined by the macros SIGRTMIN and SIGRTMAX. you are getting software interrupt from signal 34.And it's SIGTEMI+0. Type below command in terminal

$ kill -l

You will get list of signals. You will get further information regarding this signal on this link. http://www.freedesktop.org/software/systemd/man/systemd.html I hope this information will help you to find the reason behind getting signal34.Because you have not updated whole code here, so it's little bit hard to say why you are getting this SIGNAL34.

这篇关于在接收节目的终端 - 信号SIG34,实时事件34的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆