From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ffc1e,bc5b0be4bdad749d,start X-Google-Attributes: gidffc1e,public X-Google-Thread: fa528,bc5b0be4bdad749d,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-08-12 23:55:55 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!203.50.2.79!intgwlon.nntp.telstra.net!nsw.nnrp.telstra.net!not-for-mail Message-ID: <3B77796D.6218EA20@ot.com.au> From: Raj Calisa Organization: Open Telecommunications Ltd X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.16-22 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.programming.threads,comp.unix.tru64 Subject: mutex problem using DECthreads Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cache-Post-Path: emissary!unknown@10.70.83.39 X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) Date: Mon, 13 Aug 2001 16:53:33 +1000 NNTP-Posting-Host: 203.42.249.64 X-Complaints-To: abuse@telstra.net X-Trace: nsw.nnrp.telstra.net 997685741 203.42.249.64 (Mon, 13 Aug 2001 16:55:41 EST) NNTP-Posting-Date: Mon, 13 Aug 2001 16:55:41 EST Xref: archiver1.google.com comp.programming.threads:5396 comp.unix.tru64:4163 Hi all, I am using DECthreads on Digital Unix 4.0F (patch kit 5). In our, application, one of our threads cause the application to crash due to an assertion failure. This happens when it tries to acquire a mutex and it fails. This mutex happens to be a static mutex. It is wrapped up in a C++ class which is created statically. The mutex itself is created in the constructor of the class using pthread_mutex_init() rather than PTHREAD_MUTEX_INITIALIZER. I remember reading somewhere that all static mutexes must be initialized using the macro and non-static ones with the init() function, otherwise one would get undefined behaviour. Is this true? If so, does a mutex wrapped into a class whose object gets created statically qualify as a static mutex? I checked the documentation in pthread.h and it says that the "sequence" field of the mutex object is set to 0 initially for static mutexes initialized with the macro and to some non-zero value for the one created using the init() call. The mutex in question is presumably static, but initialized with the init() call and has a sequence number of "0" when I checked it under the debugger. The "lock" field wass having a bad value as well, which explains why mutex_lock() failed. Is DECthreads doing something consciously to reject the call to pthread_mutex_init()? I am not ruling out memory corruption, but I would like to explore other possibilities before delving into that one. Thanks rajanish...