pthread_create Function
I trying to create multi thread programming in C.
I am getting ENOSYS error from pthread_create function. I would appreciate if someone can assit me. I am calling function thread_loop twice. But it is executing only once. Gettint error from pthread_create function. Thanks.
#include <pthread.h>
#include <errno.h>
void* thread_loop(void* data)
{
int i = 0;
long j = 0;
printf("Inside the function \n");
for (i = 0 ; i<5; i++)
{
for (j=0; j<900 ; j++);
printf("I value %d \n", i);
}
}
void main(int argc, char *argv[] )
{
int i = 1;
pthread_t thread1 ;
int ret ;
ret = pthread_create(&thread1, NULL, thread_loop, (void*) &i) ;
switch (ret)
{
case 0 : printf("pthread_create function Success \n"); break ;
case EAGAIN : printf("Error : No more processes \n"); break ;
case ENOSYS : printf("Error : Function not implemented \n"); break ;
case EINVAL : printf("Error : Invalid Argument \n"); break ;
case EPERM : printf("Error : Not super-user \n"); break ;
default : printf("Other error from pthread_create \n"); break ;
}
printf("End Of Main %d \n ", ret);
thread_loop(&i);
}