#include <feeserver/fee_lock.hh>
Public Types | |
enum | Return { Success, BadMutex, DeadLock, Busy, Denied } |
Public Member Functions | |
Mutex (const std::string &name="") | |
Mutex (const std::string &name, const Attributes &attr) | |
virtual | ~Mutex () |
Return | Lock () |
Return | TryLock () |
Return | Unlock () |
const std::string & | Name () const |
Protected Member Functions | |
Return | HandleReturn (const char *oper, int ret) const |
Protected Attributes | |
pthread_mutex_t | _mutex |
std::string | _name |
Friends | |
class | Condition |
Classes | |
class | Attributes |
FeeServer::Mutex::Mutex | ( | const std::string & | name = "" |
) |
Constructor
name | Name of the mutex |
FeeServer::Mutex::Mutex | ( | const std::string & | name, | |
const Attributes & | attr | |||
) |
Constructor
name | Name of the mutex | |
attr | Attributes |
FeeServer::Mutex::~Mutex | ( | ) | [virtual] |
Destructor
FeeServer::Mutex::Return FeeServer::Mutex::Lock | ( | ) |
Lock the mutex. Can dead-lock calling thread if type is Fast, and the thread has already locked the mutex. If type is recursive, one must unlock the mutex as many times as it has been locked by a thread. The error checking will fail.
FeeServer::Mutex::Return FeeServer::Mutex::TryLock | ( | ) |
Lock the mutex.
FeeServer::Mutex::Return FeeServer::Mutex::Unlock | ( | ) |
Unlock the mutex.
const std::string& FeeServer::Mutex::Name | ( | ) | const [inline] |
Get the name of the mutex
FeeServer::Mutex::Return FeeServer::Mutex::HandleReturn | ( | const char * | oper, | |
int | ret | |||
) | const [protected] |
Translate return values to our enum
friend class Condition [friend] |
Conditions are firends
pthread_mutex_t FeeServer::Mutex::_mutex [protected] |
std::string FeeServer::Mutex::_name [protected] |
Name of mutex