xref: /freebsd/sys/sys/_sx.h (revision 4e7f640dfbe1f666c3857534899ee168776fbe67)
14e7f640dSJohn Baldwin /*-
24e7f640dSJohn Baldwin  * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>
34e7f640dSJohn Baldwin  * All rights reserved.
44e7f640dSJohn Baldwin  *
54e7f640dSJohn Baldwin  * Redistribution and use in source and binary forms, with or without
64e7f640dSJohn Baldwin  * modification, are permitted provided that the following conditions
74e7f640dSJohn Baldwin  * are met:
84e7f640dSJohn Baldwin  * 1. Redistributions of source code must retain the above copyright
94e7f640dSJohn Baldwin  *    notice(s), this list of conditions and the following disclaimer as
104e7f640dSJohn Baldwin  *    the first lines of this file unmodified other than the possible
114e7f640dSJohn Baldwin  *    addition of one or more copyright notices.
124e7f640dSJohn Baldwin  * 2. Redistributions in binary form must reproduce the above copyright
134e7f640dSJohn Baldwin  *    notice(s), this list of conditions and the following disclaimer in the
144e7f640dSJohn Baldwin  *    documentation and/or other materials provided with the distribution.
154e7f640dSJohn Baldwin  *
164e7f640dSJohn Baldwin  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
174e7f640dSJohn Baldwin  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
184e7f640dSJohn Baldwin  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
194e7f640dSJohn Baldwin  * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
204e7f640dSJohn Baldwin  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
214e7f640dSJohn Baldwin  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
224e7f640dSJohn Baldwin  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
234e7f640dSJohn Baldwin  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
244e7f640dSJohn Baldwin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
254e7f640dSJohn Baldwin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
264e7f640dSJohn Baldwin  * DAMAGE.
274e7f640dSJohn Baldwin  *
284e7f640dSJohn Baldwin  * $FreeBSD$
294e7f640dSJohn Baldwin  */
304e7f640dSJohn Baldwin 
314e7f640dSJohn Baldwin #ifndef	_SYS__SX_H_
324e7f640dSJohn Baldwin #define	_SYS__SX_H_
334e7f640dSJohn Baldwin 
344e7f640dSJohn Baldwin /*
354e7f640dSJohn Baldwin  * Shared/exclusive lock main structure definition.
364e7f640dSJohn Baldwin  */
374e7f640dSJohn Baldwin struct sx {
384e7f640dSJohn Baldwin 	struct lock_object	lock_object;
394e7f640dSJohn Baldwin 	volatile uintptr_t	sx_lock;
404e7f640dSJohn Baldwin 	volatile unsigned	sx_recurse;
414e7f640dSJohn Baldwin };
424e7f640dSJohn Baldwin 
434e7f640dSJohn Baldwin #endif	/* !_SYS__SX_H_ */
44