Last active
December 15, 2015 03:29
-
-
Save onesuper/5194775 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| struct foo { | |
| int x; | |
| int y; | |
| }; | |
| static struct foo f; | |
| /* The two following functions are running concurrently: */ | |
| int sum_a(void) | |
| { | |
| int s = 0; | |
| int i; | |
| for (i = 0; i < 1000000; ++i) | |
| s += f.x; | |
| return s; | |
| } | |
| void inc_b(void) | |
| { | |
| int i; | |
| for (i = 0; i < 1000000; ++i) | |
| ++f.y; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment