Zero  0.1.0
Classes | Macros | Typedefs | Functions
smthread.h File Reference
#include "w_defines.h"
#include <cassert>
#include "w.h"
#include "sm_base.h"
#include "w_bitvector.h"
#include <mutex>
#include <memory>
#include <list>
#include "timeout.h"
#include "latches.h"
#include "logrec.h"
#include "smstats.h"

Go to the source code of this file.

Classes

class  smthread_t
 Storage Manager thread. More...
 
struct  smthread_t::tcb_t
 
class  smthread_t::GlobalThreadList
 

Macros

#define GET_TSTAT(x)   smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)]
 Get per-thread statistic named x. More...
 
#define INC_TSTAT(x)   smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)]++
 Increment per-thread statistic named x by y. More...
 
#define ADD_TSTAT(x, y)   smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)] += (y)
 Increment statistic named x by y. More...
 
#define SET_TSTAT(x, y)   smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)] = (y)
 Set per-thread statistic named x to y. More...
 

Typedefs

typedef sm_thread_map_t atomic_thread_map_t
 Fingerprint for this smthread. More...
 

Functions

xct_txct ()
 

Macro Definition Documentation

§ ADD_TSTAT

#define ADD_TSTAT (   x,
 
)    smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)] += (y)

Increment statistic named x by y.

§ GET_TSTAT

#define GET_TSTAT (   x)    smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)]

Get per-thread statistic named x.

§ INC_TSTAT

#define INC_TSTAT (   x)    smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)]++

Increment per-thread statistic named x by y.

§ SET_TSTAT

#define SET_TSTAT (   x,
 
)    smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)] = (y)

Set per-thread statistic named x to y.

Typedef Documentation

§ atomic_thread_map_t

typedef sm_thread_map_t atomic_thread_map_t

Fingerprint for this smthread.

skip

Each smthread_t has a fingerprint. This is used by the deadlock detector. The fingerprint is a bitmap; each thread's bitmap is unique, the deadlock detector ORs fingerprints together to make a "digest" of the waits-for-map. Rather than have fingerprints associated with transactions, we associate them with threads.

This class provides synchronization (protection) for updating the map.

Note
: If you want to be sure the fingerprints are unique, for the purpose of eliminating false-positives in the lock manager's deadlock detector while debugging something, look at the code in smthread_t::_initialize_fingerprint(), where you can enable some debugging code. (There is no need to make them unique – if there were, we'd use 1 bit per... – but if you are debugging something you might want to ensure or detect uniqueness for that purpose.)

Function Documentation

§ xct()

xct_t* xct ( )
inline