20 using namespace basis;
26 singleton_application::singleton_application(
const astring &application_name,
45 {
return c_initial_try > 0; }
57 if (_got_lock)
return true;
60 _got_lock = _app_lock->
lock(rendezvous::IMMEDIATE_RETURN);
61 if (_got_lock) c_initial_try = 1;
62 else c_initial_try = 2;
bool allow_this_instance()
the application must check this before starting up.
void release_lock()
let's go of the application lock, if we had previously gotten it.
bool already_running()
returns false if this program is not already running.
bool already_tried() const
returns true if the singleton has already tried to lock.
virtual ~singleton_application()
Provides a dynamically resizable ASCII character string.
Provides operations commonly needed on file names.
An inter-process synchronization primitive.
bool lock(locking_methods how=ENDLESS_WAIT)
grab the lock, if possible.
void unlock()
releases a previously acquired lock.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
A platform independent way to obtain the timestamp of a file.