Dear developers Dear Thomas As Thomas Pfaff has commented in previous messages, for example, http://www.cygwin.com/ml/cygwin/2003-10/msg01227.html, cygwin contains some code to check for an already initialized mutex attr and other pthread types.
I would strongly recommed to remove those checks because they are not 100% fiable and I think they cause more problems than solve. The proposed workaround (memset initalization) is OK for new code (and people aware ot that), but does not provide compatibility with standard code as boost::threads. I have had problems in complex programs using boost::thread, but I have prepared the following two simple examples in which the pthread_mutexattr_init() fails #include <assert.h> #include <pthread.h> void initstack() { int magic = 0xdf0df049; int* p = &magic; } pthread_mutexattr_t my_pthread_mutexattr_init(int type) { pthread_mutexattr_t tmp; assert(pthread_mutexattr_init(&tmp) == 0); assert(pthread_mutexattr_settype(&tmp, PTHREAD_MUTEX_DEFAULT) == 0); return tmp; } int main() { initstack(); pthread_mutexattr_t attr_error = my_pthread_mutexattr_init(PTHREAD_MUTEX_ERRORCHECK); pthread_mutexattr_t attr_recur = my_pthread_mutexattr_init(PTHREAD_MUTEX_RECURSIVE); pthread_mutexattr_destroy(&attr_error); pthread_mutexattr_destroy(&attr_recur); return 0; } The first call fails because the local variable pthread_mutexattr_t tmp hapens to point to a integer with the PTHREAD_MUTEXATTR_MAGIC value. (Murphy related problem) Even if you do not call to initstack(), the second call fails because the local variable tmp still retains the value of the previous call. (and stills points to a valid thread object). ___________________________________________________ Yahoo! Messenger - Nueva versión GRATIS Super Webcam, voz, caritas animadas, y más... http://messenger.yahoo.es -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/