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);
}
}