摘要 |
Managing exclusive control of a shareable resource includes publishing a claim non atomically to a lock by a thread that is next to own the lock in an ordered set of threads that have requested to own the lock. The claim includes a structure capable of being read and written only in a single memory access. A determination is made of whether the next owning thread has been pre-empted. Responsive to the determination, the next owning thread of the lock acquires the lock if the next owning thread has not been pre-empted and retries acquisition of the lock if the next owning thread has been pre-empted. Responsive to the next owning thread being pre-empted, a subsequent owning thread acquires the lock unfairly and atomically, consistently modifies the lock such that a next lock owner can determine that the next lock owner has been preempted. |