assume we have an application which uses winsock to implement tcp communication. for each socket we create a thread and block-receiving on it. when data arrives, we would like to notify other threads (listening threads).

i was wondering what is the best way to implement this:

move away from this design and use a non-blocking socket, then the listening thread will have to iterate constantly and call a non-blocking receive, thus making it thread safe (no extra threads for the sockets)

use asynchronous procedure calls to notify listening threads - which again will have to alert-wait for apc to queue for them.

implement some thread safe message queue, where each socket thread will post messages to it, and the listener, again, will go over it every interval and pull data from it.

also, i read about WSAAsyncSelect, but i saw that this is used to send messages to a window. isnt there something similar for other threads? (well i guess apcs are...)