semeventmulti-r0drv-linux.c revision 30c84c361575629a712f338b514d9db7a8c681f4
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync/* $Id$ */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync/** @file
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Linux.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync/*
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync *
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * available from http://www.virtualbox.org. This file is free software;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * General Public License (GPL) as published by the Free Software
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync *
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * The contents of this file may alternatively be used under the terms
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * of the Common Development and Distribution License Version 1.0
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * VirtualBox OSE distribution, in which case the provisions of the
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * CDDL are applicable instead of those of the GPL.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync *
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * You may elect to license modified versions of this file under the
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * terms and conditions of either the GPL or the CDDL or both.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync *
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * additional information or have any questions.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync/*******************************************************************************
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync* Header Files *
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync*******************************************************************************/
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#include "the-linux-kernel.h"
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#include "internal/iprt.h"
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#include <iprt/semaphore.h>
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#include <iprt/alloc.h>
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#include <iprt/assert.h>
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#include <iprt/asm.h>
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#include <iprt/err.h>
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#include "internal/magics.h"
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync/*******************************************************************************
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync* Structures and Typedefs *
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync*******************************************************************************/
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync/**
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync * Linux event semaphore.
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync */
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsynctypedef struct RTSEMEVENTMULTIINTERNAL
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync{
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync /** Magic value (RTSEMEVENTMULTI_MAGIC). */
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync uint32_t volatile u32Magic;
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync /** The object status - !0 when signaled and 0 when reset. */
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync uint32_t volatile fState;
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync /** The wait queue. */
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync wait_queue_head_t Head;
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync} RTSEMEVENTMULTIINTERNAL, *PRTSEMEVENTMULTIINTERNAL;
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRTDECL(int) RTSemEventMultiCreate(PRTSEMEVENTMULTI pEventMultiSem)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync{
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync PRTSEMEVENTMULTIINTERNAL pThis = (PRTSEMEVENTMULTIINTERNAL)RTMemAlloc(sizeof(*pThis));
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (pThis)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync {
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync pThis->u32Magic = RTSEMEVENTMULTI_MAGIC;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync pThis->fState = 0;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync init_waitqueue_head(&pThis->Head);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync *pEventMultiSem = pThis;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VINF_SUCCESS;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync }
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VERR_NO_MEMORY;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync}
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRT_EXPORT_SYMBOL(RTSemEventMultiCreate);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI EventMultiSem)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync{
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /*
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Validate input.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync PRTSEMEVENTMULTIINTERNAL pThis = (PRTSEMEVENTMULTIINTERNAL)EventMultiSem;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (!pThis)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VERR_INVALID_PARAMETER;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertPtrReturn(pThis, VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertMsgReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, ("%p u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /*
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Invalidate it and signal the object just in case.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync ASMAtomicIncU32(&pThis->u32Magic);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync ASMAtomicXchgU32(&pThis->fState, 0);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync Assert(!waitqueue_active(&pThis->Head));
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync wake_up_all(&pThis->Head);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync RTMemFree(pThis);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VINF_SUCCESS;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync}
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRT_EXPORT_SYMBOL(RTSemEventMultiDestroy);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI EventMultiSem)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync{
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /*
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Validate input.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync PRTSEMEVENTMULTIINTERNAL pThis = (PRTSEMEVENTMULTIINTERNAL)EventMultiSem;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (!pThis)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VERR_INVALID_PARAMETER;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertPtrReturn(pThis, VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertMsgReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, ("%p u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /*
bec4d1c0274e4712fe01426313aab120b5ad1c17vboxsync * Signal the event object.
51ef69064b4ea4d571ed129ab883b0c08967c901vboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync ASMAtomicXchgU32(&pThis->fState, 1);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync wake_up_all(&pThis->Head);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VINF_SUCCESS;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync}
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRT_EXPORT_SYMBOL(RTSemEventMultiSignal);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI EventMultiSem)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync{
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /*
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Validate input.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync PRTSEMEVENTMULTIINTERNAL pThis = (PRTSEMEVENTMULTIINTERNAL)EventMultiSem;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (!pThis)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VERR_INVALID_PARAMETER;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertPtrReturn(pThis, VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertMsgReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, ("%p u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /*
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Reset it.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync ASMAtomicXchgU32(&pThis->fState, 0);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VINF_SUCCESS;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync}
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRT_EXPORT_SYMBOL(RTSemEventMultiReset);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync/**
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Worker for RTSemEventMulti and RTSemEventMultiNoResume.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync *
c6383709c15c809f8cfb09b5cfe670760f06e2b9vboxsync * @returns VBox status code.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * @param pThis The event semaphore.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * @param cMillies The number of milliseconds to wait.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * @param fInterruptible Whether it's an interruptible wait or not.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncstatic int rtSemEventMultiWait(PRTSEMEVENTMULTIINTERNAL pThis, unsigned cMillies, bool fInterruptible)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync{
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /*
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync * Ok wait for it.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync DEFINE_WAIT(Wait);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync int rc = VINF_SUCCESS;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync long lTimeout = cMillies == RT_INDEFINITE_WAIT ? MAX_SCHEDULE_TIMEOUT : msecs_to_jiffies(cMillies);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#ifdef IPRT_DEBUG_SEMS
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync snprintf(current->comm, TASK_COMM_LEN, "E%lx", IPRT_DEBUG_SEMS_ADDRESS(pThis));
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#endif
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync for (;;)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync {
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /* make everything thru schedule() atomic scheduling wise. */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync prepare_to_wait(&pThis->Head, &Wait, fInterruptible ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /* check the condition. */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (pThis->fState)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync break;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /* check for pending signals. */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (fInterruptible && signal_pending(current))
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync {
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync rc = VERR_INTERRUPTED;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync break;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync }
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /* wait */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync lTimeout = schedule_timeout(lTimeout);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync after_wait(&Wait);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /* Check if someone destroyed the semaphore while we were waiting. */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (pThis->u32Magic != RTSEMEVENTMULTI_MAGIC)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync {
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync rc = VERR_SEM_DESTROYED;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync break;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync }
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync /* check for timeout. */
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (!lTimeout)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync {
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync rc = VERR_TIMEOUT;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync break;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync }
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync }
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync finish_wait(&pThis->Head, &Wait);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#ifdef IPRT_DEBUG_SEMS
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync snprintf(current->comm, TASK_COMM_LEN, "E%lx:%d", IPRT_DEBUG_SEMS_ADDRESS(pThis), rc);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync#endif
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return rc;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync}
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRTDECL(int) RTSemEventMultiWait(RTSEMEVENTMULTI EventMultiSem, unsigned cMillies)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync{
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync PRTSEMEVENTMULTIINTERNAL pThis = (PRTSEMEVENTMULTIINTERNAL)EventMultiSem;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (!pThis)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VERR_INVALID_PARAMETER;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertPtrReturn(pThis, VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertMsgReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, ("%p u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (pThis->fState)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VINF_SUCCESS;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return rtSemEventMultiWait(pThis, cMillies, false /* fInterruptible */);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync}
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRT_EXPORT_SYMBOL(RTSemEventMultiWait);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRTDECL(int) RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI EventMultiSem, unsigned cMillies)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync{
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync PRTSEMEVENTMULTIINTERNAL pThis = (PRTSEMEVENTMULTIINTERNAL)EventMultiSem;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (!pThis)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VERR_INVALID_PARAMETER;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertPtrReturn(pThis, VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync AssertMsgReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, ("%p u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_PARAMETER);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync if (pThis->fState)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return VINF_SUCCESS;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync return rtSemEventMultiWait(pThis, cMillies, true /* fInterruptible */);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync}
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncRT_EXPORT_SYMBOL(RTSemEventMultiWaitNoResume);
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync