diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2014-12-29 13:31:54 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2014-12-29 13:31:54 +0000 |
commit | 86fbb9733f3c0871e08a1747a3ed626ca7188b48 (patch) | |
tree | a0de34ff4038043e72923bb6bd364ecf1ac480a1 /usr/src/man/man9f/condvar.9f | |
parent | 16cde6d9844c2f8b23c3ec19745130a036c6f410 (diff) | |
parent | 1fcc078ae7c0a359a9274d2a5a90547aceb213a6 (diff) | |
download | illumos-joyent-86fbb9733f3c0871e08a1747a3ed626ca7188b48.tar.gz |
[illumos-gate merge]
commit 1fcc078ae7c0a359a9274d2a5a90547aceb213a6
5479 Need missing *at family manual pages
commit d3864341aacc6a2ecc95960d23ac0e49f1f538fa
5478 need smt_pause(3C)
commit ad0ef8fd06d1ac28108685495a9ba1244a20a5ca
5477 Need manual pages for new pthreads robust related functions
commit b65dd972486b1f5913d705d2a0cb9c3fb189a9e0
5476 need manuals for getprogname(3C) and setprogname(3C)
commit d2b9ba291ef0d1dc8807b6d46996674c723924d0
5475 Need manuals for get_nprocs() and get_nprocs_conf()
commit bad51a906c423d0d7ab33fcc1a4e317d789e3c49
5474 missing various string family manuals
commit e232d9863a8486cf94eaa4bc06c2e9ff52bf3140
5464 missing ffs() and fsl() family of manual pages
commit ec7588a4ab9972aa7d50fd5f3b5ccdef4079952a
1372 kvmstat needs a man page
commit 03c1ea085b2a65a7bf9c001ba8502eb10725ea52
5460 utimensat() and futimens() need manual pages
commit 088940da40dfd58e4a00927addc99837dbefaa6d
3824 ppoll() needs a manpage
commit f6ed5ca267d42d2a060f8447acdeb647ef077b6d
3825 memmem() needs a manpage
5459 libc(3lib) s/Solaris/illumos
commit ce83b99835cc4643ab0fefd88dea62427d9ced5e
3826 fcloseall() needs a manpage
commit 89b9271284be1a4e3e3053d7bc12f9bbf8145b06
3827 clearenv() needs a manpage
commit 195b26986e3c19e916bf0991a1af7ae87d43010b
3841 strnstr() needs a man page
commit f85a6f389e74896ee3d46e89d843dbd2dde60c6d
4617 condvar(9f): Missing documentation for cv_reltimedwait() and cv_reltimedwait_sig()
5458 Intro(9F) s/Solaris/illumos
commit 820218f30a3ad84d92aa2970dcac9eb5cf69aaa9
3846 canonicalize_file_name() needs a man page
commit 8b87c15576a5138f88a969448b43561bf5968c09
5485 Missing const qualifiers for strings in libndmp
5486 leaked buffer in ndmp_base64_decode()
commit b6831eafa2ec2cb283f783b06ee86bf79d5a17c3
5432 zoneadm install could fix zonepath permissions automatically
Diffstat (limited to 'usr/src/man/man9f/condvar.9f')
-rw-r--r-- | usr/src/man/man9f/condvar.9f | 136 |
1 files changed, 106 insertions, 30 deletions
diff --git a/usr/src/man/man9f/condvar.9f b/usr/src/man/man9f/condvar.9f index 2bb1b85ce0..6766ed8d5b 100644 --- a/usr/src/man/man9f/condvar.9f +++ b/usr/src/man/man9f/condvar.9f @@ -1,5 +1,6 @@ '\" te .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved +.\" Copyright (c) 2014, Joyent, Inc. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] @@ -52,12 +53,22 @@ cv_timedwait, cv_timedwait_sig \- condition variable routines \fBclock_t\fR \fBcv_timedwait_sig\fR(\fBkcondvar_t *\fR\fIcvp\fR, \fBkmutex_t *\fR\fImp\fR, \fBclock_t\fR \fItimeout\fR); .fi +.LP +.nf +\fBclock_t\fR \fBcv_reltimedwait\fR(\fBkcondvar_t *\fR\fIcvp\fR, \fBkmutex_t *\fR\fImp\fR, \fBclock_t\fR \fIdelta\fR, + \fBtime_res_t\fR \fIres\fR); +.fi + +.LP +.nf +\fBclock_t\fR \fBcv_reltimedwait_sig\fR(\fBkcondvar_t *\fR\fIcvp\fR, \fBkmutex_t *\fR\fImp\fR, \fBclock_t\fR \fIdelta\fR, + \fBtime_res_t\fR \fIres\fR); +.fi + .SH INTERFACE LEVEL -.sp .LP Solaris DDI specific (Solaris DDI). .SH PARAMETERS -.sp .ne 2 .na \fB\fIcvp\fR\fR @@ -114,8 +125,56 @@ A time, in absolute ticks since boot, when \fBcv_timedwait()\fR or \fBcv_timedwait_sig()\fR should return. .RE -.SH DESCRIPTION .sp +.ne 2 +.na +\fB\fIres\fR\fR +.ad +.RS 11n +A value which describes the requested accuracy of the timeout argument. +The system may anticipate or defer the timeout based on the requested +accuracy to prevent unnecessary wakeups. The following identifiers are +valid arguments for this type: +.LP +.RS 4n +.B TR_NANOSEC +.RS 16n +Nanosecond granularity +.RE +.RE +.RS 4n +.B TR_MICROSEC +.RS 16n +Microsecond granularity +.RE +.RE +.RS 4n +.B TR_MILLISEC +.RS 16n +Millisecond granularity +.RE +.RE +.RS 4n +.B TR_SEC +.RS 16n +Second granularity +.RE +.RE +.RS 4n +.B TR_CLOCK_TICK +.RS 16n +Granularity of a kernel clock tick, commonly 100 or 1000 Hz. +.RE +.RE +.LP +Note that the granularity of these functions is in clock ticks, +therefore the only values which will have an effect are: +.B TR_SEC +and +.B TR_CLOCK_TICK . +.RE + +.SH DESCRIPTION .LP Condition variables are a standard form of thread synchronization. They are designed to be used with mutual exclusion locks (mutexes). The associated mutex @@ -168,16 +227,32 @@ being signaled after the timeout time has been reached, or \fB0\fR if a signal For both \fBcv_timedwait()\fR and \fBcv_timedwait_sig()\fR, time is in absolute clock ticks since the last system reboot. The current time may be found by calling \fBddi_get_lbolt\fR(9F). -.SH RETURN VALUES .sp +.LP +The functions +.B cv_reltimedwait() +and +.B cv_reltimedwait_sig() +behave similarly to +.B cv_timedwait() and +.B cv_timedwait_sig() +respectively, except instead of taking a time in absolute clock ticks, +they take a relative number of clock ticks to wait. In addition, both +functions take an additional argument +.I res, +which specifies the desired granularity that the system should default +to, generally the value +.B TR_CLOCK_TICK . +.SH RETURN VALUES .ne 2 .na \fB\fB0\fR\fR .ad .RS 9n -For \fBcv_wait_sig()\fR and \fBcv_timedwait_sig()\fR indicates that the -condition was not necessarily signaled and the function returned because a -signal (as in \fBkill\fR(2)) was pending. +For \fBcv_wait_sig()\fR, \fBcv_timedwait_sig()\fR, and +\fBcv_reltimedwait_sig()\fR indicates that the condition was not necessarily +signaled and the function returned because a signal (as in \fBkill\fR(2)) was +pending. .RE .sp @@ -186,9 +261,9 @@ signal (as in \fBkill\fR(2)) was pending. \fB\fB\(mi1\fR\fR .ad .RS 9n -For \fBcv_timedwait()\fR and \fBcv_timedwait_sig()\fR indicates that the -condition was not necessarily signaled and the function returned because the -timeout time was reached. +For \fBcv_timedwait()\fR, \fBcv_timedwait_sig()\fR, \fBcv_reltimedwait()\fR, and +\fBcv_reltimedwait_sig()\fR, indicates that the condition was not necessarily +signaled and the function returned because the timeout time was reached. .RE .sp @@ -197,23 +272,24 @@ timeout time was reached. \fB\fB>0\fR\fR .ad .RS 9n -For \fBcv_wait_sig()\fR, \fBcv_timedwait()\fR or \fBcv_timedwait_sig()\fR -indicates that the condition was met and the function returned due to a call to -\fBcv_signal()\fR or \fBcv_broadcast()\fR, or due to a premature wakeup (see -NOTES). +For \fBcv_wait_sig()\fR, \fBcv_timedwait()\fR, \fBcv_timedwait_sig()\fR, +\fBcv_reltimedwait()\fR, and \fBcv_reltimedwait_sig()\fR, indicates that the +condition was met and the function returned due to a call to \fBcv_signal()\fR +or \fBcv_broadcast()\fR, or due to a premature wakeup (see NOTES). .RE .SH CONTEXT -.sp .LP These functions can be called from user, kernel or interrupt context. In most -cases, however, \fBcv_wait()\fR, \fBcv_timedwait()\fR, \fBcv_wait_sig()\fR, and -\fBcv_timedwait_sig()\fR should not be called from interrupt context, and +cases, however, \fBcv_wait()\fR, \fBcv_timedwait()\fR, \fBcv_wait_sig()\fR, +\fBcv_timedwait_sig()\fR, \fBcv_reltimedwait()\fR, and +\fBcv_reltimedwait_sig()\fR, should not be called from interrupt context, and cannot be called from a high-level interrupt context. .sp .LP -If \fBcv_wait()\fR, \fBcv_timedwait()\fR, \fBcv_wait_sig()\fR, or -\fBcv_timedwait_sig()\fR are used from interrupt context, lower-priority +If \fBcv_wait()\fR, \fBcv_timedwait()\fR, \fBcv_wait_sig()\fR, +\fBcv_timedwait_sig()\fR, \fBcv_reltimedwait()\fR, or +\fBcv_reltimedwait_sig()\fR, are used from interrupt context, lower-priority interrupts will not be serviced during the wait. This means that if the thread that will eventually perform the wakeup becomes blocked on anything that requires the lower-priority interrupt, the system will hang. @@ -264,16 +340,16 @@ mutex_exit(&un->un_lock); .in -2 .SH NOTES -.sp .LP It is possible for \fBcv_wait()\fR, \fBcv_wait_sig()\fR, \fBcv_timedwait()\fR, -and \fBcv_timedwait_sig()\fR to return prematurely, that is, not due to a call -to \fBcv_signal()\fR or \fBcv_broadcast()\fR. This occurs most commonly in the -case of \fBcv_wait_sig()\fR and \fBcv_timedwait_sig()\fR when the thread is -stopped and restarted by job control signals or by a debugger, but can happen -in other cases as well, even for \fBcv_wait()\fR. Code that calls these -functions must always recheck the reason for blocking and call again if the -reason for blocking is still true. +\fBcv_timedwait_sig()\fR, \fBcv_reltimedwait()\fR, and +\fBcv_reltimedwait_sig()\fR to return prematurely, that is, not due to a call to +\fBcv_signal()\fR or \fBcv_broadcast()\fR. This occurs most commonly in the case +of \fBcv_wait_sig()\fR and \fBcv_timedwait_sig()\fR when the thread is stopped +and restarted by job control signals or by a debugger, but can happen in other +cases as well, even for \fBcv_wait()\fR. Code that calls these functions must +always recheck the reason for blocking and call again if the reason for blocking +is still true. .sp .LP If your driver needs to wait on behalf of processes that have real-time @@ -284,13 +360,13 @@ priority inversions. .LP Not all threads can receive signals from user level processes. In cases where such reception is impossible (such as during execution of \fBclose\fR(9E) due -to \fBexit\fR(2)), \fBcv_wait_sig()\fR behaves as \fBcv_wait()\fR, and -\fBcv_timedwait_sig()\fR behaves as \fBcv_timedwait()\fR. To avoid unkillable +to \fBexit\fR(2)), \fBcv_wait_sig()\fR behaves as \fBcv_wait()\fR, +\fBcv_timedwait_sig()\fR behaves as \fBcv_timedwait()\fR, and +\fBcv_reltimedwait_sig()\fR behaves as \fBcv_reltimedwait()\fR. To avoid unkillable processes, users of these functions may need to protect against waiting indefinitely for events that might not occur. The \fBddi_can_receive_sig\fR(9F) function is provided to detect when signal reception is possible. .SH SEE ALSO -.sp .LP \fBkill\fR(2), \fBddi_can_receive_sig\fR(9F), \fBddi_get_lbolt\fR(9F), \fBmutex\fR(9F), \fBmutex_init\fR(9F) |