Waiting on multiple events C++

前端 未结 4 555
后悔当初
后悔当初 2021-02-10 05:37

Is there a recommended way to wait on multiple inputs. For example I would like my program to be able to receive input from 3 sources:

Listen on a thread condition e.g.

4条回答
  •  情话喂你
    2021-02-10 06:13

    On modern Linux the best way to do this is not to use pthread_cond_wait at all. Just use eventfd instead, which will enable you to listen for multiple events using select/poll/epoll.

提交回复
热议问题