Skip to content

Instantly share code, notes, and snippets.

@davedice
Created April 22, 2015 19:18
Show Gist options
  • Save davedice/bb56f11ffe9f72710928 to your computer and use it in GitHub Desktop.
Save davedice/bb56f11ffe9f72710928 to your computer and use it in GitHub Desktop.
Acquire(L) :
auto n = QNodeAllocate()
n->Locked = 1
auto prv = swap (&L->Tail, n)
while prv->Locked != 0 : Pause
QnodeFree (prv)
L->Owner = n
Release(L) :
L->Owner->Locked = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment