SLEEP(3) Linux Programmer's Manual SLEEP(3)NAME
sleep - sleep for the specified number of seconds
unsigned int sleep(unsigned int seconds);
sleep() makes the calling thread sleep until seconds seconds have elapsed or a signal arrives which is not ignored.
Zero if the requested time has elapsed, or the number of seconds left to sleep, if the call was interrupted by a signal handler.
sleep() may be implemented using SIGALRM; mixing calls to alarm(2) and sleep() is a bad idea.
Using longjmp(3) from a signal handler or modifying the handling of SIGALRM while sleeping will cause undefined results.
SEE ALSO alarm(2), nanosleep(2), signal(2), signal(7)COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2010-02-03 SLEEP(3)
Check Out this Related Man Page
ALARM(2) Linux Programmer's Manual ALARM(2)NAME
alarm - set an alarm clock for delivery of a signal
unsigned int alarm(unsigned int seconds);
alarm() arranges for a SIGALRM signal to be delivered to the calling process in seconds seconds.
If seconds is zero, no new alarm() is scheduled.
In any event any previously set alarm() is canceled.
alarm() returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no pre-
viously scheduled alarm.
SVr4, POSIX.1-2001, 4.3BSD.
alarm() and setitimer(2) share the same timer; calls to one will interfere with use of the other.
sleep(3) may be implemented using SIGALRM; mixing calls to alarm() and sleep(3) is a bad idea.
Scheduling delays can, as ever, cause the execution of the process to be delayed by an arbitrary amount of time.
SEE ALSO gettimeofday(2), pause(2), select(2), setitimer(2), sigaction(2), signal(2), sleep(3), time(7)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-06-12 ALARM(2)
I have a Solaris 2.6 machine and I execute the following:
I would assume the looping would be printed every 15 seconds but it doesn't. consecutive looping gets printed without a 15 second gap. Any idea what might be the reason ?
Thanks (9 Replies)
I'm trying generate an interrupt every 1 seconds using itimer and My clock is not running. This is what i did :
printf("about to sleep for 1 second \n");
... (5 Replies)
Dear All ,
I installed new Linux Red Hat 9 system and it is working fine .
but while i keep it for certain time ideal ( i mean ndo not wrok on system itself ) it goes to mode like sleep mode ,,, but while it is in sleep mode i can not ping it or telnet !!
i discovered it while i was telnet... (8 Replies)
I am starting to learn signal handling in Linux and have been trying out some simple codes to deal with SIGALRM. The code shown below sets a timer to count down. When the timer is finished a SIGALRM is produced. The handler for the signal just increments a variable called count. This... (7 Replies)
i need to make a script to check disk space every hour.
****Note that cron is not allowed.
So i need to use either sleep or while 1 ...pls suggest which is more efficient in this scenario?
And is there any other way to do the task?
Ashish (7 Replies)
I have a following code,(linux)
i am getting output as
startstop (5 Replies)
Can someone help me with this script ....
I need a ksh script, which will search for a specific file in a directory, if file not found sleep for 10 mins and search again, if still not found sleep again for 10 mins and so on .... it should search for that file for 3 hours and if that file... (5 Replies)
This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way:
How many times have you used the... (5 Replies)
I have to use rdtsc on ubuntu for performance evaluation. But i am not getting the correct value. I am placing a sleep on 10 seconds, but value i get is some 1 sec... i dont know where im going wrong?
typedef unsigned long long ticks;
... (8 Replies)
This might be one of the dumbest questions you've got, but please bear with me:
I am a UNIX beginner. I had an test today and I was asked the following question:
Q. How do you put the terminal into sleep indefinitely?
I didn't know the answer, but after I came home, I tried the following... (9 Replies)
So I made my own unix shell, but i want to make a background process when using the & appended to the end, so far most of the commands seem to work (except cd, but thats another story)
right now here is what I have got.
Im thinking maybe I shouldn't be using switch and maybe switch it to... (27 Replies)
I am creating two posix threads. I have some queries, hopefully you will help me out with them
1) How can I put a thread to indefinite sleep, for indefinite time period. I am familiar with this
for 5 second, how can I make it indefinite??
2) How can one thread wake another... (11 Replies)
I've a small script where it checks for the existence of a particular file and sleeps for 5 seconds if it doesn't exist. I would like to send the sleep output to background so that I don't see so many sleep messages in the build output.
echo... (17 Replies)