CEvent:-
When a synchronization object that allow one thread to notify another that event has occurred now another thread can perform task.one thread is reading a doc and another is writing the thread .that time first writing thread write the file and when its task has done then its single to other thread now reading thread can read the thread.
CEvent object is two types :-
1. Manul :-Manual CEvent object stays in the state set by SetEvent or ResetEvent untill the other function is called
2. Automatic:- in an automatic CEvent object automatically returns to a nonsignaled state after at least one thread is released.
CreateEvent function's argument decide it is a maual or auto event and it declare the event a name or unnamed event object,SetEvent function is used to put thread in signal state and ResetEvent function is used to put thread in non signal state.OpenEvent function is used to open a already created event by createEvent () function.
When a synchronization object that allow one thread to notify another that event has occurred now another thread can perform task.one thread is reading a doc and another is writing the thread .that time first writing thread write the file and when its task has done then its single to other thread now reading thread can read the thread.
CEvent object is two types :-
1. Manul :-Manual CEvent object stays in the state set by SetEvent or ResetEvent untill the other function is called
2. Automatic:- in an automatic CEvent object automatically returns to a nonsignaled state after at least one thread is released.
CreateEvent function's argument decide it is a maual or auto event and it declare the event a name or unnamed event object,SetEvent function is used to put thread in signal state and ResetEvent function is used to put thread in non signal state.OpenEvent function is used to open a already created event by createEvent () function.
HANDLE WINAPI CreateEvent( __in_opt LPSECURITY_ATTRIBUTES lpEventAttributes,//default is NULL __in BOOL bManualReset,//TRUE for Manual reset and FALSE parameter for AUTO __in BOOL bInitialState,//FALSE for nonsignal state and TRUE for Nonsignal State __in_opt LPCTSTR lpName// assign a event name default is NULL for unnamed event );
it return a HANDLE which we pass in setEvent and ResetEvent method as a argument.
Semaphore Synchronization Object:-
this is Synchronize object that allows the resource for count zero and a maximum number of threads.if threads enter in semaphore its increament and when if thread completed his task itdecrement with one.and when count reach at zero semaphore in non signal state and otherwiseits in signal state.HANDLE WINAPI CreateSemaphore( __in_opt LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, __in LONG lInitialCount, __in LONG lMaximumCount, __in_opt LPCTSTR lpName );
Comments
Post a Comment