Hi All,
Got a question about blocking with accept when using a thread pool.
The design is as follows:
1) Spark THREAD_NUM threads using pthread_creat
2) Start TCP server
3) Within infinite loop listen on accept(3)
4) When a client connects add work to a FIFO queue and return to accept(3)
On thread:
1) Infinite loop sleeping for 1 sec.
2) Try and pop from the FIFO.
My problem is, I'm not sure how to pass the connection handle from accept non-blocking to the thread and return back to accept another client while threads are processing other clients.
Also, what's the best way to do a FIFO in this circumstance?
Thanks for any help,
rotis23