Created
December 7, 2022 00:27
-
-
Save Blizzardo1/691e450a6486fa23d42e9b6dab502cff 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
#include <stdio.h> | |
#include <stdlib.h> | |
int turn = 0; | |
void some_routine(void) { | |
// Some code here | |
} | |
int critical_section() { | |
// Some code here | |
} | |
void loop() { | |
while(turn != 0) { | |
some_routine(); | |
} | |
critical_section(); | |
turn = 0; | |
} | |
int main(void) { | |
int i; | |
for(i = 0; i < 100; i++) { | |
loop(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment