I created a pthread named thread which calls the function run(). Inside run, it's supposed to ask for user input. However, when I execute the program, it simply terminates. Is there a problem using cin with threads?
Code:
main()
{ pthread_t thread;
pthread_create(&thread,NULL,run,NULL);
}
void *run(void *ptr)
{ int nRate;
cin >> nRate;
}
Comment