Reputation
Top tag
Next privilege 125 Rep.
Vote down
Badges
2
Newest
 Teacher
Impact
~987 people reached

  • 0 posts edited
  • 0 helpful flags
  • 0 votes cast
Apr
10
comment why no hasLock/testLock on mutexes
(Grrr -- misread the question. That'll teach me.) There's a difference between an "islocked()" or "haslock()" method/function and "trylock()", which either acquires the lock or returns failure. There is no race condition for a test-and-lock function that is completely atomic. The logic is even fairly simple -- acquire a lock on the lock (spinlocks are handy), determine if the lock is held, if not you can modify the lock (you've locked it, after all), release the lock on the lock, and you return success. If the lock is held, release the lock and return failure.
Aug
27
awarded  Autobiographer
Aug
27
awarded  Teacher
Aug
27
answered why no hasLock/testLock on mutexes
May
19
answered I'm graduating with a Computer Science degree but I don't feel like I know how to program