This is the mail archive of the pthreads-win32@sources.redhat.com mailing list for the pthreas-win32 project.


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

RE: Mutex implementation questions


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.


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