semevent-r0drv-solaris.c revision 56665b35e85d3cd7d4232957d09b488ab44d81cf
/* $Id$ */
/** @file
* innotek Portable Runtime - Semaphores, Ring-0 Driver, Solaris.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "the-solaris-kernel.h"
#include <time.h>
#include <iprt/semaphore.h>
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* Solaris event semaphore.
*/
typedef struct RTSEMEVENTINTERNAL
{
/** Magic value (RTSEMEVENT_MAGIC). */
/** The number of waiting threads. */
/** Set if the event object is signaled. */
/** The number of threads in the process of waking up. */
/** The Solaris mutex protecting this structure and pairing up the with the cv. */
/** The Solaris condition variable. */
{
Assert(sizeof(RTSEMEVENTINTERNAL) > sizeof(void *));
if (pEventInt)
{
return VINF_SUCCESS;
}
return VERR_NO_MEMORY;
}
{
if (EventSem == NIL_RTSEMEVENT)
return VERR_INVALID_HANDLE;
{
/* abort waiting thread, last man cleans up. */
}
{
/* the last waking thread is gonna do the cleanup */
}
else
{
}
return VINF_SUCCESS;
}
{
{
}
else
return VINF_SUCCESS;
}
{
int rc;
{
rc = VINF_SUCCESS;
}
else
{
/*
* Translate milliseconds into ticks and go to sleep.
*/
if (cMillies != RT_INDEFINITE_WAIT)
{
if (fInterruptible)
else
}
else
{
if (fInterruptible)
else
{
rc = 1;
}
}
if (rc > 0)
{
/* Retured due to call to cv_signal() or cv_broadcast() */
{
{
return rc;
}
}
rc = VINF_SUCCESS;
}
else if (rc == -1)
{
/* Returned due to timeout being reached */
rc = VERR_TIMEOUT;
}
else
{
/* Returned due to pending signal */
}
}
return rc;
}
{
}
{
}