# How to wait for multiple events?



## jronald (Jun 5, 2013)

```
class worker
{
public:
    bool start()
    {
        // Create a thread here (if succeeded, the thread will be in infinite loop),
        // and should wait for some events, eg. succeeded event and
        // failed event, the events should be set in the thread. So, I can determine the
        // return value of this function. How to accomplish this?
    }
}
```


----------



## PageDir (Jun 5, 2013)

select(), kqueue(), mutex+sem+std::list or something like java's BlockingQueue<E>.


----------

