[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
thread and signals
From: |
Nicolas Vignal |
Subject: |
thread and signals |
Date: |
Tue, 13 Feb 2001 16:09:54 +0100 |
Hi
I join a sample program who create 2 threads.
The child thread send a SIGSTOP to the father thread.
If I run this program many times, I can see 3 behaviour.
- run great
- freeze before the first child message
- freeze before the second child message
I use glibc-2.1.3 on RedHat 6.2
I didn't see any report about this kind of problem. May be there is a bug in
my sample.
All advices are welcome.
Regards
Nicolas
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
int function2(pthread_t fatherID)
{
printf("\n my father is %d \n\n",fatherID);
pthread_kill(fatherID, SIGSTOP);
printf("I am the child\n");
while(1);
}
int function1(void)
{
pthread_t threadID2=-1;
pthread_create(&threadID2, NULL, function2, (void *)pthread_self());
while(1)
{
printf("I am the father \n");
}
}
int main(int argc, char *argv[])
{
pthread_t threadID1=-1;
pthread_create(&threadID1, NULL, function1, NULL);
while(1);
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- thread and signals,
Nicolas Vignal <=