I have a thread that blocks on select(), waiting for something to happen on one of many sockets that are connected to it.
Meanwhile, in another thread, I need to make a new socket connection, and add that socket to the list that select is monitoring (the fd_set).
The problem is that select() is blocked until something happens on one of its existing set of sockets. I'd like to do something to trigger it to return (i.e.unblock), so it can start again with a modified fd_set that includes the new socket.
What I *could* do is create a new socket connection to itself, then immdiately disconnect. Alternatively I could leave a socket connected, and send a couple bytes across it every time I want select to return.
I don't like these for two reasons...one, they are messy and ugly, and two, I otherwise don't need a listener socket and would prefer not have one. I want to have this program be a client in the sense that it will initiate all connections, and having it listen on a port simply so it can "talk to itself" to wake up select() seems to be a really bad ugly brute-force way to do things.
Any ideas as to a better way?