Kyoto Cabinet
Public Types | Public Member Functions | Friends
kyotocabinet::Mutex Class Reference

Basic mutual exclusion device. More...

#include <kcthread.h>

List of all members.

Public Types

enum  Type { FAST, ERRORCHECK, RECURSIVE }
 Type of the behavior for double locking. More...

Public Member Functions

 Mutex ()
 Default constructor.
 Mutex (Type type)
 Constructor.
 ~Mutex ()
 Destructor.
void lock ()
 Get the lock.
bool lock_try ()
 Try to get the lock.
bool lock_try (double sec)
 Try to get the lock.
void unlock ()
 Release the lock.

Friends

class CondVar

Detailed Description

Basic mutual exclusion device.


Member Enumeration Documentation

Type of the behavior for double locking.

Enumerator:
FAST 

no operation

ERRORCHECK 

check error

RECURSIVE 

allow recursive locking


Constructor & Destructor Documentation

Default constructor.

kyotocabinet::Mutex::Mutex ( Type  type) [explicit]

Constructor.

Parameters:
typethe behavior for double locking.

Destructor.


Member Function Documentation

Get the lock.

Try to get the lock.

Returns:
true on success, or false on failure.
bool kyotocabinet::Mutex::lock_try ( double  sec)

Try to get the lock.

Parameters:
secthe interval of the suspension in seconds.
Returns:
true on success, or false on failure.

Release the lock.