I am using p_threads in my code on unix. In my main program I have a thread Node which makes 2 threads one of which is doing a read from the standard input using getline. All of this working fine. Except at some point during my code I have to "restart my thread that reads from the standard input". And when i do that, my i am not able to read any thing from the stdin.
Any suggestions what i might be doing wrong ???/
Thanks.
This the part where i am reading from stdin
void* parseCmd(void* s)
{
sigset_t new2;
struct sigaction act;
sigemptyset(&new2);
sigaddset(&new2,SIGINT);
pthread_sigmask(SIG_UNBLOCK, &new2, NULL);
act.sa_handler = interrupt;
sigaction(SIGINT, &act, NULL);
signal(SIGUSR1, signal_Handler);
std::string input("");
while (1)
{
std::cout << "SERVANT > ";
std::getline(std::cin, input);
doTheWork(input);
cin.clear();
std::cout << std::endl;
if(global_shutdown==1 || auto_global_shutdown==1)
break;
}
cout<<"cmd thread exit.Main\n";
return 0;
}