This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
malloc mutex and exceptions
- From: Ignasi Villagrasa <igviis at terra dot es>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 21 Mar 2004 20:31:15 +0100
- Subject: malloc mutex and exceptions
Hi everyone,
I have been migrating to gcc a server C/C++ based software and I' like to
control SIGSEGV signal exceptions. So I use sigaction and the corresponding
handlers to accomplish this target.
The problem arises when a SIGSEGV happens inside a new operator. I have many
users connected to the program and the clients suddenly hang. That's because
of pthread mutex the malloc and free routines use. The SIGSEGV occurs after
pthread_mutex_lock call and before pthread_mutex_unlock.
So, every time a user tries to use this semaphore the program hangs. New and
delete uses malloc and free with reentrant features. And I'm interested in
that because of pthread program use, but I have this problem for the
exception control.
When I have a problem using one of my mutex I can control lock and unlock
properly, but new and delete mutex relies on library variables.
Is there any way I can control this internal mutex ?
Is there any compiler option to change this behaviour ?
Thanks in advance,
Ignasi Villagrasa.