Thread: Thread Pool server

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    351

    Thread Pool server

    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

  2. #2
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    To answer the question myself:

    http://www.google.co.uk/search?hl=en...t+server&meta=

    Particularly helpful was "Concurrent Servers Dec 3, 2002 Concurrent Servers Dec 3, 2002 15 ...".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Terminating secondary thread from another thread
    By wssoh85 in forum C++ Programming
    Replies: 13
    Last Post: 12-19-2008, 05:14 AM
  2. Thread Prog in C language (seg fault)
    By kumars in forum C Programming
    Replies: 22
    Last Post: 10-09-2008, 01:17 PM
  3. Thread Pool libraries or examples
    By Mastadex in forum Windows Programming
    Replies: 6
    Last Post: 08-24-2008, 08:58 PM
  4. Commerical MMORPG Developer Opp
    By Th3Guy in forum Projects and Job Recruitment
    Replies: 19
    Last Post: 01-22-2007, 11:28 AM
  5. SMTP Server Not Working
    By (TNT) in forum Networking/Device Communication
    Replies: 1
    Last Post: 07-15-2003, 05:33 AM