jeudi 22 janvier 2015

Is it safe to block with ppoll on one thread, and read/write to the same fds on another?

I'm designing a program (C++11, targeting Linux, CentOS 7 if it matters) where one thread will call ppoll to block on multiple fds, while any reading/writing for these fds will take place on other threads. All these fds will be set to non-blocking.


Naturally, my question is, do I need to ensure that any particular fd is not being polled on while it is being used for reading/writing, or is it safe to not put in any concurrency checks for this?


The man page for select mentions multi-threading issues with closing an fd while polling on it but says nothing about reading/writing, and poll and other related functions just refer back to select. So I would assume there is no problem, but I am looking for a definitive source like a standard that says yes it is safe or no it is not.


Aucun commentaire:

Enregistrer un commentaire