I got confused in the queue (POSIX). Do I need to protect multiple writers in the queue or multiple readers from the queue?
multiple threads will be written to the queue, and several threads will be read from the queue.
As the definition says: "There can be many readers and many writers in a message queue." But he does not say whether he needs protection or not. should these two messages be protected by the mutex?
mq_send (mqd_t mqdes, const char * msg_ptr, size_t msg_len, unsigned msg_prio); mq_receive (mqd_t mqdes, char * msg_ptr, size_t msg_len, unsigned * msg_prio);
Please help me? Thanks in advance.
source share