Commit Graph

63 Commits

Author SHA1 Message Date
John Baldwin
414e7679cb Permit Giant to be passed as the explicit interlock either to
msleep/mtx_sleep or the various cv_*wait*() routines.  Currently, the
"unlock" behavior of PDROP and cv_wait_unlock() with Giant is not
permitted as it is will be confusing since Giant is fully unrecursed and
unlocked during a thread sleep.

This is handy for subsystems which wish to allow unlocked drivers to
continue to use Giant such as CAM, the new TTY layer, and the new USB
stack.  CAM currently uses a hack that I told Scott to use because I
really didn't want to permit this behavior, and the TTY and USB patches
both have various patches to permit this.

MFC after:	2 weeks
2008-08-07 21:00:13 +00:00
Warner Losh
043b496b8d Add note about PZERO being obsolete, because so much code uses it.
Feel free to improve the verbage, since this was a compromise between
conflicting feedback I got on my original version.
2008-04-04 16:59:58 +00:00
Julian Elischer
a280550abf Add some cross references to locking.9 from related pages. 2007-03-30 18:07:26 +00:00
Greg Lehey
6238e679b7 Typo. 2007-03-13 03:56:16 +00:00
John Baldwin
e7573e7ad7 Allow threads to atomically release rw and sx locks while waiting for an
event.  Locking primitives that support this (mtx, rw, and sx) now each
include their own foo_sleep() routine.
- Rename msleep() to _sleep() and change it's 'struct mtx' object to a
  'struct lock_object' pointer.  _sleep() uses the recently added
  lc_unlock() and lc_lock() function pointers for the lock class of the
  specified lock to release the lock while the thread is suspended.
- Add wrappers around _sleep() for mutexes (mtx_sleep()), rw locks
  (rw_sleep()), and sx locks (sx_sleep()).  msleep() still exists and
  is now identical to mtx_sleep(), but it is deprecated.
- Rename SLEEPQ_MSLEEP to SLEEPQ_SLEEP.
- Rewrite much of sleep.9 to not be msleep(9) centric.
- Flesh out the 'RETURN VALUES' section in sleep.9 and add an 'ERRORS'
  section.
- Add __nonnull(1) to _sleep() and msleep_spin() so that the compiler will
  warn if you try to pass a NULL wait channel.  The functions already have
  a KASSERT to that effect.
2007-03-09 22:41:01 +00:00
Greg Lehey
1c5fcea18d Another typo.
Spotted by:             ru
Another pointy hat to:  grog
2007-03-05 05:59:49 +00:00
Greg Lehey
c907770c56 Cosmetics: remove trailing white space, wrap over-long lines.
Pointy hat to:  grog
2007-03-05 00:27:30 +00:00
Greg Lehey
759ace7eca Rearrange function descriptions in more logical order.
Be less alarmist about the dangers of abusing wakeup_one().

Requested by: kris, imp
2007-03-04 23:42:58 +00:00
Greg Lehey
8866174561 Furhter clarifications:
- the issues with wakeup_one are due to address space clashes between
  unrelated groups of threads.
- sleep() was removed in FreeBSD 2.2.
- date the page today, not 4 days ago.
- replace grammatically correct "woken" with "woken up" for
  consistency with the function name.
2007-02-27 23:09:31 +00:00
John Baldwin
a198b356e5 In FreeBSD 5.x+, sleep/wakeup operate on threads, not processes. 2007-02-27 16:32:55 +00:00
Ruslan Ermilov
7700fc3ca9 Fix markup and grammar bugs in recent revisions. 2007-02-27 16:21:01 +00:00
Greg Lehey
fc5fe41fe9 Update HISTORY.
Reviewed by:	dmr
2007-02-27 05:39:22 +00:00
Greg Lehey
5af924bf6c Add warning about deadlocks created by use of wakeup_one. 2007-02-27 02:51:41 +00:00
John Baldwin
37e80fcac2 Add a new kernel sleep function pause(9). pause(9) is for places that
want an equivalent of DELAY(9) that sleeps instead of spins.  It accepts
a wmesg and a timeout and is not interrupted by signals.  It uses a private
wait channel that should never be woken up by wakeup(9) or wakeup_one(9).

Glanced at by:	phk
2007-02-23 16:22:09 +00:00
Ruslan Ermilov
81ae4b8da9 Markup fixes. 2006-09-18 15:24:20 +00:00
John Baldwin
8ba7a3578b - Sleep/wakeup operate on threads now, not processes.
- Describe msleep() as the primary sleep function now rather than tsleep()
  and describe tsleep() and msleep_spin() as variations.
- Try to make the description of msleep() a bit closer to English
  (sentences with actual subjects, etc.)
- Document that a priority of 0 now prevents the thread's priority from
  being altered.
- Add a history note for wakeup_one().
2006-04-17 19:11:12 +00:00
John-Mark Gurney
235811bfea allow timo to be 0 when mtx is not NULL (KASSERT allowed this as
pointed out by jhb)

Reviewed by:	jhb
MFC after:	3 days
2006-02-22 20:50:33 +00:00
John Baldwin
61d963bc57 - Don't list sleep() in the NAME section as we haven't had a sleep()
function in years.
- Change the 'ident' paramters to 'wchan' to match <sys/systm.h>.
- Use 'otherwise' in place of 'else' in one place so that this reads like
  English rather than C.
- Document the new msleep_spin() function.
- Add history notes for msleep() and msleep_spin().
2006-01-03 17:00:38 +00:00
Hiten Pandya
571dba6ec9 Use 'manual page' instead of 'man page' for consistency.
Approved by:	re (hrs)
2005-06-28 20:15:19 +00:00
Colin Percival
bfadd9be1e Point out that tsleep(... , 0) is not permitted if the Giant lock is not
held.  (It causes a "sleeping without a mutex" assertion failure in
msleep.)

MFC after:	3 days
2005-01-07 02:41:45 +00:00
Maxim Konovalov
ad1218e35e o Be consistent with the declaration: pri -> priority.
Spotted by:	Dmitry Rzhavin
MFC after:	1 week
2004-02-17 13:31:36 +00:00
Hiten Pandya
559eb8d2e3 Mdoc Janitor:
* Fix hard sentence breaks.
2003-10-23 02:33:03 +00:00
Hiten Pandya
0640e9e01b Some mdoc(7) fixes:
Nuke incorrect usage of .Ar; replace it with .Vt, .Va or .Fa appropriately.
The .Ar mdoc(7) specifier should only be used when displaying command line
arguments.

Approved by:	des (mentor)
2003-05-31 14:07:25 +00:00
John Baldwin
2adcfc5855 - Use better terminology when describing mutex operations in msleep(9)'s
description.
- Remove some bogus commas.
- Use the past tense when referring to the removal of the sleep() function
  since it happened quite a while ago and since the previous sentence in the
  paragraph already uses the past tense.

Approved by:	re (rwatson)
2003-05-16 15:52:32 +00:00
Ruslan Ermilov
ace5be682d mdoc(7) police: Scheduled sweep. 2003-02-24 22:53:26 +00:00
Guido van Rooij
02718c4983 sleep -> msleep 2003-02-04 08:53:45 +00:00
Tom Rhodes
62058fa939 mdoc(4) police: Markup. Fix 1 hard sentence break. 2003-01-03 23:06:10 +00:00
Tom Rhodes
7538a3c022 mdoc(7) police: Remove hard sentence breaks. 2003-01-03 22:39:39 +00:00
Tom Rhodes
cd9f822b00 mdoc(7) police: markup nits. 2003-01-03 22:37:10 +00:00
Ruslan Ermilov
2ca6ad76af mdoc(7) police: macroize UNIX. 2002-03-18 10:43:49 +00:00
John Polstra
9d981897e4 Fix speling errur. 2001-12-05 02:55:23 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
John Baldwin
b4e95913f7 Remove references to asleep/await. 2001-08-23 23:37:31 +00:00
Ruslan Ermilov
c4d9468ea0 mdoc(7) police:
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00
Jens Schweikhardt
c1f3e4bf21 Removed whitespace at end-of-line; no content changes. I simply did
cd src/share; find man[1-9] -type f|xargs perl -pi -e 's/[ \t]+$//'

BTW, what editors are the culprits? I'm using vim and it shows
me whitespace at EOL in troff files with a thick blue block...

Reviewed by:	Silence from cvs diff -b
MFC after:	7 days
2001-07-14 19:41:16 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Ruslan Ermilov
b92a189eb9 mdoc(7) police: Er macro usage cleanup. 2000-11-22 16:11:48 +00:00
Ruslan Ermilov
f4d874a1db mdoc(7) police: do not split author names in the AUTHORS section. 2000-11-22 09:35:58 +00:00
Ruslan Ermilov
4b66483fd8 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 18:41:33 +00:00
Ruslan Ermilov
726b61ab5f Avoid use of direct troff requests in mdoc(7) manual pages. 2000-11-10 17:46:15 +00:00
John Baldwin
c5f3b30e68 Replace non-existent 'mtx_t' typedef'd type with 'struct mtx'. 2000-11-10 01:51:55 +00:00
Jake Burkholder
e66ccea4a1 Add scant documentation for msleep. 2000-09-11 00:52:31 +00:00
Mark Murray
4fea914dda Improve the cross-references. 2000-08-15 15:14:13 +00:00
Mark Murray
3e36b6ef41 Fix grammar and a function name. 2000-08-15 15:09:13 +00:00
Tim Vanderhoek
b17407bbe3 Small grammar gnit. 2000-05-09 20:35:13 +00:00
Jason Evans
9102cbc957 Fix a typo (simple --> simply). 2000-02-16 22:45:51 +00:00
Joerg Wunsch
93c6e868e8 Move the description of the traditional sleep() form out into the history
section, we no longer have it.

Fix mdoc style violations caused by a previous committer.
1999-11-03 10:39:54 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Mike Pritchard
def37e7c68 Various man page cleanup:
- Sort xrefs
- FreeBSD.ORG -> FreeBSD.org
- Be consistent with section names as outlined in mdoc(7).
- Other misc mdoc cleanup.

PR:		doc/13144
Submitted by:	Alexey M. Zelkin <phantom@cris.net>
1999-08-15 10:48:36 +00:00
Mike Pritchard
a04dd7481b Fix some spelling errors. 1999-02-01 22:55:54 +00:00