I am compiling this program with gcc from cygwin package on my windows machine
#include<stdio.h>
#include<pthread.h>
void* thread_function(void)
{
printf("hello");
}
int main(int argc,char *argv[])
{
pthread_t thread_id[argc-1];
int i;
int status;
printf("argc is %d ",argc-1);
for(i=0;i<argc-1;i++)
{
pthread_create (&thread_id[i], NULL , &thread_function, NULL);
}
for(i=0;i<argc-1;i++)
pthread_join(thread_id[i],NULL);
}
It compiles and creates a.exe
When I run it in cmd
./a.exe 2 3
The output is
argc is 2 hellohello
Question :
pthread.h and this thread function are related to linux os then why does it work with windows?