Results 1 to 1 of 1
Hi all, I have a problem about signal. When a process is interrupted by a signal, a mutex lock (eg. when calling free(), malloc() or other C functions) might be ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-28-2005 #1
- Join Date
- Apr 2005
Deadlock (pthread) in signal handler
I have a problem about signal.
When a process is interrupted by a signal, a mutex lock (eg. when calling
free(), malloc() or other C functions) might be already acquired after the
interruption. Therefore, when the program calls a C function (eg malloc(0 or free()), the program goes into a race condition and is waiting for a mutex to be unlocked. I understand this is the way the system being design but my questions are:
1. Is there any way to check whether there is a mutex was already locked (for
the above case) in the program's signal handler? or any compler option that I can apply to avoid the deadlock?
For your information, I am using
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Low Sze Hau