00001 00002 // 00003 // YASA project, mutex support 00004 // 00005 // Project: Yasa 2 00006 // Author : Jan Blumenthal 00007 // Start : 2002/02/28 00008 // $Header: /sources/yasa/yasagui/mutex.h,v 1.4 2003/01/24 15:47:41 bj Exp $ 00009 // 00011 // 00012 // This program is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU General Public License as published by 00014 // the Free Software Foundation; either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU General Public License 00023 // along with this program (See the included file COPYING); 00024 // if not, write to the Free Software Foundation, Inc., 00025 // 675 Mass Ave, Cambridge, MA 02139, USA. 00026 // 00028 #ifndef YASAGUI_MUTEX_INCLUDE 00029 #define YASAGUI_MUTEX_INCLUDE 00030 00031 #include <yasagui/yasagui.h> 00032 #include <qobject.h> 00033 #include "list.h" 00034 #include "actionhandler.h" 00035 00036 00038 class YTaskSet; 00039 00042 class YMutex : public YObject 00043 { 00044 Q_OBJECT 00045 YASA_MUTEXPROTOCOL protocol; 00046 /*YASA_TIME priorityceiling; 00047 YASA_TIME preemptceiling;*/ 00048 public: YMutex(const YObjectArgs &i ); 00049 const YASA_MUTEXPROTOCOL & GetProtocol() const { return protocol; } 00050 YASA_PRIORITY GetPriorityCeiling() const; 00051 // YASA_TIME GetPriorityCeiling() const; 00052 // YASA_TIME GetPreemptCeiling() const { return preemptceiling; } 00053 void SetProtocol(int p) { protocol=p; } 00054 bool IsUsed() const; 00055 00056 virtual int SetConfig(YInputParser &parser); 00057 virtual int GetConfig(YOutputParser &parser); 00058 YTaskSet& GetTaskSet() const; 00059 }; 00060 00061 00063 class YMutexSet : public YSet 00064 { 00065 public: YMutexSet(); 00066 protected: 00067 virtual YObject* AllocNewItem(const YObjectArgs &args) { return new YMutex(args); } 00068 virtual YActions* GetItemActions() const 00069 { return YActionHandler::GetActions(YActionHandler::MUTEX_ACTIONS); } 00070 }; 00071 00072 00074 #endif // ifndef YASAGUI_MUTEX_INCLUDE