13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync/* $Id$ */
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync/** @file
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * IPRT - RTSemEventWait, implementation based on RTSemEventWaitEx.
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync */
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2010-2011 Oracle Corporation
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync *
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * available from http://www.virtualbox.org. This file is free software;
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * General Public License (GPL) as published by the Free Software
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync *
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * The contents of this file may alternatively be used under the terms
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * of the Common Development and Distribution License Version 1.0
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * VirtualBox OSE distribution, in which case the provisions of the
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * CDDL are applicable instead of those of the GPL.
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync *
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * You may elect to license modified versions of this file under the
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync * terms and conditions of either the GPL or the CDDL or both.
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync */
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync/*******************************************************************************
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync* Header Files *
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync*******************************************************************************/
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync#define LOG_GROUP RTLOGGROUP_SEM
715e49c31b15c23c17a9ce3be42a75e7c48d4b78vboxsync#define RTSEMEVENT_WITHOUT_REMAPPING
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync#include <iprt/semaphore.h>
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync#include "internal/iprt.h"
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync#include <iprt/err.h>
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync#include <iprt/assert.h>
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsyncRTDECL(int) RTSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies)
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync{
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync int rc;
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync if (cMillies == RT_INDEFINITE_WAIT)
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync rc = RTSemEventWaitEx(hEventSem, RTSEMWAIT_FLAGS_RESUME | RTSEMWAIT_FLAGS_INDEFINITE, 0);
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync else
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync rc = RTSemEventWaitEx(hEventSem,
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync RTSEMWAIT_FLAGS_RESUME | RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS,
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync cMillies);
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync Assert(rc != VERR_INTERRUPTED);
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync return rc;
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync}
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsyncRT_EXPORT_SYMBOL(RTSemEventWait);
13084a2a22e3932289d44c5acc8ab1808d089cf9vboxsync