Tag: 信号信号

如果变量的值发生变化,则恢复程序

在c / c++是否有一种方法可以暂停程序(可能是SIGSTOP ),然后在另一个线程更改某个变量的值时继续( SIGCONT ?)它? 例如: int main(void) { int a = 0; createThread(&a); //creates a thread which will change a’s value pauseMyself(); //pauses main process till a’s value is changed /* main process gets here only when a’s value has been changed */ fprintf(stderr, “a’s value has been changed\n”); return 0; } 我想看看是否可能,所以我不需要每个间隔采样a值 […]