Zero  0.1.0
Macros | Functions | Variables
lock_lil.cpp File Reference
#include "sm_base.h"
#include "lock_lil.h"
#include "xct.h"
#include <sys/time.h>

Macros

#define SM_SOURCE
 

Functions

bool does_already_own (lil_lock_modes_t mode, const bool *lock_taken)
 
bool has_any_lock (const bool *lock_taken, bool read_lock_only=false)
 
void clear_lock_flags (bool *lock_taken, bool read_lock_only)
 

Variables

const int INTENT_LOCK_TIMEOUT_MICROSEC = 10000
 
const int ABSOLUTE_LOCK_TIMEOUT_MICROSEC = 100000
 
const clockid_t CLOCK_FOR_LIL = CLOCK_REALTIME
 

Macro Definition Documentation

§ SM_SOURCE

#define SM_SOURCE

Function Documentation

§ clear_lock_flags()

void clear_lock_flags ( bool *  lock_taken,
bool  read_lock_only 
)
inline

§ does_already_own()

bool does_already_own ( lil_lock_modes_t  mode,
const bool *  lock_taken 
)

do we already have a desired lock?

§ has_any_lock()

bool has_any_lock ( const bool *  lock_taken,
bool  read_lock_only = false 
)
inline

do we already have some lock? if we already have some intent lock and trying to upgrade it, encountering a blocking means that there is a chance of deadlock. thus, we should immediately give up although this might be too conservative. anways, it's a rare case.

Variable Documentation

§ ABSOLUTE_LOCK_TIMEOUT_MICROSEC

const int ABSOLUTE_LOCK_TIMEOUT_MICROSEC = 100000

For absolute lock requests. Longer than intent locks to avoid starvation of absolute lock requests.

§ CLOCK_FOR_LIL

const clockid_t CLOCK_FOR_LIL = CLOCK_REALTIME

§ INTENT_LOCK_TIMEOUT_MICROSEC

const int INTENT_LOCK_TIMEOUT_MICROSEC = 10000

maximum time to wait after failed lock acquisition for intent locks. if timeout happens, the xct is rolled back to prevent deadlocks.