ui-utilcpp
1.8.5
|
Mutex For BSD Advisory File Locking. More...
#include <File.hpp>
Public Member Functions | |
BSDFileMutex (std::string const &lockFile) | |
Constructor from file name. More... | |
BSDFileMutex (int fd) | |
Constructor from file descriptor. More... | |
Standard mutex methods. | |
bool | tryEnterMutex () throw () |
void | enterMutex () |
void | leaveMutex () |
![]() | |
File (std::string const &name, int flags=O_CREAT|O_WRONLY, mode_t mode=S_IRUSR|S_IWUSR, bool closeFd=true) | |
Constructor. More... | |
File (int fd, bool closeFd=false) | |
Constructor from file descriptor. More... | |
std::string const & | getName () const |
Get file name. This will always deliver en empty string if constructed from fd. | |
![]() | |
FileDescriptor (int fd=-1, bool closeFd=false) | |
Constructor from file descriptor. More... | |
virtual | ~FileDescriptor () |
Destructor. More... | |
virtual std::streamsize | read (void *const buf, std::streamsize count) |
C++ like virtual read method. More... | |
virtual std::streamsize | write (void const *const buf, std::streamsize count) |
C++ like virtual erite method. More... | |
int | getFd () const |
Get file descriptor. | |
Additional Inherited Members | |
![]() | |
enum | ErrorCode { OpenErr_ = 1, ReadErr_, WriteErr_, LockErr_, UnlockErr_, BindErr_, ConnectErr_, UnblockErr_, ListenErr_, ShutdownErr_ } |
Error codes for exceptions. | |
typedef CodeException< ErrorCode > | Exception |
Exceptions for this class. | |
![]() | |
static void | fdClose (int const &fd, std::string const &id, bool const &doClose=true) |
Helper to close file descriptors from destructors. | |
![]() | |
void | init (int fd, bool closeFd=false) |
To be called in a constructor. | |
![]() | |
int | fd_ |
The file descriptor that is managed. | |
Mutex For BSD Advisory File Locking.
UI::Util::BSDFileMutex::BSDFileMutex | ( | std::string const & | lockFile | ) |
UI::Util::BSDFileMutex::BSDFileMutex | ( | int | fd | ) |
Constructor from file descriptor.
fd | Opened file descriptor |
References UI::Util::FileDescriptor::fd_, and UI_THROW.