-
-
Save zodiac1111/4f9f5deec7e513ff0044 to your computer and use it in GitHub Desktop.
Basic example multithreading in C
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
#import <stdio.h> | |
#import <pthread.h> | |
void *threadFunction(void *arg) { | |
// To be executed when called... | |
} | |
int main(void) { | |
pthread_t *thread; | |
// Start and launch the thread | |
pthread_create(&thread, NULL, threadFunction); | |
// Wait for it to finish | |
pthread_join(thread, NULL); | |
// Synchronized, thread finished. | |
return 0; | |
} | |
/// #import is a deprecated GCC extension [-Wdeprecated] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#import is a deprecated GCC extension [-Wdeprecated]