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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
|
.\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk
.\" <mtk.manpages@gmail.com>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Japanese Version Copyright (c) 2008 Akihiro MOTOKI
.\" all rights reserved.
.\" Translated 2008-08-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.04
.\"
.TH CLOCK_NANOSLEEP 2 2008-07-09 "Linux" "Linux Programmer's Manual"
.SH ̾
clock_nanosleep \- ꤷåǤι٤ʼ¹ (sleep)
.SH
.B #include <time.h>
.nf
.sp
.BI "int clock_nanosleep(clockid_t " clock_id ", int " flags ,
.BI " const struct timespec *" request ,
.BI " struct timespec *" remain );
.fi
.sp
\fI\-lrt\fP ǥ롣
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.BR clock_nanosleep ():
_XOPEN_SOURCE\ >=\ 600
.SH
.BR clock_nanosleep ()
Ȥȡ
.BR nanosleep (2)
Ʊ͡ʥä٤ǻꤵ줿֤ƤӽФåɤμ¹Ԥ
ߤ뤳ȤǤ롣
.BR nanosleep (2)
Ȱ㤦ΤϡƤӽФ¦ߴ֤ɤΥåФƷ¬Τ
Ǥȡߴ֤ͤǤͤǤǤǤ롣
ΥƥॳϤꡢΥƥॳ뤬֤ꤹ֤ͤ
.I timespec
¤ΤȤäƻꤵ롣ι¤Τϰʲ̤Ǥ롣
.sp
.in +4n
.nf
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds [0 .. 999999999] */
};
.fi
.in
.I clock_id
ǡߴ֤ɤΥåФƷ¬뤫ꤹ롣
ΰˤϰʲͤΤ줫ĤǤ롣
.TP 17
.BR CLOCK_REALTIME
ƥΤǻȤ»֥å
ΥåѹǽǤ롣
.TP
.BR CLOCK_MONOTONIC
Τλ֤¬롢ñĴäΥå
Ȥʤϥƥ൯ưˤѹʤ
Υåѹ뤳ȤǤʤ
.\" Linux ǤϡΥåϵưλ֤¬롣
.TP
.BR CLOCK_PROCESS_CPUTIME_ID
ΥץåɤǾ CPU ֤¬ץñ̤
åΥåǽǤ롣
.\" There is some trickery between glibc and the kernel
.\" to deal with the CLOCK_PROCESS_CPUTIME_ID case.
.PP
Υåξܺ٤ˤĤƤ
.BR clock_getres (2)
ȡ
.I flags
0 ξ硢
.I request
˻ꤵ줿ͤ
.I clock_id
ǻꤵ줿åθߤͤŪʴ֤Ȳᤵ롣
.I flags
.B TIMER_ABSTIME
ξ硢
.I request
ϻꤵ줿åǷ¬лȲᤵ롣
.I request
ꤵ줿åθߤͰʲξ硢
.BR clock_nanosleep ()
ϡƤӽФåɤߤԤ鷺֤롣
.BR clock_nanosleep ()
ϡʤȤ
.I request
ǻꤵ줿֤в᤹ޤǡƤӽФåɤμ¹Ԥߤ롣
ʥϥɥ餬ƤӽФ줿ꡢΥץλ褦
ʥ뤬줿ꤷˤ⡢åɤμ¹ߤϽλ롣
ƤӽФʥϥɥˤäƳޤ줿硢
.BR clock_nanosleep ()
\-1 ֤
.I errno
.B EINTR
ꤹ롣˲äơ
.I remain
NULL Ǥʤ
.I flags
.B TIMER_ABSTIME
Ǥʤˤϡ
.I remain
˻Ĥ֤֤롣
ͤȤä
.BR clock_nanosleep ()
ٸƤӽФȤǡ(Ūʴ֤) ߤλ뤳ȤǤ롣
.SH ֤
ᤵ줿֤ߤȡ
.BR clock_nanosleep ()
0 ֤
ʥϥɥdzޤ줿ꡢ顼ȯꤷ硢
Υ顼ֹ֤
.SH 顼
.TP
.B EFAULT
.I request
.I remain
̵ʥɥ쥹ꤵ줿
.TP
.B EINTR
ߤʥϥɥˤޤ줿
.TP
.B EINVAL
.I tv_nsec
եɤͤ 0 999999999 ϰϤǤʤ
.I tv_sec
ͤǤä
.TP
.B EINVAL
.I clock_id
̵Ǥä
.RB ( CLOCK_THREAD_CPUTIME_ID
.I clock_id
ȤͭͤǤϤʤ)
.SH С
.BR clock_nanosleep ()
ƥॳ Linux 2.6 ǽо줷
glibc ǤϥС 2.1 ʹߤǥݡȤƤ롣
.SH
POSIX.1-2001.
.SH
.I request
ǻꤵ줿ߴ֤֤η¬˻Ѥ륯å
.RB ( time (7)
) ٤ܿ礦ɤǤʤ硢ߴ֤ϰֶᤤܿ
ڤ夲롣ˡߤλˡCPU ƤӽФåɤ
⤦ټ¹ԤǤ褦ˤʤޤǤˤϡٱ䤬ǽ롣
ͻΥޤȤΤϡ
.BR nanosleep (2)
˽ƤΥޤΤɻߤΤΩ
(μϡʥ˳ޤ줿ݤлߤ
֤Ƴ褦ȤץǤϡäư)
лߤ¹Ԥˤϡ
˾륯å
.BR clock_gettime (2)
ƤӽФ֤ͤλͤ˴˾֤ûƤ顢
.B TIMER_ABSTIME
ե饰ꤷ
.BR clock_nanosleep ()
ƤӽФ
.BR sigaction (2)
.BR SA_RESTART
ե饰ꤵƤ뤫˴ؤ餺
ʥϥɥˤޤ줿
.BR clock_nanosleep ()
Ƴ뤳ȤϷ褷Ƥʤ
.I flags
.B TIMER_ABSTIME
ξ硢
.I remain
ϻѤ줺פǤ
(ͤǤߤǤϡƱ
.I request
ȤäƺٸƤӽФȤǤ)
POSIX.1 εǤϡ
.BR clock_nanosleep ()
ϥʥνˡ䥷ʥޥ˱ƶͿʤȤƤ롣
POSIX.1 εǤϡ
.BR clock_settime (2)
.B CLOCK_REALTIME
åͤѹϡͻ
.BR clock_nanosleep ()
ߤƤ륹åɤưȽϡ
åͤȤäƹԤ롢ȤƤ롣
åͤˤߴ֤νλ郎ˤʤäƤޤäˤϡ
.BR clock_nanosleep ()
Ϥ֤뤳Ȥˤʤ롣
POSIX.1 εǤϡ
.BR clock_settime (2)
.B CLOCK_REALTIME
åͤѹƤ⡢ͻ
.BR clock_nanosleep ()
ߤƤ륹åɤˤϱƶͿʤȤƤ롣
.SH Ϣ
.BR clock_getres (2),
.BR nanosleep (2),
.BR timer_create (2),
.BR sleep (3),
.BR usleep (3),
.BR time (7)
|