Thread: Using a timeout on a thread

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    96

    Using a timeout on a thread

    How would I implement a timeout on a thread to prevent a socket from not providing any input

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I do not get how timeout could prevent from "not providing" something...

    Could you elaborate what are you trying to do?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    96
    I am running a server which has a thread pool that will take in a client's request on a given socket and then process this request on the socket while the server waits for more connections. But to ensure that a client doesn't connect to one of my threads and doesn't provide the thread with any input so that the just sits there useless I would like to use a timeout to close the socket after a certain period of time if there was no data processing.

  4. #4

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 02-26-2009, 11:48 PM
  2. Terminating secondary thread from another thread
    By wssoh85 in forum C++ Programming
    Replies: 13
    Last Post: 12-19-2008, 05:14 AM
  3. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  4. Critical Sections, destroying
    By Hunter2 in forum Windows Programming
    Replies: 4
    Last Post: 09-02-2003, 10:36 PM
  5. Replies: 12
    Last Post: 05-17-2003, 05:58 AM