Re: A new Critical Section for high contention situations
- From: "Remy Lebeau" <no.spam@xxxxxxxxxxx>
- Date: Thu, 15 May 2008 23:23:04 -0700
"Kürsat" <xx@xxxxxx> wrote in message
news:O6WqZyqtIHA.3604@xxxxxxxxxxxxxxxxxxxxxxx
You said "there is no synchroniztion", then, what does synchronization
mean? AFAIK, synchronization means "accepting only one thread to access
certain resource or functionality at a time". My object achive this, so, I
think, there is synchronization.
No, there isn't. You are synchronizing access to m_nLock only, not access
to the code that enter/leave() are supposed to protect. enter() is still
being allowed to exit immediately regardless of whether another thread
"owns" the lock. In order to synchronize properly, enter() must wait for
the lock to be released, if owned by other thread, before exiting. Your
object is not doing that at all. So multiple threads are still able to
access protected code unrestricted, defeating the whole purpose of a
synchronization object.
Gambit
.
- Follow-Ups:
- References:
- A new Critical Section for high contention situations
- From: Kürşat
- Re: A new Critical Section for high contention situations
- From: Keith Moore
- Re: A new Critical Section for high contention situations
- From: Kürsat
- A new Critical Section for high contention situations
- Prev by Date: Re: Using CreateFile to load sound device.
- Next by Date: Re: A new Critical Section for high contention situations
- Previous by thread: Re: A new Critical Section for high contention situations
- Next by thread: Re: A new Critical Section for high contention situations
- Index(es):
Relevant Pages
|
Loading