1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) Markus Kuhn, 1996
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
.\"
.\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
.\" First version written
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Sun Feb 23 19:49:48 JST 1997
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified Sat Feb 27 00:10:56 JST 1999
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\"
.\"WORD: puase
.\"WORD: sleep
.\"WORD: signal ʥ
.\"WORD: NULL NULL
.\"WORD: block ػ(block)
.\"WORD: kernel ͥ
.\"WORD: real-time ꥢ롦
.\"WORD: schedule 塼
.\"WORD: busy wait ӥ
.\"
.TH NANOSLEEP 2 "1996-04-10" "Linux 1.3.85" "Linux Programmer's Manual"
.SH ̾
nanosleep \- ꤵ줿֤δ֡¹Ԥ(pause)
.SH
.B #include <time.h>
.sp
\fBint nanosleep(const struct timespec *\fIreq\fB, struct timespec *\fIrem\fB);
.fi
.SH
.B nanosleep
ϾʤȤ
.IR *req
ǻꤵ줿֤δ֡ץμ¹Ԥߤ롣
⤷ץ˥ʥ(signal)줿ˤϤû֤֤롣
ξ \-1 ֤졢\fIerrno\fR
.BR EINTR
ꤵ졢
.IR rem
NULL ǤʤлĤλ֤
.IR rem
ؤƤ빽¤Τ˳Ǽ롣
.I *rem
ͤϻꤵ줿(pause)λ뤿
.B nanosleep
ƤӸƤӽФΤ˻ѤǤ롣
.I timespec
¤Τϥʥùߤλֳִ֤ꤹΤ˻Ѥ롣
.I <time.h>
ƤꡢʲΤ褦ʷǤ:
.sp
.RS
.nf
.ne 12
.ta 8n 16n 32n
struct timespec
{
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
.ta
.fi
.RE
.PP
ʥäΥեɤͤ 0 999 999 999 ϰϤˤʤФʤʤ
.BR sleep (3)
.BR usleep (3)
٤
.B nanosleep
ˤϤĤ롣㤨
ʥαƶʤPOSIX ˤäɸಽ줿ؿǤ롢
⤤ʬǽ롢ʥˤäǤ줿
(sleep)³뤳ȤưפǤ롢ʤɤǤ롣
.SH 顼
顼㳰ξϡ
.B nanosleep
ƥࡦ 0 ؤ -1 ֤
.I errno
˰ʲͤΤɤ줫ꤹ:
.TP
.B EINTR
(pause)ػ(block)Ƥʤʥ뤬ץ
뤳Ȥdzޤ줿
ץñ
.B nanosleep
ƤӸƤӽФߤ³뤳ȤǤ褦ˡ
Ĥ(sleep)֤ *\fIrem\fR ˳Ǽ롣
.TP
.B EINVAL
.I tv_nsec
եɤͤ 0 999\ 999\ 999 ޤǤϰϤˤʤ
.I tv_sec
Ǥ롣
.SH Х
ߤ
.B nanosleep
μǤ̤ΥͥΥޡ˴Ťꡢ
1/\fIHZ\fR\ äʬǽäƤ롣(㤨 Linux/i386 Ǥ 10\ ms
Linux/Alpha Ǥ 1\ ms)ǡ
.B nanosleep
Ͼ˾ʤȤꤵ줿֡(pause)뤬ץƤӼ¹ԤǤ
褦ˤʤޤǻꤵ줿֤ 10 ms 褱ˤ롣Ʊͳ
ʥ뤬줿֤ *\fIrem\fR ϤƤΤ礭
1/\fIHZ\fR äܿڤ夲롣
ĤΥץꥱǤϤ٤(pause)ɬפȤʤ롣
(㤨Фλ֤פʥϡɥ椹ʤ)
.B nanosleep
Ϥ⤤٤ߤǽǤ롣⤷ץ
.I SCHED_FIFO
.IR SCHED_RR
Τ褦ʥꥢ롦HˤθǤǥ塼뤵ƤʤС
2\ ms ʲߤǤޥ٤ΥӥȤȤƵǽ롣
.SH
POSIX.1b ( POSIX.4)
.SH Ϣ
.BR sleep (3),
.BR usleep (3),
.BR sched_setscheduler (2),
.BR timer_create (2)
|