Skip to content

Instantly share code, notes, and snippets.

@Blizzardo1
Created December 7, 2022 00:27
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 Blizzardo1/691e450a6486fa23d42e9b6dab502cff to your computer and use it in GitHub Desktop.
Save Blizzardo1/691e450a6486fa23d42e9b6dab502cff to your computer and use it in GitHub Desktop.
#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