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 */ 00039 #ifndef RC_MUTEX_ACCESSOR_H_ 00040 #define RC_MUTEX_ACCESSOR_H_ 00041 00042 #include "ReChannel/communication/accessors/rc_accessor.h" 00043 00044 namespace ReChannel { 00045 00049 template<> 00050 class rc_fallback_interface<sc_mutex_if> 00051 : virtual public sc_mutex_if 00052 { 00053 public: 00054 virtual int lock() 00055 { 00056 SC_REPORT_WARNING(RC_ID_UNDEFINED_BLOCKING_ACCESS_WARNING_, 0); 00057 ::sc_core::wait(p_undef); 00058 return 0; 00059 } 00060 virtual int trylock() 00061 { return -1; } 00062 virtual int unlock() 00063 { return -1; } 00064 private: 00065 sc_event p_undef; 00066 }; 00067 00071 RC_ACCESSOR(sc_mutex_if) 00072 { 00073 RC_ACCESSOR_CTOR(sc_mutex_if) { } 00074 00075 virtual int lock() 00076 { 00077 return this->rc_forward(&if_type::lock); 00078 } 00079 virtual int trylock() 00080 { 00081 return this->rc_nb_forward(&if_type::trylock); 00082 } 00083 virtual int unlock() 00084 { 00085 return this->rc_nb_forward(&if_type::unlock); 00086 } 00087 }; 00088 00089 } // namespace ReChannel 00090 00091 #endif // RC_MUTEX_ACCESSOR_H_ 00092 // 00093 // $Id: rc_mutex_accessor.h,v 1.7 2007/11/23 13:25:45 felke Exp $ 00094 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/communication/accessors/rc_mutex_accessor.h,v $ 00095 // 00096