0

Based on this question I am going to use Poco::NamedEvent, but I need to wait for multiple events (like win32 WaitForMultipleObjects()

Is there such a thing in poco? (searching the docs doesn't yield much but perhaps I am not using the right searches)

valiano
  • 16,433
  • 7
  • 64
  • 79
Tim
  • 20,184
  • 24
  • 117
  • 214

2 Answers2

1

I don't think you'll find WaitForMultipleObjects() in any cross-platform package, including Poco. No Unix variant of which I am aware packages that kind of functionality in single API call but rather spreads it out depending on the kind of object you are waiting on.

Duck
  • 26,924
  • 5
  • 64
  • 92
  • they would all be the same class of object - in this case a NamedEvent. – Tim Apr 19 '10 at 17:55
  • @Tim You have probably looked already but NamedEvent is just a wrapper around CreateEvent or a semaphore depending on the platform. Not sure what you are doing but I don't see an easy way around this without coding your own clever hack. – Duck Apr 19 '10 at 20:08
  • Yeah - I grepped the source for waitformultipleobjects. I'll just start a thread for each event and wait on it. Not sure that is the best solution but it will work... – Tim Apr 19 '10 at 20:12
0

class NotificationQueue would let you queue up objects, and process them. It is better OOP to use IOC and delegates than to have a big WaitForMultipleObjects followed by a switch statement, anyways.

Warren P
  • 65,725
  • 40
  • 181
  • 316
  • Are you saying NotificationQueue works across processes? (http://pocoproject.org/docs/Poco.NotificationQueue.html) – Tim Apr 19 '10 at 17:47
  • 4
    Despite popular belief, "better OOP" doesn't always trump "does what I need". – jalf Apr 19 '10 at 18:16
  • 1
    @jalf - I couldn't agree more. A switch statement with 5 entries that calls a method for each one (an event handler) is no different than delegates. It is also simple to read and easy to maintain. – Tim Apr 19 '10 at 18:24