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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
.\" 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
.\" Modified, 2004-10-24, aeb
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated, 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated, 1999-02-27, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated, 2003-09-15, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated, 2005-02-10, Akihiro MOTOKI
.\"
.\"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 2004-10-24 "Linux 2.6.9" "Linux Programmer's Manual"
.SH ̾
nanosleep \- ꤵ줿֤δ֡¹Ԥߤ
.SH
.B #include <time.h>
.sp
\fBint nanosleep(const struct timespec *\fIreq\fB, struct timespec *\fIrem\fB);
.fi
.SH
.B nanosleep
ϡʤȤ
.I *req
ǻꤵ줿֤δ֡ץμ¹Ԥٱ䤵롣
ץ˥ʥ뤬줿ˤϡ
ꤵ줿֤ãʤƤ֤뤳Ȥ롣
ξ \-1 ֤\fIerrno\fR
.BR EINTR
ꤷ
.IR rem
NULL Ǥʤ
.IR rem
ؤƤ빽¤Τ˻Ĥλ֤Ǽ롣
.I *rem
ͤȤȡ
.B nanosleep
⤦ٸƤӽФơꤷ֤ߤ
λ뤳ȤǤ롣
ʥùߤλֳִ֤ꤹΤ
.I timespec
¤ΤѤ롣ι¤Τ
.I <time.h>
ƤꡢʲΤ褦ʷǤ:
.sp
.RS
.nf
.ne 12
.ta 8n 16n 32n
struct timespec
{
time_t tv_sec; /* */
long tv_nsec; /* ʥ */
};
.ta
.fi
.RE
.PP
ʥäΥեɤͤ 0 999999999 ϰϤˤʤФʤʤ
.BR sleep (3)
.BR usleep (3)
٤
.B nanosleep
ˤϰʲ:
.IP \(bu 3
ʥαƶʤ
.IP \(bu 3
POSIX ˤäɸಽ줿ؿǤ롣
.IP \(bu 3
⤤ʬǽƤ롣
.IP \(bu 3
ʥˤäǤ줿ˡߤ³뤳ȤñǤ롣
.SH 顼
顼㳰ξϡ
.B nanosleep
ƥॳ 0 \-1 ֤
.I errno
˰ʲͤΤ줫ꤹ:
.TP
.B EFAULT
桼֤ξΥԡ꤬ä
.TP
.B EINTR
ػ (block) Ƥʤʥ뤬ץơ
ߤǤ줿
ץñ
.B nanosleep
ƤӸƤӽФߤ³뤳ȤǤ褦ˡ
Ĥ֤ *\fIrem\fR ˳Ǽ롣
.TP
.B EINVAL
.I tv_nsec
եɤͤ 0 999999999 ޤǤϰϤˤʤä
.I tv_sec
Ǥä
.SH Х
ߤ
.B nanosleep
μ̤ΥͥΥ˴ŤƤ롣ͥΥ
1/\fIHZ\fR\ äʬǽäƤ (㤨 Linux/i386 Ǥ 10\ ms
Linux/Alpha Ǥ 1\ ms)Τᡢ
.B nanosleep
ϾʤȤꤵ줿ɬߤ뤬ץƤӼ¹ԤǤ
褦ˤʤޤǤ˻ꤵ줿֤ 10 ms ;פˤ롣Ʊͳǡ
ʥ뤬줿 *\fIrem\fR ֤ͤϡ̾
ºݤͤ꾮ʤǾ 1/\fIHZ\fR äܿڤ夲롣
.SS ư
(㤨С֤פʰ̣ĥϡɥ椹ʤ)
ΤߤɬפȤ륢ץꥱб뤿ˡ
.B nanosleep
ϡޥ٤ΥӥȤѤ뤳Ȥǡ
2\ ms ʲߤԤȤǤ
âεǽѤˤϡƤӽФΥץ
.I SCHED_FIFO
.I SCHED_RR
Ȥäꥢ륿ࡦݥꥷθǥ塼Ƥ
ɬפä
̤ʳĥϥͥ 2.5.39 Ǻ줿äơ
ߤ 2.4 ΥͥˤϤεǽ¸ߤ뤬
2.6ΥͥˤϤʤ
.SH
POSIX.1b ( POSIX.4)
.SH Ϣ
.BR sched_setscheduler (2),
.BR timer_create (2),
.BR sleep (3),
.BR usleep (3)
|