Skip to content

Instantly share code, notes, and snippets.

@andreiglingeanu
Last active May 5, 2017 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreiglingeanu/7d36dce4c31d0c3353d700c24e685645 to your computer and use it in GitHub Desktop.
Save andreiglingeanu/7d36dce4c31d0c3353d700c24e685645 to your computer and use it in GitHub Desktop.
Define a lock in Mozart
declare
C = {NewCell 0}
L = {NewLock}
thread I in
lock L then I in
I = @C
C := I + 1
{Show 'Thread I'}
{Show C}
end
end
thread J in
lock L then I in
J = @C
C := J + 1
{Show 'Thread J'}
{Show C}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment