G::PidFile Class Reference

A class for creating pid files. More...

#include <gpidfile.h>

List of all members.

Public Member Functions

 PidFile (const Path &pid_file_path)
 Constructor.
 PidFile ()
 Default constructor.
void init (const Path &pid_file_path)
 Used after default construction.
 ~PidFile ()
 Destructor.
void commit ()
 Creates the file.
void check ()
 Throws an exception if the path is not absolute.
Path path () const
 Returns the path as supplied to the constructor or init().

Static Public Member Functions

static void cleanup (SignalSafe, const char *path)
 Deletes the specified pid file if it contains this process's id.


Detailed Description

A class for creating pid files.

See also:
G::Daemon

Definition at line 42 of file gpidfile.h.


Constructor & Destructor Documentation

G::PidFile::PidFile ( const Path pid_file_path  )  [explicit]

Constructor.

The path should normally be an absolute path. Use commit() to actually create the file.

Definition at line 41 of file gpidfile.cpp.

G::PidFile::PidFile (  ) 

Default constructor.

Constructs a do-nothing object. Initialise with init().

Definition at line 31 of file gpidfile.cpp.

G::PidFile::~PidFile (  ) 

Destructor.

Calls cleanup() to delete the file.

Definition at line 35 of file gpidfile.cpp.

References cleanup(), and G::Path::str().


Member Function Documentation

void G::PidFile::cleanup ( SignalSafe  safe,
const char *  path 
) [static]

Deletes the specified pid file if it contains this process's id.

Signal-safe, reentrant implementation.

Definition at line 75 of file gpidfile.cpp.

References G::Root::start(), and G::Root::stop().

Referenced by ~PidFile().

void G::PidFile::init ( const Path pid_file_path  ) 

Used after default construction.

Definition at line 46 of file gpidfile.cpp.

void G::PidFile::commit (  ) 

Creates the file.

Definition at line 98 of file gpidfile.cpp.

void G::PidFile::check (  ) 

Throws an exception if the path is not absolute.

Definition at line 92 of file gpidfile.cpp.

References G::Path::isAbsolute(), and G::Path::str().

Referenced by G::Daemon::detach().

G::Path G::PidFile::path (  )  const

Returns the path as supplied to the constructor or init().

Definition at line 104 of file gpidfile.cpp.


The documentation for this class was generated from the following files:

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5