I am making a threaded server using pthreads.
Whenever server accepts a new connection, a new thread is created to handle client's requests.
Now i am thinking that as server's listening queue max length is defined at compilation time, i could use a static array of the same size to store thread's ids..
My problem is how to find out that a thread has returned, so I can pass it's id to a new thread. Is there a function or something to check threads state? Or maybe I should check the return value of each pthread_create()?
May someone help me please?
PS: I 've thought of pthread_join but I rejected the idea because that would make the parent thread to block, while i want it to always run to accept new connections.