Home C-Bits Package Documentation Project Page

Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ResourceLock_PTHREAD.h

Go to the documentation of this file.
00001 /* ====================================================================
00002  *              The CBITS Software License, Version 1.0
00003  *
00004  *               Copyright (c) 2002-2003 Bruce Lowery
00005  *                       All rights reserved
00006  *
00007  * Redistribution and use of this software, in source and binary forms,
00008  * with or without modification, are permitted provided that the above
00009  * copyright notice, this paragraph, and the following paragraph are
00010  * retained in each source code file.
00011  *
00012  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00013  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00014  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00015  * DISCLAIMED.  IN NO EVENT SHALL BRUCE LOWERY OR OTHER CONTRIBUTORS
00016  * TO THE CBITS LIBRARY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00017  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00018  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00019  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00020  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00021  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00022  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00023  * SUCH DAMAGE.
00024  * ====================================================================
00025  */
00026 #ifndef __RESOURCE_LOCK_PTHREAD_H__
00027 #define __RESOURCE_LOCK_PTHREAD_H__
00028 
00029 
00030 #include <cbits/ResourceLock.h>
00031 #include <map>
00032 
00033 
00034 #ifdef USE_PTHREADS
00035 #include <pthread.h>
00036 #endif
00037 
00038 
00039 #ifdef BUILD_DLL
00040 #define EXPORT __declspec(dllexport)
00041 #else
00042 #define EXPORT
00043 #endif
00044 
00045 
00046 namespace cbits
00047 {
00048 
00053 class EXPORT ResourceLock_PTHREAD : public virtual ResourceLock
00054 {
00055 public:
00056     ResourceLock_PTHREAD();
00057     virtual ~ResourceLock_PTHREAD();
00058 
00059 protected:
00060 
00061     virtual const bool impl_lock_obj()     const;
00062     virtual const bool impl_unlock_obj()   const;
00063     virtual const long impl_get_threadid() const;
00064 
00065     virtual const bool impl_wait_for_event();
00066     virtual const bool impl_send_event();
00067 
00068 private:
00069 
00070 #ifdef USE_PTHREADS
00071     mutable pthread_mutex_t    _mutex;
00072     std::map<long,pthread_cond_t*> _tqueue;
00073 #endif
00074 };
00075 
00076 };
00077 
00078 #endif
00079 
00080 /*
00081  * $Id: ResourceLock_PTHREAD.h,v 1.6 2002/10/07 14:48:09 brulow Exp $
00082  *
00083  * History: (Add nothing manually below)
00084  * -----------------------------------------------------------------------
00085  *
00086  * $Log: ResourceLock_PTHREAD.h,v $
00087  * Revision 1.6  2002/10/07 14:48:09  brulow
00088  * Fix compile errors on SunOS::Forte
00089  *
00090  * Revision 1.5  2002/10/06 04:13:01  brulow
00091  * Add unit thread pkg unit tests and fix thread pkg bugs.
00092  *
00093  * Revision 1.4  2002/10/04 03:02:17  brulow
00094  * Fix 'undefined virtual table' problem in ResourceLock_XX classes
00095  *
00096  * Revision 1.3  2002/10/04 01:42:16  brulow
00097  * Remove 'virtual' inheritance
00098  *
00099  * Revision 1.2  2002/10/03 15:09:23  brulow
00100  * Add footer
00101  *
00102  *
00103  */
00104 

Generated by
doxygen
Hosted by
SourceForge