• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Types | Public Member Functions | List of all members
TDELockFile Class Reference

#include <klockfile.h>

Inheritance diagram for TDELockFile:
TDEShared

Public Types

enum  LockResult { LockOK = 0 , LockFail , LockError , LockStale }
 
enum  LockOptions { LockNoBlock = 1 , LockForce = 2 }
 
typedef TDESharedPtr< TDELockFile > Ptr
 

Public Member Functions

 TDELockFile (const TQString &file)
 
 ~TDELockFile ()
 
LockResult lock (int options=0)
 
bool isLocked () const
 
void unlock ()
 
int staleTime () const
 
void setStaleTime (int _staleTime)
 
bool getLockInfo (int &pid, TQString &hostname, TQString &appname)
 
- Public Member Functions inherited from TDEShared
 TDEShared ()
 
 TDEShared (const TDEShared &)
 
TDEShared & operator= (const TDEShared &)
 
void _TDEShared_ref () const
 
void _TDEShared_unref () const
 
int _TDEShared_count () const
 

Detailed Description

The TDELockFile class provides NFS safe lockfiles.

Author
Waldo Bastian basti.nosp@m.an@k.nosp@m.de.or.nosp@m.g
Since
3.3

Definition at line 33 of file klockfile.h.

Member Typedef Documentation

◆ Ptr

typedef TDESharedPtr<TDELockFile> TDELockFile::Ptr

Definition at line 36 of file klockfile.h.

Member Enumeration Documentation

◆ LockOptions

enum TDELockFile::LockOptions
Enumerator
LockNoBlock 

Return immediately, do not wait for the lock to become available.

LockForce 

Automatically remove a lock when a lock is detected that is stale for more than staleTime() seconds.

Definition at line 70 of file klockfile.h.

◆ LockResult

enum TDELockFile::LockResult

Possible return values of the lock function.

Enumerator
LockOK 

Lock was acquired successfully.

LockFail 

The lock could not be acquired because it is held by another process.

LockError 

The lock could not be acquired due to an error.

LockStale 

A stale lock has been detected.

Definition at line 48 of file klockfile.h.

Constructor & Destructor Documentation

◆ TDELockFile()

TDELockFile::TDELockFile ( const TQString &  file)

Definition at line 65 of file klockfile.cpp.

◆ ~TDELockFile()

TDELockFile::~TDELockFile ( )

Destroys the object, releasing the lock if held.

Definition at line 75 of file klockfile.cpp.

Member Function Documentation

◆ getLockInfo()

bool TDELockFile::getLockInfo ( int &  pid,
TQString &  hostname,
TQString &  appname 
)

Returns the pid, hostname and appname of the process holding the lock after the lock functon has returned with LockStale.

Returns
false if the pid and hostname could not be determined

Definition at line 368 of file klockfile.cpp.

◆ isLocked()

bool TDELockFile::isLocked ( ) const

Returns whether the lock is held or not.

Definition at line 354 of file klockfile.cpp.

◆ lock()

TDELockFile::LockResult TDELockFile::lock ( int  options = 0)

Attempt to acquire the lock.

Parameters
optionsA set of LockOptions OR'ed together.

Definition at line 240 of file klockfile.cpp.

◆ setStaleTime()

void TDELockFile::setStaleTime ( int  _staleTime)

Set the time in seconds after which a lock is considered stale.

Definition at line 89 of file klockfile.cpp.

◆ staleTime()

int TDELockFile::staleTime ( ) const

Return the time in seconds after which a lock is considered stale The default is 30.

Definition at line 82 of file klockfile.cpp.

◆ unlock()

void TDELockFile::unlock ( )

Release the lock.

Definition at line 359 of file klockfile.cpp.


The documentation for this class was generated from the following files:
  • klockfile.h
  • klockfile.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.