oaSemaphore.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // *****************************************************************************
00003 // oaSemaphore.h
00004 //
00005 // This file contains the definitions for the oaSemaphore class.
00006 //
00007 // oaSemaphore:
00008 //  The class represent the rights to an inter-process mutex.  Having the
00009 //  mutex object successfully constructed means you have the rights to the
00010 //  mutex.  The right of the mutex is not release until the object is destroyed.
00011 //
00012 // *****************************************************************************
00013 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00014 // Integration Initiative, this material may not be copied, modified,
00015 // re-published, uploaded, executed, or distributed in any way, in any medium,
00016 // in whole or in part, without prior written permission from Cadence.
00017 //
00018 //                Copyright 2003-2005 Cadence Design Systems, Inc.
00019 //                           All Rights Reserved.
00020 //
00021 //  $Author: icftcm $
00022 //  $Revision: #1 $
00023 //  $Date: 2010/08/09 $
00024 //  $State: Exp $
00025 // *****************************************************************************
00026 // *****************************************************************************
00027 
00028 
00029 
00030 #if !defined(oaSemaphore_P)
00031 #define oaSemaphore_P
00032 
00033 
00034 
00035 // *****************************************************************************
00036 // Nested includes
00037 // *****************************************************************************
00038 #include "oaBaseTypes.h"
00039 
00040 #if defined(OA_WINDOWS)
00041 #include <WinSock2.h>
00042 #include <Windows.h>
00043 #else
00044 #include <dlfcn.h>
00045 #endif
00046 #if defined(HPUX)
00047 #include <dl.h>
00048 #endif
00049 
00050 
00051 
00052 // *****************************************************************************
00053 // Declare and define types in the OpenAccess namespace.
00054 // *****************************************************************************
00055 BEGIN_OA_NAMESPACE
00056 
00057 
00058 
00059 #if !defined(OA_WINDOWS)
00060 typedef oaInt4              HANDLE;
00061 #endif
00062 
00063 
00064 
00065 // *****************************************************************************
00066 // oaSemaphore
00067 // *****************************************************************************
00068 class OA_BASE_DLL_API oaSemaphore {
00069 public:
00070     oaSemaphore(oaUInt4 key);
00071     ~oaSemaphore();
00072 
00073     oaBoolean               acquire(oaBoolean noWait = true);
00074     void                    release();
00075     oaBoolean               isAcquired();
00076 
00077 private:
00078     oaUInt4                 key;
00079     HANDLE                  handle;
00080     oaBoolean               acquired;
00081 };
00082 
00083 
00084 
00085 END_OA_NAMESPACE
00086 
00087 #endif

Return to top of page