Last active
September 25, 2022 17:55
Star
You must be signed in to star a gist
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