In my program I want to use blocking sockets. I was hoping to do this by creating a new thread that can run the blocking accept() call and process connections, while the main thread (which spawned it) waits to be told to quit.
When the main thread is told to quit, it shuts down the thread it created so that its not accept()ing anymore, closes the socket it was listening on and then shuts the rest of the program.
A sample would look like this:
hThread = CreateThread(..);
if (PeekMessage(.., WM_QUIT, WM_QUIT, ..))
ExitThread(hThread);
Unforutunatly I know ExitThread() can only be called by the thread that owns it (or so it seems). My question then becomes, how can I close a thread I just created, from the parent thread?