谁能告诉我,这段C语言代码到底哪里的语法出错啦?
发表于 : 2013-03-17 22:07
代码在这里:
编译的时候老是通不过,错误提示是
代码: 全选
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
void route(void *arg)
{
printf("Yes, Yes, Yes!\n");
}
void *func(void *arg)
{
pthread_detach(pthread_self());
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
pthread_cleanup_push(route, NULL);
while(1)
{
sleep(1);
}
}
int main()
{
pthread_t pt_one;
int return_value;
return_value = pthread_create(&pt_one, NULL, func, NULL);
sleep(10);
pthread_cancel(pt_one);
return 0;
}