while 루프를 종료하는 것에 대한 질문이 있습니다. 저는 문자열을 출력하는 두 개의 쓰레드를 만드는 코드를 작성하고 있습니다. main() 부분은 500 밀리 초마다 점 (".")을 인쇄해야합니다. 두 번째 스레드가 종료 된 후 while 루프를 종료하는 방법을 알려주십시오. ... 안녕하세요 ... 세계 .... THE END무한 루프를 종료하는 방법 (스레딩)
감사합니다.
int main()
{
int mls = 0.5 ;
pthread_t thread1;
pthread_t thread2;
struktura param1 = { "Hello", 2};
struktura param2 = { "World", 4};
pthread_create(&thread1, NULL, thread, ¶m1);
pthread_create(&thread2, NULL, thread, ¶m2);
while(1)
{
printf(".");
fflush(stdout);
sleep(mls);
}
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
printf("THE END\n");
return 0;
}
"int mls = 0.5"? 0.5는 정수가 아닙니다. –