然而,要唤醒等待队列中所有睡眠的进程有时并不方便。
However, it is not always convenient to wake up all sleeping processes in a wait queue.
发信号:在Win32 中,发出信号会唤醒等待那个信号的所有线程。
Signaling: In Win32, signaling a semaphore wakes up all the threads that are waiting on the semaphore.
例如,如果两个或多个进程正在等待互斥访问某一要释放的资源,仅唤醒等待队列中一个进程才有意义。
For instance, if two or more processes are waiting for exclusive access to some resource to be released, it makes sense to wake up just one process in the wait queue.
这是一种好做法,因为这会减少唤醒之后读线程的等待时间。
This is good practice, because the waiting time of the reader thread is reduced after wake-up.
比如,一个正在等待货物被加入到链表中的线程,当它被唤醒时可能发现链表是空的。
For instance, a thread waiting until items are added to a linked list may wake up to find the list empty.
当它所等待的事件发生时,进程将被显式的唤醒呼叫唤醒。
When the event occurs that it is waiting for, the process is awaken by the explicit wake-up call.
一旦条件满足,还需要一种方法以唤醒因等待满足特定条件而睡眠的线程。
Once the condition is met you need a method to wake up the thread (s) that are waiting for that particular condition to become true.
如果信号的值从零开始增加,而且pthread_cond中有任何线程被阻塞,那么请等待这个信号,因为其中一个会被唤醒。
If the semaphore value is incremented from zero and there is any threads blocked in the pthread_cond, wait for the semaphore because one of them is awakened.
一个典型的MacOSX应用程序的大部分时间在用在kevent系统调用上,等待从内核来的事件来唤醒它。
A typical Mac OS X application spends most of its time in the kevent system call, waiting for an event from the kernel to wake it up.
如果另一个线程对一个条件变量调用pthread_cond_signal,那么那个等待这个条件而被阻塞的线程就会被唤醒。
If another thread calls pthread_cond_signal on a condition, then a thread that was waiting on that condition variable is woken up.
如果另一个线程对这个条件变量调用pthread_cond_broadcast,那么所有等待这个条件而被阻塞的线程都会被唤醒。
If another thread calls pthread_cond_broadcast on a condition, then all threads waiting on that variable are woken up.
这个命令将立即删除信号量集及其数据结构,并唤醒所有正在等待的进程(如果发生错误,则返回,并将errno设置为EIDRM)。
This command immediately removes the semaphore set and its data structures, awakening all waiting processes (with an error return and errno set to EIDRM).
接着,它开始等待,直到建立了一个新的连接,或者另一个线程将它唤醒,或者另一个线程将原来的阻塞线程中断。
It then waits until a new connection is made, another thread wakes it up, or another thread interrupts the original blocked thread.
75年前,这个国家依然充满了希望,工厂、矿场和磨坊都等待着工人们施展魔力,将工业从沉睡中唤醒。
The nation was still a setting for optimism 75 years ago, the factories and mines and mills awaiting the workers whose magic touch would awaken industries from their slumber.
这么做会唤醒所有等待条件变量_ cond的读线程;读线程现在隐式地争夺互斥锁。
Doing so awakens all the reader threads that were waiting on the condition variable _cond; the reader threads now implicitly compete for the mutex lock as and when it is released.
在每个人孤独的内心深处,都有一个光明和温暖的壁炉。在那里,一种精神正等待被唤醒。
Within everyone's inner solitude, there is that bright and warm hearth where the spirit dwells waiting to be roused.
在每一个人孤独的内心深处,都有一个光明和温暖的壁炉。在那里,一种精神正等待被唤醒。
Within everyone's inner solitude , there is that bright and warm fireplace where the spirit dwells waiting to be roused .
从此唤醒自己早已经失去的单纯的邮寄的等待之后的心情。
Since then wake up his early already lose simple mail after waiting for the mood.
世界上有两种人:赢家跟输家,存在于你们每个人心中,深深藏在你的内心深处中,有个等待被唤醒的胜利者。
There are two kinds of people in this world: winners and losers. Inside each and every one of you, at the very core of your being, is the winner waiting to be awakened and unleashed upon the world.
他们把她放在柔软的草地上,等待和风唤醒她。
They put her on the soft grass and waited for the gentle wind to waken her.
你们所有……每个人的最真本质,是一个等待被唤醒去释放力量的赢家。
Inside each and everyone of you, in the very core of your being is a winner waiting to be awakened and released upon the world.
如果所有线程都在此对象上等待,则会选择唤醒其中一个线程。
If any threads are waiting on this object, one of them is chosen to be awakened.
以前,我在降霜的清晨看到过路上一些蛇,它们的身子还有一部分麻木不灵活,还在等待太阳出来唤醒它们。
I had previously seen the snakes in frosty mornings in my path with portions of their bodies still numb and inflexible, waiting for the sun to thaw them.
我沉睡着等待着身体的治愈,可是当智能机器将我唤醒的时候,却对我说我不再需要这具身体了,它们已经保存了我的意识。
I went to sleep expecting to be cured. Instead, the ai woke me and said I no longer needed my body. It downloaded my mind, and now I see.
实现父子进程的同步,当父进程试图从一空管道中读取数据时,便进入等待状态,直到子进程将数据写入管道返回后,才将其唤醒。
Son process to achieve the synchronization, when the parent tried to read an empty pipe, they enter the wait state until the child process to write data pipeline to return only after its wake.
每个等待集合上都持有在当前对象上等待但尚未被唤醒或是释放的阻塞线程。
Each set holds threads blocked by wait on the object until corresponding notifications are invoked or the waits are otherwise released.
线程的责任是释放资源去唤醒在队列中的第一个等待队列,并修改队列标题,然后将线程放到等待队列。
It is the responsibility of the thread releasing the resource to awake the first thread on the queue, change the head of the queue, and put the thread on the ready queue.
线程的责任是释放资源去唤醒在队列中的第一个等待队列,并修改队列标题,然后将线程放到等待队列。
It is the responsibility of the thread releasing the resource to awake the first thread on the queue, change the head of the queue, and put the thread on the ready queue.
应用推荐