why is there no poll/select like mechanism for message queue?

前端 未结 5 1979
感情败类
感情败类 2021-01-14 01:19

Like we can do, poll/epoll/select on an fd, we can not on msg queue id. I found some non standard methods to make msgqueue-id to fd, but afterall its a non standard. So my q

5条回答
  •  长发绾君心
    2021-01-14 02:13

    From the mq_overview man page:

    Polling message queue descriptors

    On Linux, a message queue descriptor is actually a file descriptor, and can be monitored using select(2), poll(2), or epoll(7). This is not portable.

    So you can use poll and friends on message queues - just make sure you use the modern variant.

提交回复
热议问题