드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
pthread_create 예제인데 오류좀 잡아주시면 안될까요ㅠ
게시물ID : computer_43857짧은주소 복사하기
작성자 : 간지늅늅이![](http://www.todayhumor.co.kr/member/images/icon_ribbon.gif)
추천 : 0
조회수 : 469회
댓글수 : 3개
등록시간 : 2012/04/14 23:51:04
#include <stdio.h>
#include <pthread.h>
#include <time.h>
int cnt = 0;
void *thread_func(void *arg);
void main()
{
time_t start,end,total=0;
int state = 0;
pthread_t t_id;
int count = 0;
start = time(NULL);
pthread_create(&t_id,NULL,thread_func,NULL)
while(1)
{
count++;
printf("Original_thread TID = %.2f\n",pthread_self());
end=time(NULL);
total = end - start;
if(total>10)
{
printf("Original_thread's print count = %d\n",count);
printf("Second_thread's print count = %d\n",cnt);
break;
}
}
}
void *thread_func(void *arg)
{
while(1)
{
cnt++;
printf("Second thread TID = %.2f\n", pthread_self());
}
}
이런데 오류가 나네요ㅠㅠ 왜날까요??
댓글 분란 또는 분쟁 때문에
전체 댓글이 블라인드 처리되었습니다.
새로운 댓글이 없습니다.