43 Commits

Author SHA1 Message Date
brueffer
d09a872f93 Bump .Dd for previous revision. 2007-11-26 15:21:21 +00:00
attilio
9dbbf0c556 Update sx(9) lock manpage in order to add missing prototypes for function
sx_slock_sig() and sx_xlock_sig() and their respective explanation.
2007-11-25 01:55:53 +00:00
jhb
124d541ab4 Rename the macros for assertion flags passed to sx_assert() from SX_* to
SA_* to match mutexes and rwlocks.  The old flags still exist for
backwards compatiblity.

Requested by:	attilio
2007-05-19 21:26:05 +00:00
jhb
1b6732031f Document sx_xholder(). 2007-05-19 20:24:32 +00:00
jhb
f09057052a Document SX_RECURSE flag. 2007-05-19 16:38:10 +00:00
jhb
b0b93a3c55 Optimize sx locks to use simple atomic operations for the common cases of
obtaining and releasing shared and exclusive locks.  The algorithms for
manipulating the lock cookie are very similar to that rwlocks.  This patch
also adds support for exclusive locks using the same algorithm as mutexes.

A new sx_init_flags() function has been added so that optional flags can be
specified to alter a given locks behavior.  The flags include SX_DUPOK,
SX_NOWITNESS, SX_NOPROFILE, and SX_QUITE which are all identical in nature
to the similar flags for mutexes.

Adaptive spinning on select locks may be enabled by enabling the
ADAPTIVE_SX kernel option.  Only locks initialized with the SX_ADAPTIVESPIN
flag via sx_init_flags() will adaptively spin.

The common cases for sx_slock(), sx_sunlock(), sx_xlock(), and sx_xunlock()
are now performed inline in non-debug kernels.  As a result, <sys/sx.h> now
requires <sys/lock.h> to be included prior to <sys/sx.h>.

The new kernel option SX_NOINLINE can be used to disable the aforementioned
inlining in non-debug kernels.

The size of struct sx has changed, so the kernel ABI is probably greatly
disturbed.

MFC after:	1 month
Submitted by:	attilio
Tested by:	kris, pjd
2007-03-31 23:23:42 +00:00
julian
3f8481620d Add some cross references to locking.9 from related pages. 2007-03-30 18:07:26 +00:00
jhb
f5e3969340 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
jhb
83009be85d - Sort functions in the order that rwlock(9) and mutex(9) use.
- Markup sx_unlock() as a function rather than saying it is a macro.
  The macro part is an implementation detail, and all the other sx_*lock()
  functions are actually macros, too.
- Use the same style as rwlock(9) and mutex(9) to markup sx_assert() and
  SX_SYSINIT() with respect to headers and kernel options.
- Add a missing MLINK.
2007-03-09 16:52:26 +00:00
pjd
07ad858fee Document sx_xlocked(9).
Submitted by:	ssouhlal
2006-07-12 15:40:35 +00:00
jhb
a74c12c708 Trim a couple of xrefs. 2006-04-19 20:41:56 +00:00
glebius
bd3f3fcc08 Xref rwlock(9).
Reviewed by:	ru
2006-02-01 20:30:55 +00:00
ru
024faad271 Scheduled mdoc(7) sweep. 2005-01-12 21:48:25 +00:00
keramida
a580204516 Make an attempt at explaining why sx(9) locks cannot be safely obtained
after acquiring a mutex(9).

PR:		docs/75571
Submitted by:	darrenr
Explanation by:	jhb
2005-01-05 22:04:12 +00:00
darrenr
6c66c4291a Document that sx_unlock() exists as a macro.
Remove redundant include file, <sys/kernel.h>, and clean up the function
list at the top with the addition of a "Sx utility macro" section.
2004-07-11 16:08:25 +00:00
ru
aa52a5a900 Assorted markup, spelling, and grammar fixes. 2004-06-16 08:33:57 +00:00
jhb
602c2e6421 - Clarify ambiguous statement about not being able to both slock and xlock
a single lock at the same time.
- Avoid using "own" to refer to holding either a shared or exclusive lock
  as it is only really correct for exclusive locks.
- Reword the sentence about sleep-ability to read easier.

Requested by:	truckman (1)
2004-02-24 21:36:39 +00:00
pjd
d4d0f8b9e0 Document new 'what' value for sx_assert(9).
PS. There is a inconsistency in this manual page, because in
    non-WITNESS case sx_assert(9) does not panics, it only prints
    the warning. I haven't fixed this, because jhb@ is planing to
    replace those printf()s with panic()s.

Reviewed by:	jhb
Approved by:	jhb, scottl (mentor)
2004-02-04 08:24:05 +00:00
jkoshy
eb1c647689 Add "options INVARIANTS" and "options INVARIANT_SUPPORT" to the
synopsis, with supporting text in the body of the manual page.

Add a cross-reference to panic(9) for completeness.

Reviewed by:	ru (synopsis changes)
2004-01-01 05:16:35 +00:00
jkoshy
89eb2dfeeb Make this manual page reflect the sources better.
- A #include of <sys/mutex.h> is no longer needed to use sx(9) (since
  2001/05/01).
- Use of the SX_SYSINIT() macro requires inclusion of '<sys/kernel.h>'
2003-12-28 01:37:48 +00:00
jkoshy
7fe60e3764 Improve continuity of text. 2003-12-27 14:01:08 +00:00
ru
cc9d2aeb39 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
harti
8ce1f89230 Document the fact that one is allowed to sleep while holding an sx lock.
Discussed with: jhb@
2003-06-12 09:06:25 +00:00
ru
d70d6a2c6b mdoc(7) police: lint. 2002-05-29 18:00:23 +00:00
fenner
01385403a9 mdoc police: turn .PP back into .Pp 2002-04-17 21:26:43 +00:00
davidc
2d9c1acf77 Update the .Fn line for SX_SYSINIT to include the parameter types. 2002-04-12 03:55:43 +00:00
arr
85f5ae7a3b - Add notes about SX_SYSINIT and MTX_SYSINIT in order to document the
recent additions of these macros.
- Add in a MLINK to create SX_SYSINIT.9 and MTX_SYSINIT.9.
2002-04-02 17:21:00 +00:00
dd
8edb7b74a0 Add mtx_pool(9) to the SEE ALSO section.
Submitted by:	Garrett Rooney <rooneg@electricjellyfish.net>
2002-03-28 12:51:06 +00:00
ru
3242e73680 mdoc(7) police: WITNESS is a #define, mark it as such. 2001-11-21 11:47:55 +00:00
ru
5bfc82c74e mdoc(7) police: cosmetique. 2001-11-21 11:44:36 +00:00
jhb
4ec47be8ec Document sx_assert(9). 2001-10-23 22:51:59 +00:00
bde
17f224e149 Fixed wrong include in synopsis. 2001-10-04 09:01:49 +00:00
ru
623da62a5a mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
silby
203a1b36d1 Common Mike adds see alsos from all of the synchronization
man pages to their brethren.
2001-09-17 07:24:48 +00:00
ru
dbc6471fad mdoc(7) police: bump document date. 2001-08-14 16:01:00 +00:00
jasone
4adf50d764 Add missing commas. 2001-08-14 05:10:07 +00:00
jasone
74c140cf82 Add sx_try_upgrade() and sx_downgrade().
Submitted by:	Alexander Kabaev <ak03@gte.com>
2001-08-13 21:25:30 +00:00
ru
e8e5635e4a Spell "FreeBSD" with "F" and "BSD" in uppercase. 2001-08-13 16:33:00 +00:00
jasone
0619ea75c3 Document sx_try_[sx]lock(). 2001-08-07 04:29:53 +00:00
schweikh
511e378b14 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
ru
e354144cdf mdoc(7) police: removed final dot from the .Nd call. 2001-04-04 12:00:29 +00:00
jhb
11a6b9c53f - Both <sys/sx.h> and <sys/mutex.h> depend on <sys/types.h> and
<sys/lock.h>.
- <sys/sx.h> depends on <sys/mutex.h>.
2001-03-28 12:45:41 +00:00
jasone
cd006e6a5c Implement shared/exclusive locks.
Reviewed by:	bmilekic, jake, jhb
2001-03-05 19:59:41 +00:00