Re: Heap memory available (W32 console app in Visual C++)
On Wed, 27 Aug 2008 17:56:50 +0200, CriCri <bitwyse@leTIRETmaquis.net>
wrote:
Hello Doug
Doug Harrison [MVP] a ?crit :
That's the desired result, but it depends completely on the threads
all acquiring the same mutex before entering the critical section.
Now I just don't understand that statement _at all_! - it's a
contradiction in terms.
A mutex is like a token in a token ring: once someone has got it nobody
else can have it.
It's not a contradiction. Every thread that wants to access the shared data
has to acquire the mutex before doing so. If the mutex is currently held by
thread X, another thread Y will block when it tries to acquire the mutex;
that follows from the definition of a mutex.
Has Microsoft redefined what is a 'mutex' too? (is that what your 'pet
peeve' is?)
No, my pet peeve is that they named the struct they used to implement their
lightweight mutex "CRITICAL_SECTION", whereas standard OS terminology
defines "critical section" as a sequence of code, whose special properties
derive from using a mutex. A CRITICAL_SECTION *is* a mutex, and it pains me
that when I say "mutex" in a generic way, people sometimes think I mean
only the kernel mutex, when really I mean whichever one is appropriate. By
the time I explain that, I've used more characters than I avoided by
writing "mutex" instead of the clumsier misnomer "CRITICAL_SECTION".
--
Doug Harrison
Visual C++ MVP