Is write() safe to be called from multiple threads simultaneously?
问题 Assuming I have opened dev/poll as mDevPoll , is it safe for me to call code like this struct pollfd tmp_pfd; tmp_pfd.fd = fd; tmp_pfd.events = POLLIN; // Write pollfd to /dev/poll write(mDevPoll, &tmp_pfd, sizeof(struct pollfd)); ...simultaneously from multiple threads, or do I need to add my own synchronisation primitive around mDevPoll ? 回答1: Solaris 10 claims to be POSIX compliant. The write() function is not among the handful of system interfaces that POSIX permits to be non-thread-safe,