I am implementing a file server and it receives requests from multiple clients. Each client sends multiple requests. At the server end, the main thread spawns a new worker thread to handle requests each time a new client connects. One worker thread handles all requests from the client it was created for. So, after the thread handles a requests, it waits to be woken up by the main thread when another request from the same client arrives.
I am not sure how to implement the last line.that is how do i put a thread to sleep and wake it again.
thanks
I solved the issue by threads created at the beginning of a client connect and thereafter the thread receives and sends messages directly to client rather then the main thread receiving and sending messages after the worker threads does the task.