Wait for multiple events (more precision needed)

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
In need of some credit
In need of some credit
Posts: 1
Joined: Sun Jan 30, 2005 10:03 am
Location: France

Wait for multiple events (more precision needed)

Post by SGallou » Sun Jan 30, 2005 10:13 am


Someone a ask for how to wait for multiple events in April 2001 (see this message), and the answer was to use several wxCondition and ANDing them.

But how to ANDing several wxCondition ? Can everyone post a sample of code doing that ? The idea is to act as the WaitForMultipleObjects method of WIN32.

Thanks at all !

Sebastien Gallou

Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands

Post by Jorg » Sun Jan 30, 2005 2:18 pm

I assume when you get the signal from your condition, you set a flag somewhere. All these flags you AND to see if multiple contiditons have been occured.

Code: Select all

bool m_flag1;
bool m_flag2;

if (m_flag1 && m_flag2)
  // both occured
  m_flag1 = m_flag2 = false;
  // do our stuff
Forensic Software Engineer
Netherlands Forensic Insitute
Jorg's WasteBucket

Post Reply