Communicating with threads
I'm not very experienced with thread programming. I have studied the concepts of thread programming at university so i understand how they work and the importance of setting up mutex's etc but never actually used them in real practice so i have a very general question about how two threads should communicate.
The application im writing is a chat program using winsock. The main thread is being used for window gui programming, like displaying windows and handling the windows message queue. Whilst the other thread is the server thread which listens for incoming connections and talks to different clients on different sockets. This thread is mainly the select function and reposinsible the sending and receiving of data.
Now what i want to know is what is the standard way of communication between the two threads? So if the user wants to chat to another user they double click their name in the window which opens up a new window for them to start chatting. The windows thread registers the user double clicking on someone elses name and then needs to inform the winsock thread of the new communication that needs to be opened. However this thread is currently blocking on the winsock select function.
Thanks for any help