#include "pthread.h"
#include "stdio.h"
#include "stdlib.h"
void* thread_func1(void *arg)
{
int *val = arg;
printf("Hi, I'm a thread/n");
if(NULL!=arg)
{
while(1)
{
printf("Argument Set : %d/n",*val);
}
}
}
int main()
{
pthread_t tid;
int t_arg = 100;
if(pthread_create(&tid,NULL,thread_func1,&t_arg))
perror("Fail to Create thread");
sleep(3);
printf("Main thread!/n");
pthread_cancel(tid);
return 0;
}