Last active
September 25, 2022 17:55
-
-
Save khoa-io/e0b388ccfcc6f5b450ebbc4a791c2cdc to your computer and use it in GitHub Desktop.
Hello Multithreading World (Pthreads)
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
#include <pthread.h> | |
#include <stdio.h> | |
void *helloWorld(void *arg) { | |
(void)(arg); | |
printf("Hello Multithreading World\n"); | |
return (void *)0; | |
} | |
int main() { | |
pthread_t myThread; | |
int exitCode = 0; | |
exitCode = pthread_create(&myThread, NULL, &helloWorld, NULL); | |
if (exitCode != 0) { | |
return exitCode; | |
} | |
exitCode = pthread_join(myThread, NULL); | |
if (exitCode != 0) { | |
return exitCode; | |
} | |
return exitCode; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment