
20 Jul
2004
20 Jul
'04
2:24 p.m.
Alexander Terekhov wrote:
Peter Dimov wrote: [...]
Here's TryEnterCriticalSection (-recursivity) for reference:
bool try_lock( critical_section * p ) { return atomic_compare_exchange( p->LockCount, -1, 0 ) == 0; }
The point of "swap based mutex" exercise was to avoid CAS because i386 doesn't have it. With CAS (and absent timedlock operation), it can be made safe and fast (better than MS "critical" stuff).
Why is i386 support important (for a Windows mutex implementation, I mean)?