malloc mutex and exceptions

Ignasi Villagrasa igviis@terra.es
Sun Mar 21 21:42:00 GMT 2004


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.



More information about the Gcc mailing list