|
|
发表于 2005-4-21 01:55:00
|
显示全部楼层
Re:MSDN的一句话
If the thread absolutely needs to own the resource before continuing, use EnterCriticalSection. For the moment, set aside the SpinCount test used on multiprocessor machines. This routine, like TryEnterCriticalSection, adjusts the bookkeeping for the critical section if it is free or already owned by the thread. It's important to note that the all-important LockCount increment is done using the x86 "lock" prefix. This ensures that only one CPU at a time can modify the LockCount field. (In fact, the Win32 InterlockedIncrement API is just an ADD instruction with the same lock prefix.)....
MSDN:http://msdn.microsoft.com/msdnmag/issues/03/12/CriticalSections/default.aspx |
|