Can SetEvent be used to send multiple events at the same time...?

  • Thread starter Thread starter Harsha_MR
  • Start date Start date
H

Harsha_MR

Guest
I have Three processes. Process A Creates two different events.
Process B & C each uses WaitForSingleObject and wake up on specific event from Process A.

For Ex: Process A create events, "Start_process_B" & "Start_process_C"
and Process B wakes up with the event "Start_process_B" from Process A
and Process C wakes up with the event "Start_process_C" from Process A


---Process A
static HANDLE aEvent[10];
aEvent[0] = CreateEvent(NULL, TRUE, FALSE, TEXT("Start_process_B"));
aEvent[1] = CreateEvent(NULL, TRUE, FALSE, TEXT("Start_process_B"));

while(1)
{
SetEvent(aEvent); //Any solutions for sending multiple events at the same time..?
...
}

---Process B
static HANDLE bEvent;
bEvent = OpenEvent(SYNCHRONIZE, FALSE, TEXT("Start_process_B"));

while(1)
{
WaitForSingleObject(bEvent, INFINITE);
...
}

---Process C
static HANDLE cEvent;
cEvent = OpenEvent(SYNCHRONIZE, FALSE, TEXT("Start_process_C"));

while(1)
{
WaitForSingleObject(cEvent, INFINITE);
...
}

Continue reading...
 
Back
Top