2
pthread (저는 Eclipse IDE에서 링커와 컴파일러를 먼저 구성했습니다)를 사용하여 c로 일부 코드를 작성했습니다.pthread가있는 원격 함수
#include <pthread.h>
#include "starter.h"
#include "UI.h"
Page* MM;
Page* Disk;
PCB* all_pcb_array;
void* display_prompt(void *id){
printf("Hello111\n");
return NULL;
}
int main(int argc, char** argv) {
printf("Hello\n");
pthread_t *thread = (pthread_t*) malloc (sizeof(pthread_t));
pthread_create(thread, NULL, display_prompt, NULL);
printf("Hello\n");
return 1;
}
잘 작동합니다. 그러나 display_prompt를 UI.h로 이동하면 "Hello111"출력이 인쇄되지 않습니다.
누구나 해결 방법을 알고 있습니까? Elad
EXIT_SUCCESS 대신 0을 명시 적으로 반환하지 않고 기분이 좋습니다. – evilpie
참. 그 가치가 절대로 바뀌지는 않지만 조금 더 명백합니다. – Thomas
감사합니다. 내 문제가 달랐습니다. 모든 기능이 하나의 파일에있을 때 문제가 없었습니다. display_prompt()를 다른 파일로 옮기면 작동하지 않습니다. thread_join을 추가했지만 이제는 동일한 파일의 display_prompt()가 작동하지 않습니다. Eclipse에서 디버깅 할 수있는 특별한 방법이 있습니까? –