如果没有线程等待并发送条件信号,会发生什么? [英] What happens if no threads are waiting and condition signal was sent?

查看:123
本文介绍了如果没有线程等待并发送条件信号,会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果所有线程都忙,并且主线程发送线程cond信号,会发生什么?

What happens if all threads are busy and main thread has sent thread cond signal ?

1主线程和3线程池中的线程。 3个pthreads的状态为

1 Main Thread and 3 pthreads in thread pool. 3 pthreads are in status of

    pthread_mutex_lock(&sync_mutex);
    pthread_cond_wait(&sync_cond, &sync_mutex);
    pthread_mutex_unlock(&sync_mutex);

主线程已发送信号唤醒线程来处理工作。在这种情况下,如果3个线程已经忙,下一个信号已经到达,会怎么样?

Main thread has sent Signal to wake up the threads to process the work. In this situation, What if 3 threads are already busy and next signal has arrived?

推荐答案

信号消失。

这篇关于如果没有线程等待并发送条件信号,会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆