lockset .. how do you know u got the lock?
stevenolan
Posts: 3
With locks, in assembler how do know you got the lock?
The documentation is really bad.
The documentation is really bad.
Comments
Jonathan
[edit: pun not intended, a spinlock is a standard thing in multiprocessor hardware - compare semaphore, event counter]
"The LOCKSET instruction reads the current state of the lock bit and ALWAYS sets the lock to one. The previous state of the lock is written to the C flag. If the C flag is 0 (IF_NC) then nobody had the lock set before you, so now it's yours (and set to 1). If the C flag is 1 (IF_C) then another process already had the lock set and you should wait."