pdmcritsect.h revision 47d17ae46a566b971b80e7ddbc5beb0af026b586
af062818b47340eef15700d2f0211576ba3506eevboxsync/** @file
af062818b47340eef15700d2f0211576ba3506eevboxsync * PDM - Pluggable Device Manager, Critical Sections.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
af062818b47340eef15700d2f0211576ba3506eevboxsync * available from http://www.virtualbox.org. This file is free software;
af062818b47340eef15700d2f0211576ba3506eevboxsync * you can redistribute it and/or modify it under the terms of the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * General Public License (GPL) as published by the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
af062818b47340eef15700d2f0211576ba3506eevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
af062818b47340eef15700d2f0211576ba3506eevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * The contents of this file may alternatively be used under the terms
af062818b47340eef15700d2f0211576ba3506eevboxsync * of the Common Development and Distribution License Version 1.0
af062818b47340eef15700d2f0211576ba3506eevboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * VirtualBox OSE distribution, in which case the provisions of the
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * CDDL are applicable instead of those of the GPL.
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync *
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * You may elect to license modified versions of this file under the
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * terms and conditions of either the GPL or the CDDL or both.
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync *
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * additional information or have any questions.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef ___VBox_pdmcritsect_h
af062818b47340eef15700d2f0211576ba3506eevboxsync#define ___VBox_pdmcritsect_h
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/types.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <iprt/critsect.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync__BEGIN_DECLS
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/** @defgroup grp_pdm_critsect The PDM Critical Section
af062818b47340eef15700d2f0211576ba3506eevboxsync * @ingroup grp_pdm
af062818b47340eef15700d2f0211576ba3506eevboxsync * @{
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/**
af062818b47340eef15700d2f0211576ba3506eevboxsync * A PDM critical section.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Initialize using PDMDRVHLP::pfnCritSectInit().
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef union PDMCRITSECT
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Padding. */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t padding[HC_ARCH_BITS == 64 ? 0xb8 : 0x88];
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef PDMCRITSECTINT_DECLARED
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The internal structure (not normally visible). */
af062818b47340eef15700d2f0211576ba3506eevboxsync struct PDMCRITSECTINT s;
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync} PDMCRITSECT;
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Pointer to a PDM critical section. */
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef PDMCRITSECT *PPDMCRITSECT;
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Pointer to a const PDM critical section. */
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef const PDMCRITSECT *PCPDMCRITSECT;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMR3DECL(int) PDMR3CritSectInit(PVM pVM, PPDMCRITSECT pCritSect, const char *pszName);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMDECL(int) PDMCritSectEnter(PPDMCRITSECT pCritSect, int rcBusy);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMR3DECL(int) PDMR3CritSectEnterEx(PPDMCRITSECT pCritSect, bool fCallHost);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMDECL(void) PDMCritSectLeave(PPDMCRITSECT pCritSect);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMDECL(bool) PDMCritSectIsOwner(PCPDMCRITSECT pCritSect);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMDECL(bool) PDMCritSectIsInitialized(PCPDMCRITSECT pCritSect);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMR3DECL(int) PDMR3CritSectTryEnter(PPDMCRITSECT pCritSect);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMR3DECL(int) PDMR3CritSectScheduleExitEvent(PPDMCRITSECT pCritSect, RTSEMEVENT EventToSignal);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMR3DECL(int) PDMR3CritSectDelete(PPDMCRITSECT pCritSect);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMDECL(int) PDMR3CritSectTerm(PVM pVM);
af062818b47340eef15700d2f0211576ba3506eevboxsyncPDMR3DECL(void) PDMR3CritSectFF(PVM pVM);
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/** @} */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync__END_DECLS
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync