I want to wait on both a file descriptor and a mutex, what's the recommended way to do this?

后端 未结 8 1268
-上瘾入骨i
-上瘾入骨i 2020-12-31 03:36

I would like to spawn off threads to perform certain tasks, and use a thread-safe queue to communicate with them. I would also like to be doing IO to a variety of file descr

8条回答
  •  不思量自难忘°
    2020-12-31 03:45

    C++11 has std::mutex and std::condition_variable. The two can be used to have one thread signal another when a certain condition is met. It sounds to me like you will need to build your solution out of these primitives. If you environment does not yet support these C++11 library features, you can find very similar ones at boost. Sorry, can't say much about python.

提交回复
热议问题