|
powerd++
0.4.4
|
A wrapper around the pidfile_* family of commands implementing the RAII pattern. More...
#include <pidfile.hpp>
Public Member Functions | |
| Pidfile (char const *const pfname, mode_t const mode) | |
| Attempts to open the pidfile. More... | |
| ~Pidfile () | |
| Removes the pidfile. | |
| pid_t | other () |
| Returns the PID of the other process holding the lock. | |
| void | write () |
| Write PID to the file, should be called after daemon(). More... | |
Private Attributes | |
| pid_t | otherpid |
| In case of failure to acquire the lock, the PID of the other process holding it is stored here. | |
| pidfh * | pfh |
| Pointer to the pidfile state data structure. More... | |
A wrapper around the pidfile_* family of commands implementing the RAII pattern.
|
inline |
Attempts to open the pidfile.
| pfname,mode | Arguments to pidfile_open() |
| pid_t | Throws the PID of the other process already holding the requested pidfile |
| sys::sc_error<error> | Throws with the errno of pidfile_open() |
|
inline |
Write PID to the file, should be called after daemon().
| sys::sc_error<error> | Throws with the errno of pidfile_write() |
|
private |
Pointer to the pidfile state data structure.
Thus is allocated by pidfile_open() and assumedly freed by pidfile_remove().
1.8.17