【发布时间】:2019-09-27 12:43:47
【问题描述】:
在t 等待之前,一个线程t 等待条件变量cond 是否有可能被另一个线程t'(其中t' 实际上可能是t)唤醒?
我已经尝试制作一个 C 程序来执行此操作 1000 次,但它从未发生过,我还阅读了有关信号和等待的手册页,但我找不到答案。
这是一个单线程上的示例
pthread_cond_signal(&cond);
pthread_cond_wait(&cond, &mutex); //Is there a chance that this wait gets cancelled by the signal above
感谢您的帮助!
【问题讨论】:
标签: c multithreading pthreads conditional