0
votes

i am programming a Mulithreaded Client/Server between processes program which uses message queue's. The Server will handle the message's send by the clients, and later it should give the work to a threads to continue handling their it's processes. Every client will have a different message queue.

After making the connection of the 1st client and sending a thread to handle it Using pthread_join doesnt allow me to to receive new connections that are on main thread,cause it's blocked how can i fix it.

  • Receiving New Messages in the main thread ( or other solution if possible)
  • Sending to threads to handle a client message's and after.
  • Getting back to receive new message
1
Why are you calling pthread_join? - David Schwartz

1 Answers

1
votes

Very simple,

Make the threads you create detached from the main thread - means you don't need to "pthread_join" them anymore. So the main thread is getting new connections and new request for existing connections in a loop, if it's a new connection it will start new thread and if it's a request to an existing connection it's just add the request to the thread's queue (using a lock on it's mutex ofcourse).