Hi all,
I have some questions regarding the usage of POSIX threads. I would like to ask:
1) Is it possible if in a thread, I were to run a scanf function in order to change the value of a global variable?
2) Do I use scanf or std::cin? And why?
eg.
I have some questions regarding the usage of POSIX threads. I would like to ask:
1) Is it possible if in a thread, I were to run a scanf function in order to change the value of a global variable?
2) Do I use scanf or std::cin? And why?
eg.
Code:
void *detectKey(void *arg) { int y; scanf("%d",&y); while (y != 1) { if (!::stopRobo) { ::orderStop = 1; ::stopRobo = 1; std::cout << "ORDERED TO STOP!!!" << endl; break; } } pthread_exit(0); }
Comment