Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvlockfile.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 * A simple lockfile class using WvStreams. 00006 */ 00007 00008 #ifndef __WVLOCKFILE_H 00009 #define __WVLOCKFILE_H 00010 00011 #include "wvfile.h" 00012 00013 00014 class WvLockFile 00015 { 00016 public: 00017 WvLockFile(WvStringParm _lockname); 00018 00019 /** Check to make sure no lock is established or that it's owned by us. */ 00020 bool isok(); 00021 00022 /** Creates the lockfile with the current pid. Returns success/failure. */ 00023 bool lock(); 00024 00025 /** 00026 * Removes the lockfile if present. If there's no lockfile after, 00027 * returns true, otherwise false. 00028 */ 00029 bool unlock(); 00030 00031 /** 00032 * Returns one of three things: 00033 * -1 if the lockfile exists, but is inaccessible. 00034 * 0 if there is no lockfile, or the process is not running. 00035 * >0 The pid of the known-running process that owns the lock. 00036 */ 00037 pid_t readpid(); 00038 00039 protected: 00040 WvString lockname; 00041 }; 00042 00043 #endif // __WVLOCKFILE_H

Generated on Tue Oct 5 01:09:20 2004 for WvStreams by doxygen 1.3.7