Last active
May 5, 2017 20:58
-
-
Save andreiglingeanu/7d36dce4c31d0c3353d700c24e685645 to your computer and use it in GitHub Desktop.
Define a lock in Mozart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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