1sleep(3UCB) SunOS/BSD Compatibility Library Functions sleep(3UCB)
2
3
4
6 sleep - suspend execution for interval
7
9 /usr/ucb/cc [ flag ... ] file ...
10
11 int sleep(seconds)
12 unsigned seconds;
13
14
16 sleep() suspends the current process from execution for the number of
17 seconds specified by the argument. The actual suspension time may be
18 up to 1 second less than that requested, because scheduled wakeups
19 occur at fixed 1-second intervals, and may be an arbitrary amount
20 longer because of other activity in the system.
21
22
23 sleep() is implemented by setting an interval timer and pausing until
24 it expires. The previous state of this timer is saved and restored.
25 If the sleep time exceeds the time to the expiration of the previous
26 value of the timer, the process sleeps only until the timer would have
27 expired, and the signal which occurs with the expiration of the timer
28 is sent one second later.
29
31 See attributes(5) for descriptions of the following attributes:
32
33
34
35
36 ┌─────────────────────────────┬─────────────────────────────┐
37 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
38 ├─────────────────────────────┼─────────────────────────────┤
39 │MT-Level │Async-Signal-Safe │
40 └─────────────────────────────┴─────────────────────────────┘
41
43 alarm(2), getitimer(2), longjmp(3C), siglongjmp(3C), sleep(3C),
44 usleep(3C), attributes(5)
45
47 Use of these interfaces should be restricted to only applications writ‐
48 ten on BSD platforms. Use of these interfaces with any of the system
49 libraries or in multi-thread applications is unsupported.
50
51
52 SIGALRM should not be blocked or ignored during a call to sleep(). Only
53 a prior call to alarm(2) should generate SIGALRM for the calling
54 process during a call to sleep(). A signal-catching function should not
55 interrupt a call to sleep() to call siglongjmp(3C) or longjmp(3C) to
56 restore an environment saved prior to the sleep() call.
57
59 sleep() is slightly incompatible with alarm(2). Programs that do not
60 execute for at least one second of clock time between successive calls
61 to sleep() indefinitely delay the alarm signal. Use sleep(3C). Each
62 sleep(3C) call postpones the alarm signal that would have been sent
63 during the requested sleep period to occur one second later.
64
65
66
67SunOS 5.11 30 Oct 2007 sleep(3UCB)