Thread: Thread sleep

  1. #1
    Registered User quagsire's Avatar
    Join Date
    Jun 2002

    Thread sleep

    How do you make a specific thread sleep without sleeping the process.

    If I use sleep, it sleeps the whole process, not just the specific thread I want.

  2. #2
    Registered User quagsire's Avatar
    Join Date
    Jun 2002
    I used the following :
    struct timespec timeout = {10, 0 };
    pthread_delay_np( &timeout );
    Unfortunately it is not portable, but I will always use it on the same platform (IBM AIX)

  3. #3
    Registered User
    Join Date
    Aug 2002
    Hermosa Beach, CA
    I have seen nanosleep used to emulate pthread_delay_np on linux. Threads are processes on linux anyway, so what are you worried about?
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-01-2007, 07:11 AM
  2. Messaging Between Threads, Exiting Thread On Demand, Etc.
    By HyperShadow in forum C++ Programming
    Replies: 10
    Last Post: 06-09-2007, 01:04 PM
  3. Thread confusion
    By pyrolink in forum C Programming
    Replies: 0
    Last Post: 01-29-2006, 09:42 PM
  4. multithreading question
    By ichijoji in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2005, 10:59 PM
  5. Replies: 12
    Last Post: 05-17-2003, 05:58 AM