Skip to content

Instantly share code, notes, and snippets.

@pasali
Created November 14, 2013 19:19
Show Gist options
  • Save pasali/7472682 to your computer and use it in GitHub Desktop.
Save pasali/7472682 to your computer and use it in GitHub Desktop.
c thread example
#include <pthread.h>
#include <stdio.h>
void *kare_al(void * p){
int a;
a = (int *) p
printf(" %d\n", a * a);
pthread_exit(NULL);
}
int main(void){
pthread_t thread1, thread2;
pthread_create(&thread1,NULL, kare_al, (void *) 2);
pthread_create(&thread2,NULL, kare_al, (void *) 3);
pthread_join(thread1,NULL);
pthread_join(thread2, NULL);
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment