[Bug c++/21240] Deadlock (pthread) in signal handler
szehau at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Apr 28 02:07:00 GMT 2005
------- Additional Comments From szehau at gmail dot com 2005-04-28 02:06 -------
(In reply to comment #1)
> Do you have a testcase?
> On second thought pthreads and mutex lockes and signals are out of the scope
of a compiler, If this is
> a bug, this is a glibc bug but I really doubt it.
In this case, I need to know whether there is a fucntion that I can use to check
whether a mutex is currently locked.
For example:
void alarmHdl (int sig) {
// Check whether a mutext is lock here
bool locked = someFunctionToCheckMutexIsLocked ();
if (!locked) {
// other tasks here that might call malloc or free
}
}
int main () {
signal (SIGALRM, alarmHdl);
alarm (5);
// a big loop
for (;;) {
// tasks here might call malloc or free
}
return 0;
}
Thanks
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21240
More information about the Gcc-bugs
mailing list