#include<string.h>
#include<pthread.h>
#include<stdio.h>
#include<stdlib.h>
void *callback(void*arg ){
printf("child thread id : %ld.\n",pthread_self());
return NULL;
}
int main(void){
pthread_t tid;
int ret = pthread_create(&tid,NULL,callback,NULL);
if(ret != 0){
char*str = strerror(ret);
printf("error1:%s\n",str);
}
printf("tid : %ld , main thread : %ld.\n",tid,pthread_self());
ret = pthread_detach(tid);
if(ret != 0){
char*str = strerror(ret);
printf("error2:%s\n",str);
}
ret = pthread_join(tid,NULL);
if(ret != 0){
char*str = strerror(ret);
printf("error3:%s\n",str);
}
pthread_exit(NULL);
return 0;
}
