간단한 멀티 스레드 프로그램을 작성하려고했습니다. 그것은 핵심을 버리고 있습니다.멀티 스레드 프로그램에서 코어 덤프
int t;
for(t=0; t<NUM_THREADS; t++)
{
printf("Main: creating thread %d\n", t);
rc = pthread_create(&thread[t], &attr, BusyWork, (void *)t);
}
문제 어디 찾는 제발 도와주세요 : 메인 함수 안에 다음과 같습니다 기능을 앞서 pthread_create
void *BusyWork(void *t)
{
int i;
int *tid;
int result=0;
tid = t;
printf("Thread %d starting...\n",*tid);
for (i=0; i<10; i++)
{
result = result + (i* i);
}
printf("thread %d is sleeping for %d sec's\n",tid,tid);
sleep(tid);
printf("Thread %d done. Result = %e\n",tid, result);
pthread_exit((void*) t);
}
내 전화 : 나는 스레드가 아래를 만들 때 호출되는 내 기능이? 미리 감사드립니다.
고맙습니다. – Vijay