Last active
December 17, 2015 12:09
-
-
Save austa/5607205 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <stdlib.h> | |
#include <pthread.h> | |
void *thread_proc(void *param); | |
int main(int argc, char *argv[]) | |
{ | |
pthread_t tid; | |
int result, i; | |
if ((result = pthread_create(&tid, NULL, thread_proc, NULL)) != 0) { | |
fprintf(stderr, "%s\n", strerror(result)); | |
exit(EXIT_FAILURE); | |
} | |
printf("Ana thread sonlaniyor!..\n"); | |
pthread_exit(NULL); | |
return 0; | |
} | |
void *thread_proc(void *param) | |
{ | |
int i; | |
for (i = 0; i < 10; ++i) { | |
printf("Thread: %d\n", i); | |
sleep(1); | |
} | |
pthread_exit(NULL); | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment