00001 #ifndef SINGLETON_APPLICATION_CLASS 00002 #define SINGLETON_APPLICATION_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : singleton_application * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 2006-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00019 00026 #include "opsysdll.h" 00027 00028 #include <basis/istring.h> 00029 #include <basis/object_base.h> 00030 00031 // forward. 00032 class rendezvous; 00033 00034 class OPSYSTEM_CLASS_STYLE singleton_application 00035 { 00036 public: 00037 singleton_application(const istring &application_name, 00038 const istring &user_name = istring::empty_string()); 00040 00046 virtual ~singleton_application(); 00047 00048 IMPLEMENT_CLASS_NAME("singleton_application"); 00049 00050 bool allow_this_instance(); 00052 00055 bool already_running() { return !allow_this_instance(); } 00057 00059 private: 00060 rendezvous *_app_lock; 00061 bool _got_lock; 00062 }; 00063 00064 #endif 00065
1.5.1