c - Using Pthreads in a Mulithreaded Server -
i programming mulithreaded client/server between processes program uses message queue's. server handle message's send clients, , later should give work threads continue handling it's processes. every client have different message queue.
after making connection of 1st client , sending thread handle using pthread_join doesnt allow me to receive new connections on main thread,cause it's blocked how can fix it.
- receiving new messages in main thread ( or other solution if possible)
- sending threads handle client message's , after.
- getting receive new message
very simple,
make threads create detached main thread - means don't need "pthread_join" them anymore. main thread getting new connections , new request existing connections in loop, if it's new connection start new thread , if it's request existing connection it's add request thread's queue (using lock on it's mutex ofcourse).
Comments
Post a Comment