-
-
Save krokodilerian/04de4b7ef331623ef3d218fdedf17e46 to your computer and use it in GitHub Desktop.
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
volatile int die=0; | |
void thread_func() { | |
while (42) { | |
do_something(); | |
do_anotherthing(); | |
if (die) { | |
close(fd); | |
return; | |
} | |
} | |
} | |
int main() { | |
pthread_create(thread_func); | |
pthread_create(thread_func); | |
pthread_create(thread_func); | |
wait_for_threads(); | |
} | |
volatile int die=0; | |
void thread_func() { | |
while (42) { | |
do_something(); | |
do_anotherthing(); | |
if (die) { | |
close(fd); | |
return; | |
} | |
} | |
} | |
int main() { | |
pthread_create(thread_func); | |
pthread_create(thread_func); | |
pthread_create(thread_func); | |
wait_for_threads(); | |
return die; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment