This is the mail archive of the cygwin mailing list for the Cygwin 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]

Statically initialising pthread attributes in dynamic dlls.


Trying to initialise a pthread attribute in a static variable seems to cause a segfault. I've attach a simple test case compiled using;

g++ -g mutex.cpp -o mutex.dll -lpthread
g++ -g test.cpp -o test.exe -ldl

I've cropped the code down to the essential bits, so no error reporting if it can't find the dll, etc.

The only other bits of information I can give which might or might not be helpful are;

1) Calling pthread_mutexattr_init in a static variable in the executable works.
2) If I remove the pthread_mutexattr_init/pthread_mutexattr_destroy calls it works.
3) Delaying the pthread_mutexattr_init call until the first time the Mutex class is used works BUT then the
segfault happens when dlclose is called.


I haven't managed to track down the cause of the segfault yet, I'm getting a bit lost in the debugger :/

Andy

Attachment: mutex.cpp
Description: Text document

Attachment: test.cpp
Description: Text document

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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