93 FINGER_BITS = SM_DREADLOCK_FINGERS
262 _is_update_thread(false),
263 _depth(outer == nullptr ? 1 : outer->_depth + 1),
295 static void init_fingerprint_map();
311 static void attach_xct(
xct_t* x);
384 #define GET_TSTAT(x) smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)] 392 #define INC_TSTAT(x) smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)]++ 397 #define ADD_TSTAT(x, y) smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)] += (y) 402 #define SET_TSTAT(x, y) smthread_t::TL_stats()[enum_to_base(sm_stat_id::x)] = (y) 412 static void mark_pin_count();
414 static void check_pin_count(
int change);
416 static void check_actual_pin_count(
int actual);
418 static void incr_pin_count(
int amount);
427 void in_sm(
bool in) {
437 bool is_update_thread() {
442 void set_is_update_thread(
bool in) {
446 static void no_xct(
xct_t*);
448 virtual void _dump(ostream&)
const;
523 std::unique_lock<std::mutex> lck{_mutex};
524 _tcb_list.push_back(
tcb_ptr());
528 std::unique_lock<std::mutex> lck{_mutex};
529 auto iter = _tcb_list.begin();
530 while (iter != _tcb_list.end()) {
533 iter = _tcb_list.erase(iter);
542 std::unique_lock<std::mutex> lck{_mutex};
543 for (
auto p : _tcb_list) {
555 static auto ptr = std::make_shared<GlobalThreadList>();
594 smthread_t::mark_pin_count() {
599 smthread_t::check_pin_count(
int W_IFDEBUG4(change)) {
600 #if W_DEBUG_LEVEL > 3 611 smthread_t::check_actual_pin_count(
int actual) {
616 smthread_t::incr_pin_count(
int amount) {
621 smthread_t::pin_count() {
626 DumpBlockedThreads(ostream& o);
634 #define DBGTHRD(arg) DBG(<< " th." << std::this_thread::get_id() << " " arg) 641 #endif // __SMTHREAD_H void create_TL_stats()
Called on tcb_t constructor.
Definition: smthread.cpp:34
static tcb_t *& tcb_ptr()
Definition: smthread.h:500
static queue_based_lock_t::ext_qnode & get_xlist_mutex_node()
Definition: smthread.h:483
void clear_TL_stats()
Definition: smthread.cpp:69
tcb_t(tcb_t *outer)
Definition: smthread.h:256
int prev_pin_count
Definition: smthread.h:213
logrec_t _logbuf2
Definition: smthread.h:208
static xct_t * xct()
return xct this thread is running
Definition: smthread.h:364
static logrec_t * get_logbuf()
Definition: smthread.h:355
logrec_t _logbuf
Definition: smthread.h:206
Storage Manager thread.
Definition: smthread.h:201
int lock_timeout
Definition: smthread.h:214
static int lock_timeout()
get lock_timeout value
Definition: smthread.h:328
void remove_me()
Definition: smthread.h:527
A transaction. Internal to the storage manager.This class may be used in a limited way for the handli...
Definition: xct.h:185
sm_thread_map_t atomic_thread_map_t
Fingerprint for this smthread.
Definition: smthread.h:89
bool _is_update_thread
Definition: smthread.h:216
#define w_assert3(x)
Level 3 definitely adds significant time.
Definition: w_base.h:214
sm_stats_t & TL_stats()
Definition: smthread.h:244
#define F
Definition: w_okvl_inl.h:46
queue_based_lock_t::ext_qnode _me3
Definition: smthread.h:228
Definition: smthread.h:520
static std::shared_ptr< GlobalThreadList > thread_list()
Definition: smthread.h:554
void add_me()
Definition: smthread.h:522
int pin_count
Definition: smthread.h:212
Represents a transactional log record.
Definition: logrec.h:143
bool _waiting
Definition: smthread.h:489
static queue_based_lock_t::ext_qnode & get_me3()
TLS variables Exported to sm.
Definition: smthread.h:471
sm_stat_id
Definition: smstats.h:131
static void add_from_TL_stats(sm_stats_t &w)
Add thread-local stats into the given structure.
Definition: smthread.cpp:82
static long get_TL_stat(sm_stat_id stat)
Definition: smthread.h:252
static void add_me_to_thread_list()
Definition: smthread.h:561
friend class smthread_init_t
Definition: smthread.h:202
bool _in_sm
Definition: smthread.h:215
Templated bitmap for arbitrary size in bits.
Definition: w_bitvector.h:62
static void detach_xct(xct_t *x)
Definition: smthread.cpp:396
std::array< long, enum_to_base(sm_stat_id::stat_max)> sm_stats_t
Definition: smstats.h:205
static void set_lock_timeout(int i)
Set lock_timeout value.
Definition: smthread.h:351
#define QUEUE_EXT_QNODE_INITIALIZE(x)
Definition: latches.h:219
static queue_based_lock_t::ext_qnode & get_me2()
Definition: smthread.h:475
void destroy_TL_stats()
Called on tcb_t destructor.
Definition: smthread.cpp:41
queue_based_lock_t::ext_qnode _xlist_mutex_node
Queue node for holding mutex to serialize access transaction list. Used in xct.cpp.
Definition: smthread.h:234
#define w_assert4(x)
Level 4 can be a hog.
Definition: w_base.h:222
static sm_stats_t & TL_stats()
Return thread-local statistics collected for this thread.
Definition: smthread.h:369
xct_t * xct
Definition: smthread.h:210
static long get_TL_stat(sm_stat_id s)
Definition: smthread.h:373
The means of identifying a desired or held lock.
Definition: lock_s.h:41
~tcb_t()
Definition: smthread.h:273
queue_based_lock_t::ext_qnode _me2
Definition: smthread.h:226
static void timeout_to_timespec(int timeout_ms, struct timespec &when)
Definition: smthread.cpp:335
Special values for timeouts (int-values).
Definition: timeout.h:26
tcb_t * _outer
Definition: smthread.h:219
constexpr auto enum_to_base(E e) -> typename std::underlying_type< E >::type
Definition: smstats.h:127
static queue_based_lock_t::ext_qnode & get_me1()
Definition: smthread.h:479
queue_based_lock_t::ext_qnode _me1
Definition: smthread.h:224
sm_stats_t _TL_stats
Definition: smthread.h:221
static tcb_t & tcb()
Definition: smthread.h:506
int16_t _depth
Definition: smthread.h:218
static size_t get_tcb_depth()
Definition: smthread.h:514
std::list< tcb_t * > _tcb_list
Definition: smthread.h:549
static void for_each_thread_stats(F &f)
Definition: smthread.h:570
std::mutex _mutex
Definition: smthread.h:551
#define W_IFDEBUG4(x)
Definition: w_base.h:119
const sm_stats_t & TL_stats_const() const
Definition: smthread.h:248
Definition: mcs_lock.h:76
Definition: smthread.h:204
void for_each_stats(F &f)
Definition: smthread.h:541
static logrec_t * get_logbuf2()
Definition: smthread.h:359
static void remove_me_from_thread_list()
Definition: smthread.h:565