From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott McCaskill To: 'Tristan Savatier' , "'pthreads-win32@sources.redhat.com'" Subject: RE: Mutex implementation questions Date: Mon, 02 Oct 2000 15:04:00 -0000 Message-id: X-SW-Source: 2000/msg00117.html Title: RE: Mutex implementation questions > -----Original Message----- > From: Tristan Savatier [ mailto:tristan@mpegtv.com ] > Sent: Monday, October 02, 2000 5:10 PM > To: 'pthreads-win32@sources.redhat.com' > Subject: Mutex implementation questions > > > I noticed that if _pthread_try_enter_critical_section has been set > to a non-NULL value by DllMain, Mutexes are implemented using > critical sections (InitializeCriticalSection) instead of > CreateMutex, regardless of the value of the implemetation-specific > forcecs > mutex attribute. > > According to "Win32 programming", critical sections are light weight > compared to mutexes, they are not managed by the kernel, and they > are much faster than mutexes.  So why no use critical sections > all the time to implement pthread mutexes ? > > Are there cases where critical sections are not available or > wouldn't work well ? > Yes, I'm pretty sure critical sections can't be shared between processes (but mutexes can).  So this may be the reason.