00001 /* 00002 * @(#)LocalMonitor.h 0.2.0 / 2007-09-17 00003 * 00004 * Copyright (c) 2007, ETF and contributors. All rights reserved. 00005 * 00006 * This software is licensed under the LGPL, version 2.1, license. 00007 * A copy of the license is included in the file LICENSE-LGPL.txt. 00008 */ 00009 #ifndef LOCALMONITOR_H 00010 #define LOCALMONITOR_H 00011 00012 #include "JavaQxCommon.h" 00013 00014 /*^**************************************************************************^*/ 00015 /*- LocalMonitor Class. -*/ 00016 /*^**************************************************************************^*/ 00017 00024 class JAVAQX_EXPORT LocalMonitor 00025 { 00026 public: 00027 LocalMonitor(JNIEnv *env, jobject obj, jfieldID lockField = 0); 00028 virtual ~LocalMonitor(); 00029 private: 00030 LocalMonitor(const LocalMonitor &); 00031 public: 00032 bool enter(); 00033 bool exit(); 00034 public: 00035 inline bool isEntered() const; 00036 protected: 00037 JNIEnv *m_env; 00038 jobject m_obj; 00039 bool m_entered; 00040 }; 00041 00042 /*^**************************************************************************^*/ 00043 /*- LocalMonitor :: Public Inline Member Function. -*/ 00044 /*^**************************************************************************^*/ 00045 00051 inline bool LocalMonitor::isEntered() const 00052 { 00053 return m_entered; 00054 } 00055 00056 #endif //LOCALMONITOR_H 00057 00058 /*^***************************************************************************** 00059 File History: 00060 00061 - 2007-09-17 13:57:13 Slobodan 00062 Initial version 00063 00064 *****************************************************************************^*/