mutex.9 (a254506ee5e921ec1ca837de9a792b46669f0835) mutex.9 (80cc42da6ba52981f61a7b9cebe67c15d7d59e71)
1.\"
2.\" Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 34 unchanged lines hidden (view full) ---

43.Nm mtx_unlock ,
44.Nm mtx_unlock_spin ,
45.Nm mtx_unlock_flags ,
46.Nm mtx_unlock_spin_flags ,
47.Nm mtx_destroy ,
48.Nm mtx_initialized ,
49.Nm mtx_owned ,
50.Nm mtx_recursed ,
1.\"
2.\" Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 34 unchanged lines hidden (view full) ---

43.Nm mtx_unlock ,
44.Nm mtx_unlock_spin ,
45.Nm mtx_unlock_flags ,
46.Nm mtx_unlock_spin_flags ,
47.Nm mtx_destroy ,
48.Nm mtx_initialized ,
49.Nm mtx_owned ,
50.Nm mtx_recursed ,
51.Nm mtx_assert
51.Nm mtx_assert,
52.Nm MTX_SYSINIT
52.Nd kernel synchronization primitives
53.Sh SYNOPSIS
54.In sys/param.h
55.In sys/lock.h
56.In sys/mutex.h
57.Ft void
58.Fn mtx_init "struct mtx *mutex" "const char *description" "int opts"
59.Ft void

--- 21 unchanged lines hidden (view full) ---

81.Ft int
82.Fn mtx_initialized "struct mtx *mutex"
83.Ft int
84.Fn mtx_owned "struct mtx *mutex"
85.Ft int
86.Fn mtx_recursed "struct mtx *mutex"
87.Ft void
88.Fn mtx_assert "struct mtx *mutex" "int what"
53.Nd kernel synchronization primitives
54.Sh SYNOPSIS
55.In sys/param.h
56.In sys/lock.h
57.In sys/mutex.h
58.Ft void
59.Fn mtx_init "struct mtx *mutex" "const char *description" "int opts"
60.Ft void

--- 21 unchanged lines hidden (view full) ---

82.Ft int
83.Fn mtx_initialized "struct mtx *mutex"
84.Ft int
85.Fn mtx_owned "struct mtx *mutex"
86.Ft int
87.Fn mtx_recursed "struct mtx *mutex"
88.Ft void
89.Fn mtx_assert "struct mtx *mutex" "int what"
90.Fn MTX_SYSINIT "name" "mtx" "description" "opts"
89.Sh DESCRIPTION
90Mutexes are the most basic and primary method of process synchronization.
91The major design considerations for mutexes are:
92.Bl -enum
93.It
94Acquiring and releasing uncontested mutexes should be as cheap
95as possible.
96.It

--- 258 unchanged lines hidden (view full) ---

355This assertion is only valid in conjunction with
356.Dv MA_OWNED .
357.It Dv MA_NOTRECURSED
358Assert that the current thread has not recursed on the mutex
359pointed to by the first argument.
360This assertion is only valid in conjunction with
361.Dv MA_OWNED .
362.El
91.Sh DESCRIPTION
92Mutexes are the most basic and primary method of process synchronization.
93The major design considerations for mutexes are:
94.Bl -enum
95.It
96Acquiring and releasing uncontested mutexes should be as cheap
97as possible.
98.It

--- 258 unchanged lines hidden (view full) ---

357This assertion is only valid in conjunction with
358.Dv MA_OWNED .
359.It Dv MA_NOTRECURSED
360Assert that the current thread has not recursed on the mutex
361pointed to by the first argument.
362This assertion is only valid in conjunction with
363.Dv MA_OWNED .
364.El
365.Pp
366The
367.Fn MTX_SYSINIT
368macro is used to generate a call to the
369.Fn mtx_sysinit
370routine at system startup in order to initialize a given mutex lock. The parameters are the same as
371.Fn mtx_init
372but with an additional argument,
373.Fa name,
374that is used in generating unique variable names for the related structures associated with the lock and the sysinit routine.
363.Ss The Default Mutex Type
364Most kernel code should use the default lock type,
365.Dv MTX_DEF ;
366the default lock type will allow the thread
367to be disconnected from the CPU
368if it cannot get the lock.
369The machine dependent implementation
370may treat the lock as a short term spin lock

--- 106 unchanged lines hidden ---
375.Ss The Default Mutex Type
376Most kernel code should use the default lock type,
377.Dv MTX_DEF ;
378the default lock type will allow the thread
379to be disconnected from the CPU
380if it cannot get the lock.
381The machine dependent implementation
382may treat the lock as a short term spin lock

--- 106 unchanged lines hidden ---