wvdbusserver: implement NameHasOwner request.
[wvstreams.git] / include / wvlockdev.h
blob0563f90b97e1a824e35571bf8461d5be96ec0f89
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * Some handy functions to create/remove /var/lock lockfiles.
6 */
7 #ifndef __WVLOCKDEV_H
8 #define __WVLOCKDEV_H
10 #include "wvstring.h"
12 /**
13 * Class to handle Lock files - useful for WvDial and other places where we
14 * need to guarantee exclusive access to a file or device. Creates/Removes
15 * lockfiles in /var/lock.
17 class WvLockDev
19 WvString devicename, filename;
20 int lock_count;
21 public:
22 WvLockDev(WvString _devicename);
23 ~WvLockDev();
25 bool lock();
26 void unlock();
27 bool islocked() const
28 { return lock_count != 0; }
31 #endif // __WVLOCKDEV_H