This is the mail archive of the glibc-bugs@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cleanup handlers and sem_wait ....


webmyster@laposte.net wrote:

Jakub Jelinek wrote:

On Tue, Mar 22, 2005 at 03:03:14PM +0100, webmyster@laposte.net wrote:


I have a problem with cleanup handlers and sem_wait with the small program attached under linux.
On a first computer (glibc 2.3.4, gcc 3.3.3, kernel 2.6.8.1), when I compile it with g++, although the thread seems to close, the cleanup handler is not call. When I compile the programm with gcc, no problem occurs : the cleanup handler is call and the thread stop.


Works just fine here, glibc 2.3.4, gcc 3.4.3, kernel 2.6.10,
with all of
gcc
g++
gcc -I/usr/include/nptl -L/usr/lib64/nptl
g++ -I/usr/include/nptl -L/usr/lib64/nptl

testCancel is called in all cases.


I updated my system : gcc 3.4.3, glib 2.3.4 (compiled with gcc 3.3.3), linux kernel 2.6.11.4 (also compiled with gcc 3.3.3).
The same problem occurs !


Actually, it seems that the problem comes from the definition of pthread_cleanup_push and pthread_cleanup_pop.
I modified my pthread.h file. Now, it don't use the first definitions that use the __cleanup__ C attribut (through classes or explicit definition). It is using the __pthread_register_cancel and __pthread_unregister_cancel functions.
With this modification, the program is working just fine : the testCancle is called.

I've made other investigations : it seems that the __attribute__ ((cleanup(function))) is not respected !
In other words, whenever I do pthread_cancel, the stack is released, but the "cleanup functions" associated with static datas are not called.
I think that the destructor of __pthread_cleanup_class is not called, so my cleanup function is not called ...


Damien Touraine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]