Mutex implementation questions

Scott McCaskill scott@3dfx.com
Mon Oct 2 15:04:00 GMT 2000


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.






More information about the Pthreads-win32 mailing list