rc_mutex.h

Go to the documentation of this file.
00001 // vim:set et sts=4 ts=4 tw=75 sw=4 ai ci cin cino=g0,t0:
00002 /*
00003  * Copyright (C) 2007, Technical Computer Science Group,
00004  *                     University of Bonn
00005  *
00006  * This file is part of the ReChannel library.
00007  *
00008  * The ReChannel library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be
00014  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this library; see the file COPYING. If not, write to the
00020  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022  *
00023  * Authors: Andreas Raabe and Armin Felke. Implementation by Armin Felke.
00024  *          {raabe, felke}@cs.uni-bonn.de
00025  */
00037 #ifndef RC_MUTEX_H_
00038 #define RC_MUTEX_H_
00039 
00040 #include "ReChannel/components/rc_prim_channel.h"
00041 
00042 namespace ReChannel {
00043 
00047 class rc_mutex
00048     : public sc_mutex_if,
00049       public rc_prim_channel
00050 {
00051 public:
00052 
00053     rc_mutex();
00054 
00055     explicit rc_mutex(const char* name_);
00056 
00057     inline virtual const char* kind() const
00058         { return "rc_mutex"; }
00059 
00060     virtual int lock();
00061 
00062     virtual int trylock();
00063 
00064     virtual int unlock();
00065 
00066 protected:
00067 
00068     virtual void rc_on_reset();    
00069 
00070     inline bool is_locked() const
00071         { return m_lock_owner.valid(); }
00072 
00073 protected:
00074 
00075     sc_process_handle m_lock_owner;
00076     sc_event          m_free;
00077 
00078 private:
00079     // disabled
00080     rc_mutex(const rc_mutex& other);
00081     rc_mutex& operator=(const rc_mutex& other);
00082 };
00083 
00084 } // namespace ReChannel
00085 
00086 #endif //RC_MUTEX_H_
00087 
00088 //
00089 // $Id: rc_mutex.h,v 1.4 2007/11/23 13:24:55 felke Exp $
00090 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/components/rc_mutex.h,v $
00091 //
00092 

Generated on Tue Jan 1 23:13:38 2008 for ReChannel by  doxygen 1.5.3