Events An event object is a synchronization object that is under the direct control of the application. Instead of changing state as a result of calling one of the wait functions (such as WaitForSingleObject), the application can use three different functions to control the state of the object. The SetEvent function sets the state of the event object to signaled, the ResetEvent function sets the state of the event object to non-signaled, and the PulseEvent function quickly sets the state of the event object to signaled and then non-signaled. When the event object is created, the application can determine if it will be a manual or automatic reset event. Manual reset events remain signaled until explicitly reset to nonsignaled by a call to the ResetEvent function. Auto reset events remain signaled until a single waiting thread is resumed, at which point the system automatically sets the state back to non-signaled. A deadlock can occur when a thread is suspended in a permanent wait state as a result of a lost event object. If PulseEvent or SetEvent is used with an auto reset event and no threads are waiting, the event object is lost and a deadlock will occur. Events are especially useful in the situation where a thread must wait for another thread to complete its execution. The executing thread can simply set the event’s state to signaled at the end of its execution, at which point the waiting thread will resume, guaranteed that the thread upon which it was waiting has successfully completed. CreateEvent Creates an event object. OpenEvent Opens a handle to an existing event object. PulseEvent Rapidly sets the state of an event object to signaled and unsignaled. ResetEvent Resets an event object to an unsignaled state. SetEvent Sets the state of an event object to signaled.
An event object is a synchronization object that is under the direct control of the application.
Instead of changing state as a result of calling one of the wait functions (such as
WaitForSingleObject), the application can use three different functions to control the state
of the object. The SetEvent function sets the state of the event object to signaled, the
ResetEvent function sets the state of the event object to non-signaled, and the PulseEvent
function quickly sets the state of the event object to signaled and then non-signaled. When
the event object is created, the application can determine if it will be a manual or automatic
reset event. Manual reset events remain signaled until explicitly reset to nonsignaled
by a call to the ResetEvent function. Auto reset events remain signaled until a
single waiting thread is resumed, at which point the system automatically sets the state
back to non-signaled. A deadlock can occur when a thread is suspended in a permanent
wait state as a result of a lost event object. If PulseEvent or SetEvent is used with an auto
reset event and no threads are waiting, the event object is lost and a deadlock will occur.
Events are especially useful in the situation where a thread must wait for another thread to
complete its execution. The executing thread can simply set the event’s state to signaled at
the end of its execution, at which point the waiting thread will resume, guaranteed that the
thread upon which it was waiting has successfully completed.
CreateEvent Creates an event object.
OpenEvent Opens a handle to an existing event object.
PulseEvent Rapidly sets the state of an event object to signaled
and unsignaled.
ResetEvent Resets an event object to an unsignaled state.
SetEvent Sets the state of an event object to signaled.
http://www.hktk.com/soft/program/book/delphi/delphi_83.html另外,其实到Google或 baidu搜索一下就有的