1 /* === S I N F G =========================================================== */
3 ** \brief Template Header
5 ** $Id: mutex.h,v 1.2 2005/01/10 07:40:26 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SINFG_MUTEX_H
25 #define __SINFG_MUTEX_H
27 /* === H E A D E R S ======================================================= */
29 /* === M A C R O S ========================================================= */
31 /* === T Y P E D E F S ===================================================== */
33 /* === C L A S S E S & S T R U C T S ======================================= */
41 friend class RecMutex;
52 Lock(Mutex& x):mutex(x) { mutex.lock(); }
53 ~Lock() { mutex.unlock(); }
69 void operator=(const Mutex&);
72 class RecMutex : public Mutex
90 ReaderLock(RWLock& x):rw_lock(x) { rw_lock.reader_lock(); }
91 ~ReaderLock() { rw_lock.reader_unlock(); }
97 WriterLock(RWLock& x):rw_lock(x) { rw_lock.writer_lock(); }
98 ~WriterLock() { rw_lock.writer_unlock(); }
105 void reader_unlock();
106 bool reader_trylock();
109 void writer_unlock();
110 bool writer_trylock();
113 }; // END of namespace sinfg
115 /* === E N D =============================================================== */