Find the answer to your Linux question:
Results 1 to 4 of 4
I need ask a process to wait for a while / sleep for a while, then wake up. Is there any available sleep/wait function in the kernel? Or, how to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2004
    Posts
    43

    How to SLeep/Wait?


    I need ask a process to wait for a while / sleep for a while, then wake up.
    Is there any available sleep/wait function in the kernel? Or, how to implement such
    function?

    Thanks a lot!

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Well is this program going to be running in user space or in kernel space? What language is the program written in?

  3. #3
    Just Joined!
    Join Date
    Nov 2004
    Posts
    43
    Quote Originally Posted by lakerdonald
    Well is this kernel going to be running in user space or in kernel space? What language is the program written in?
    Thanks for your reply! It is running in the kernel space and the program is written in C.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    add
    Code:
    #include <unistd.h>
    to the code. then the function is:
    Code:
    unsigned int seconds=3; //substitute 3 for however many seconds you'd like to sleep for
    sleep&#40;seconds&#41;;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •