The parameter writefds identifies the sockets that are to be checked for writability. If a socket is processing a connect call (nonblocking), a socket is writeable if the connection establishment successfully completes. If the socket is not processing a connect call, writability means a send, sendto, or WSASendto are guaranteed to succeed. However, they can block on a blocking socket if the len parameter exceeds the amount of outgoing system buffer space available. It is not specified how long these guarantees can be assumed to be valid, particularly in a multithreaded environment.上文来自MSDN,我们可以知道select在多线程下可以是安全的。
我的意思是如果FD_SET是几个线程共用的,应该是不安全的,如果FD_SET是每个线程各自的(虽然FD_SET成相同的socket句柄),应该是安全的