diff options
Diffstat (limited to 'upstream/mageia-cauldron/man9/sleep_on.9')
-rw-r--r-- | upstream/mageia-cauldron/man9/sleep_on.9 | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/upstream/mageia-cauldron/man9/sleep_on.9 b/upstream/mageia-cauldron/man9/sleep_on.9 new file mode 100644 index 00000000..ec19865c --- /dev/null +++ b/upstream/mageia-cauldron/man9/sleep_on.9 @@ -0,0 +1,100 @@ +.\" -*- nroff -*- +.\" +.\" copyright (C) 1997 Stephen Williams <steve@icarus.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. +.\" +.TH sleep_on 9 "$Date:$" "Linux DDI" "Kernel Functions" +.\" +.\" Turn off hyphenation and right justification for the first sections. +.hlm 0 +.na +.\" The name should be formatted this way for apropos to work +.SH NAME +sleep_on \- synchronization using a condition variable +.\" +.\" +.SH SYNOPSIS +.B #include <linux/sched.h> +.HP +.BI "void sleep_on(struct\ wait_queue**" condition ")" +.\" +.\" Turn hyphenation and adjustment back on. +.hlm 1 +.ad +.SH DESCRIPTION +The +.B sleep_on +function provides a means for synchronizing between processes and +with interrupt handlers. The +.I condition +parameter is a pointer to a pointer to the opaque wait_queue +type. Initialize the condition variable to zero, then pass a pointer +to it to the +.B sleep_on +function. The basic idea is as follows: +.PP +.na +struct wait_queue*con = 0; +.br + [...] +.br +sleep_on(&con); +.ad +.PP +While a process is sleeping, it is fully interruptible, no matter what +the cpu state when entering the function. The cpu state is restored on +being awakened. +.PP +If a null(0) is passed to +.BR sleep_on , +it returns immediately, without sleeping. This is a no-op. +.SH "RETURN VALUE" +The +.B sleep_on +function only returns when explicitly awakened. +.SH AVAILABILITY +Linux 1+ +.SH "SEE ALSO" +.hlm 0 +.na +.BR wake_up "(9)" +.ad +.hlm 1 +.PP +.I "/usr/src/linux/kernel/sched.c" +.SH AUTHOR +Stephen Williams <steve@icarus.com> +.SH BUGS +A call to +.I "sleep_on(0)" +seems like an interesting way to test for and momentarily allow +interrupts, but that is not what happens. +.PP +The +.B sleep_on +function cannot be called by interrupt handlers. +.PP +The function is not atomic with the condition tests that the driver +writer might include, so the code executing the +.B sleep_on +function is protected from interrupts. Failure to do so generally +leads to race conditions.
\ No newline at end of file |