#include
#include
#include
#include
#include
void *start_handler(void *);
int main(void)
{
pthread_t tid;
int err;
if(err = pthread_create(&tid, NULL, start_handler, NULL))
{
fprintf(stderr, "Create thread: %s\n", strerror(err));
return -1;
}
printf("OK\n");
return 0;
}
void *start_handler(void *arg)
{
int err;
if(err = pthread_detach(pthread_self()))
{
fprintf(stderr, "Detach thread: %s\n", strerror(err));
pthread_exit((void *)-1);
}
printf("Start!\n");
pthread_exit((void *)1);
}