Are BSD/Posix sockets reentrant?
问题 Can several threads operate on the same socket descriptor, i.e accept(sock_fd) at the same time without concern? The platform I'm mostly interested in is POSIX/Linux. 回答1: Yes, they are "reentrant" - kernel locks the socket structure while working on it (see Linux accept source for example), so only one thread would get the client connection. 来源: https://stackoverflow.com/questions/2133224/are-bsd-posix-sockets-reentrant