spinlock-r0drv-os2.cpp revision 5b281ba489ca18f0380d7efc7a5108b606cce449
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * IPRT - Spinlocks, Ring-0 Driver, OS/2.
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * Permission is hereby granted, free of charge, to any person
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * obtaining a copy of this software and associated documentation
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * files (the "Software"), to deal in the Software without
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * restriction, including without limitation the rights to use,
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * copy, modify, merge, publish, distribute, sublicense, and/or sell
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * copies of the Software, and to permit persons to whom the
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * Software is furnished to do so, subject to the following
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * conditions:
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * The above copyright notice and this permission notice shall be
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * included in all copies or substantial portions of the Software.
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * OTHER DEALINGS IN THE SOFTWARE.
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync/*******************************************************************************
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync* Header Files *
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync*******************************************************************************/
f5663ddc90362ab5cfe32e277fa34f2b057e8cfdvboxsync/*******************************************************************************
f5663ddc90362ab5cfe32e277fa34f2b057e8cfdvboxsync* Structures and Typedefs *
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync*******************************************************************************/
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync * Wrapper for the SpinLock_t type.
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync /** Spinlock magic value (RTSPINLOCK_MAGIC). */
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync /** The OS/2 spinlock structure. */
f5663ddc90362ab5cfe32e277fa34f2b057e8cfdvboxsync * Allocate.
f5663ddc90362ab5cfe32e277fa34f2b057e8cfdvboxsync AssertCompile(sizeof(RTSPINLOCKINTERNAL) > sizeof(void *));
f5663ddc90362ab5cfe32e277fa34f2b057e8cfdvboxsync PRTSPINLOCKINTERNAL pSpinlockInt = (PRTSPINLOCKINTERNAL)RTMemAlloc(sizeof(*pSpinlockInt));
f5663ddc90362ab5cfe32e277fa34f2b057e8cfdvboxsync * Initialize & return.
f5663ddc90362ab5cfe32e277fa34f2b057e8cfdvboxsync * Validate input.
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync PRTSPINLOCKINTERNAL pSpinlockInt = (PRTSPINLOCKINTERNAL)Spinlock;
bd44be5c996657f50cadcb987ee2879f4114d249vboxsync AssertMsgReturn(pSpinlockInt->u32Magic == RTSPINLOCK_MAGIC,
return VINF_SUCCESS;