59 G_EXCEPTION( Error ,
"invalid pid file" ) ;
81 void init(
const Path & pid_file_path ) ;
116 void operator=(
const PidFile & ) = delete ;
117 void operator=(
PidFile && ) = delete ;
120 static void create(
const Path & pid_file ) ;
126 bool m_committed{
false} ;
A Path object represents a file system path.
A class for creating pid files.
bool committed() const
Returns true if commit() has been called with a valid path().
void commit()
Creates the file and installs signal handlers to cleanup() the file on abnormal process termination.
PidFile()
Default constructor.
void check()
Throws an exception if the path is not absolute.
~PidFile()
Destructor. Calls cleanup() to delete the file.
Path path() const
Returns the path as supplied to the constructor or init().
static bool cleanup(SignalSafe, const char *path) noexcept
Deletes the specified pid file if it contains this process's id.
void init(const Path &pid_file_path)
Used after default construction to make the object active.
An empty structure that is used to indicate a signal-safe, reentrant implementation.