#include
#include
void *func1(void *args){
printf("Phrase %li: Powerful Minds goes crazed after learning the truth\n",pthread_self());
pthread_exit(0);
}
void *func2(void *args){
printf("Phrase %li: Look at the stars, even giants leave only a speckle after they are gone\n",pthread_self());
pthread_exit(0);
}
void *func3(void *args){
printf("Phrase %li: Madness is the step after genius\n",pthread_self());
pthread_exit(0);
}
int main(int argc, char **argv){
void *funcs[3];
int i;
pthread_t id[3];
funcs[0]=func1;
funcs[1]=func2;
funcs[2]=func3;
for(i=0;i
if(pthread_create(&id[i],NULL,funcs[i],(void*)(i))){
printf("Error: in pthread creation\n");
return 0;
}
return 0;
}
}
이런 코드 짜서 분명히 실행파일 잘 나와서 실행했는데 thread 내부에 있는 printf 함수들 전부다 출력이 안나오네요... 실행은 우분투에 있는 터미널로 했고 gdb로 next눌러가면서 실행하면 thread create 됐다고도 뜨고 printf 함수들도 잘 나오는데 터미널에서는 아무것도 안나오네요...
쓰레드생성이안된거? - dc App
gdb로 돌려보니까 쓰레드 생성은 된거같은데 shell로 봤을때 출력이 안되요...