- Main Page
- Classes
- Files

- Search for |

# lockwrap.h

    00001 /*****************************
    00002 File:      lockwrap.h
    00003 Language:   C++ (header)
    00004 Project:    H3DNetworkingUtils
    00005 The contents of this file are subject to the Mozilla Public License
    00006 Version 1.1 (the "License"); you may not use this file except in
    00007 compliance with the License. You may obtain a copy of the License at
    00008 http://www.mozilla.org/MPL/
    00009
    00010 Software distributed under the License is distributed on an "AS IS"
    00011 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    00012 License for the specific language governing rights and limitations
    00013 under the License.
    00014
    00015 The Original Code is H3DNetworkingUtils v1.0.
    00016
    00017 The Initial Developer of the Original Code is CSIRO.
    00018 Portions created by the Initial Developer are Copyright (C) 1009 CSIRO. All Rights Reserved.
    00019 Contributor(s):
    00020    Samuel Taylor, (sam.taylor@anu.edu.au)
    00021    Chris Gunn  <Chris.Gunn@csiro.au> <ChrisJGunn@gmail.com>
    00022 ***************************/
    00023
    00024 // The lockwrap class provides a OO wrapper around Mutex locks.
    00025
    00026 #ifndef _lockwrap_
    00027 #define _lockwrap_
    00028
    00029 #include "H3DNetworkingUtils/Config.h"
    00030
    00031 class H3D_NETWORKING_UTILS_DLL_SPEC  Mutex {
    00032   protected:
    00033     void * sysMutex;
    00034
    00035   public:
    00036     Mutex ();
    00037     virtual ~Mutex ();
    00038
    00039     void * sysRef () { return sysMutex; }
    00040
    00041     virtual void lock ();
    00042     virtual void unlock ();
    00043
    00044     //virtual bool  tryLock ();
    00045     virtual int  tryLock ();
    00046     // Returns true if successful
    00047 };
    00048
    00049 class H3D_NETWORKING_UTILS_DLL_SPEC  Semaphore {
    00050   protected:
    00051     void * sysSemaphore;
    00052
    00053   public:
    00054     Semaphore (int count);
    00055     virtual ~Semaphore ();
    00056
    00057     void * sysRef () { return sysSemaphore; }
    00058
    00059     virtual void signal ();
    00060     virtual void wait ();
    00061     //virtual bool  tryWait ();
    00062     virtual int  tryWait ();
    00063 };
    00064
    00065 #endif