当计数值成为零时,信号对象的状态成为non - signaled。
When the count reaches zero, the state of the semaphore object becomes non-signaled.
Linux使用pthread_condition_init调用在当前进程内创建信号对象,在其中维持一个在零与最大值之间的计数值。
Linux USES the pthread_condition_init call to create a semaphore object within the current process that maintains a count between zero and a maximum value.
当科学家们让实验对象玩一个通过欺骗搭档来赢钱的游戏时,他们注意到来自杏仁核的负面信号开始减少。
When scientists had their subjects play a game in which they won money by deceiving their partner, they noticed the negative signals from the amygdala began to decrease.
信号是一种有效和灵活的“粘合剂”,它们把程序中的对象“粘合”在一起。
Signals are the efficient and flexible glue that tie the objects in your program together.
当对象被设置发出信号或者超时时间段结束时,这个方法会得到通知。
The method is signaled when the object is set to signal or the time out interval is finished.
对事件对象调用的等待函数会阻塞调用线程,直到其状态被设置为有信号状态为止。
The wait function on the event object blocks the calling thread until its state is set to signaled state.
这个函数会使用一个互斥对象的句柄,并一直等待,直到它变为有信号状态或超时为止。
This function takes the handle to the mutex object and waits until it is signaled or timeout occurs.
信号除了将对象相互连接之外,与事件非常相似。
Signals are a lot like events, except that they connect objects to one another.
然后主循环查询自己的信号和处理程序之间的内部映射表,也叫做回调,并调用注册到指定对象的指定信号的处理程序。
The main loop then looks through its internal mapping table between its signals and handlers, also called callbacks, and calls the handlers registered for the given signal on the given object.
使用信号/插槽以灵活且可维护的方式控制对象间通信要比使用脆弱的回调风格容易得多。
With signals/slots, it is much easier to control communications between objects in a flexible and maintainable manner than it is with a fragile callback style.
当事件发生时,与这个事件对应的对象发出信号,通知主循环事件已经发生。
When an event occurs, the object associated with that event emits a signal to inform the main loop that it has occurred.
当在一个等待函数中使用同步对象时,等待函数就会阻塞调用线程,直到同步对象的状态被设置为有信号为止。
When the synchronization object is used in one of the wait functions, the wait function blocks the calling thread until the state of the synchronized object is set to signaled.
这个函数使用一个信号量对象的句柄作为参数,并会一直等待下去,直到其状态变为有信号状态或超时为止。
This function takes the handle to the semaphore object and waits until it is signaled or a timeout occurs.
但愿你的对象能够解读这些信号,但最烂俗的情节就是他们说很庆幸最终找到了你,但你却在想“您还是继续找吧!”
Hopefully, your date will be able to read your signals, but in the worst case scenario where they are saying they are so happy to have found you at last and you are thinking, "check please!"
这个方法允许您设置互斥信号量对象的相关属性。
然后创建一个最小限度的 D-BUS对象,这个对象每秒广播一个信号。
Then a minimal D-BUS object is created and every second a signal is broadcast from the object.
男性会展现更多动物信号,或摆出拥有者的姿态,给潜在对象留下深刻印象。
A man may exhibit more animalistic signals or ownership gestures, to impress a potential mate.
然后,当第一个对象“发出”信号(由于状态的内部变化)时,第二个对象“捕获”该变化并作出适当的反应。
Then, when the first object "emits" the signal (due to an internal change in state), the second object "catches" this change and reacts appopriately.
类似地,如果需要访问发出信号的对象,就要使用第一个参数,在这个具体回调中是button。
Similarly, if you need to access the object that emitted the signal, you use the first parameter, which is button in this specific callback.
相反,服务器可以通过调用Work对象的release方法,给资源适配器发信号。
Instead, the server can signal to the resource adapter by calling the release method on the Work object.
在自动重置事件(auto reset event)中,对象的状态会一直维持为有信号状态,直到单个正在等待的线程被释放为止。
In the auto reset event, the state of the object remains signaled until a single waiting thread is released.
但是我们该如何将这同一个信号连接到某个特定对象的方法呢?
But how would we connect this same signal to the method of a particular object? Easy — simply use the following template.
函数SetEvent()用来将事件对象的状态设置为有信号状态。
The function SetEvent() is used to set the state of the event object to signaled state.
在手工重置事件(manual reset event)中,对象的状态会一直维持为有信号状态,直到使用ResetEvent函数显式地重新设置它为止。
In the manual reset event, the state of the object remains signaled until explicitly reset using the ResetEvent function.
本文是这一系列的第 2部分,这篇文章从信号量和事件入手,介绍了有关同步对象和原语的内容。
This second part of the series has introduced synchronization objects and primitives, starting with semaphores and events.
在上面的代码段中,我们将主窗口对象的“destroy ”信号连接到gtk_main _ quit函数。
In the above code snippet, we connect the "destroy" signal of our main window object to the gtk_main_quit function.
类似地,第二行把cb _ button_click函数连接到button对象的clicked信号。
Similarly, the second line connects the cb_button_click function to the clicked signal on the button object.
第一行把cb_delete函数连接到window对象的delete - event信号。
The first line connects the cb_delete function to the delete-event signal on the window object.
该研究带头人MirjamTuk博士说,大脑的“控制信号”没有给特定的对象下达任务,但是会“无意识的增加”对其他任务的控制。
Dr Mirjam Tuk, who led the study, said that the brain's "control signals" were not task specific but result in an "unintentional increase" in control over other tasks.
对一个已经设置为有信号状态的事件对象再次执行该函数是无效的。
应用推荐