CUBRID Engine  latest
thread_entry.hpp File Reference
#include "error_context.hpp"
#include "lockfree_transaction_def.hpp"
#include "porting.h"
#include "system.h"
#include <atomic>
#include <thread>
#include <cassert>
Include dependency graph for thread_entry.hpp:

Go to the source code of this file.

Classes

class  cubbase::resource_tracker< Res >
 
struct  event_stat
 
class  cubthread::entry
 

Namespaces

 cubbase
 
 cubsync
 
 cubload
 
 cubthread
 

Macros

#define THREAD_TS_COUNT   THREAD_TS_LAST
 

Typedefs

using cubbase::alloc_tracker = resource_tracker< const void * >
 
using cubbase::pgbuf_tracker = resource_tracker< const char * >
 
typedef struct event_stat EVENT_STAT
 
typedef std::thread::id thread_id_t
 
typedef cubthread::entry THREAD_ENTRY
 

Enumerations

enum  {
  THREAD_TS_SPAGE_SAVING = 0, THREAD_TS_OBJ_LOCK_RES, THREAD_TS_OBJ_LOCK_ENT, THREAD_TS_CATALOG,
  THREAD_TS_SESSIONS, THREAD_TS_FREE_SORT_LIST, THREAD_TS_GLOBAL_UNIQUE_STATS, THREAD_TS_HFID_TABLE,
  THREAD_TS_XCACHE, THREAD_TS_FPCACHE, THREAD_TS_DWB_SLOTS, THREAD_TS_LAST
}
 
enum  thread_type {
  TT_MASTER, TT_SERVER, TT_WORKER, TT_DAEMON,
  TT_LOADDB, TT_VACUUM_MASTER, TT_VACUUM_WORKER, TT_NONE
}
 
enum  thread_resume_suspend_status {
  THREAD_RESUME_NONE = 0, THREAD_RESUME_DUE_TO_INTERRUPT = 1, THREAD_RESUME_DUE_TO_SHUTDOWN = 2, THREAD_PGBUF_SUSPENDED = 3,
  THREAD_PGBUF_RESUMED = 4, THREAD_JOB_QUEUE_SUSPENDED = 5, THREAD_JOB_QUEUE_RESUMED = 6, THREAD_CSECT_READER_SUSPENDED = 7,
  THREAD_CSECT_READER_RESUMED = 8, THREAD_CSECT_WRITER_SUSPENDED = 9, THREAD_CSECT_WRITER_RESUMED = 10, THREAD_CSECT_PROMOTER_SUSPENDED = 11,
  THREAD_CSECT_PROMOTER_RESUMED = 12, THREAD_CSS_QUEUE_SUSPENDED = 13, THREAD_CSS_QUEUE_RESUMED = 14, THREAD_HEAP_CLSREPR_SUSPENDED = 15,
  THREAD_HEAP_CLSREPR_RESUMED = 16, THREAD_LOCK_SUSPENDED = 17, THREAD_LOCK_RESUMED = 18, THREAD_LOGWR_SUSPENDED = 19,
  THREAD_LOGWR_RESUMED = 20, THREAD_ALLOC_BCB_SUSPENDED = 21, THREAD_ALLOC_BCB_RESUMED = 22, THREAD_DWB_QUEUE_SUSPENDED = 23,
  THREAD_DWB_QUEUE_RESUMED = 24
}
 

Functions

int thread_get_recursion_depth (cubthread::entry *thread_p)
 
void thread_inc_recursion_depth (cubthread::entry *thread_p)
 
void thread_dec_recursion_depth (cubthread::entry *thread_p)
 
void thread_clear_recursion_depth (cubthread::entry *thread_p)
 
void thread_trace_on (cubthread::entry *thread_p)
 
void thread_set_trace_format (cubthread::entry *thread_p, int format)
 
bool thread_is_on_trace (cubthread::entry *thread_p)
 
void thread_set_clear_trace (cubthread::entry *thread_p, bool clear)
 
bool thread_need_clear_trace (cubthread::entry *thread_p)
 
bool thread_get_sort_stats_active (cubthread::entry *thread_p)
 
bool thread_set_sort_stats_active (cubthread::entry *thread_p, bool new_flag)
 
void thread_lock_entry (cubthread::entry *thread_p)
 
void thread_unlock_entry (cubthread::entry *thread_p)
 
void thread_suspend_wakeup_and_unlock_entry (cubthread::entry *p, thread_resume_suspend_status suspended_reason)
 
int thread_suspend_timeout_wakeup_and_unlock_entry (cubthread::entry *p, struct timespec *t, thread_resume_suspend_status suspended_reason)
 
void thread_wakeup (cubthread::entry *p, thread_resume_suspend_status resume_reason)
 
void thread_check_suspend_reason_and_wakeup (cubthread::entry *thread_p, thread_resume_suspend_status resume_reason, thread_resume_suspend_status suspend_reason)
 
void thread_wakeup_already_had_mutex (cubthread::entry *p, thread_resume_suspend_status resume_reason)
 
int thread_suspend_with_other_mutex (cubthread::entry *p, pthread_mutex_t *mutexp, int timeout, struct timespec *to, thread_resume_suspend_status suspended_reason)
 
const char * thread_type_to_string (thread_type type)
 
const char * thread_status_to_string (cubthread::entry::status status)
 
const char * thread_resume_status_to_string (thread_resume_suspend_status resume_status)
 

Macro Definition Documentation

#define THREAD_TS_COUNT   THREAD_TS_LAST

Typedef Documentation

typedef struct event_stat EVENT_STAT

Definition at line 98 of file thread_entry.hpp.

Definition at line 362 of file thread_entry.hpp.

typedef std::thread::id thread_id_t

Definition at line 118 of file thread_entry.hpp.

Enumeration Type Documentation

anonymous enum
Enumerator
THREAD_TS_SPAGE_SAVING 
THREAD_TS_OBJ_LOCK_RES 
THREAD_TS_OBJ_LOCK_ENT 
THREAD_TS_CATALOG 
THREAD_TS_SESSIONS 
THREAD_TS_FREE_SORT_LIST 
THREAD_TS_GLOBAL_UNIQUE_STATS 
THREAD_TS_HFID_TABLE 
THREAD_TS_XCACHE 
THREAD_TS_FPCACHE 
THREAD_TS_DWB_SLOTS 
THREAD_TS_LAST 

Definition at line 78 of file thread_entry.hpp.

Enumerator
THREAD_RESUME_NONE 
THREAD_RESUME_DUE_TO_INTERRUPT 
THREAD_RESUME_DUE_TO_SHUTDOWN 
THREAD_PGBUF_SUSPENDED 
THREAD_PGBUF_RESUMED 
THREAD_JOB_QUEUE_SUSPENDED 
THREAD_JOB_QUEUE_RESUMED 
THREAD_CSECT_READER_SUSPENDED 
THREAD_CSECT_READER_RESUMED 
THREAD_CSECT_WRITER_SUSPENDED 
THREAD_CSECT_WRITER_RESUMED 
THREAD_CSECT_PROMOTER_SUSPENDED 
THREAD_CSECT_PROMOTER_RESUMED 
THREAD_CSS_QUEUE_SUSPENDED 
THREAD_CSS_QUEUE_RESUMED 
THREAD_HEAP_CLSREPR_SUSPENDED 
THREAD_HEAP_CLSREPR_RESUMED 
THREAD_LOCK_SUSPENDED 
THREAD_LOCK_RESUMED 
THREAD_LOGWR_SUSPENDED 
THREAD_LOGWR_RESUMED 
THREAD_ALLOC_BCB_SUSPENDED 
THREAD_ALLOC_BCB_RESUMED 
THREAD_DWB_QUEUE_SUSPENDED 
THREAD_DWB_QUEUE_RESUMED 

Definition at line 133 of file thread_entry.hpp.

Enumerator
TT_MASTER 
TT_SERVER 
TT_WORKER 
TT_DAEMON 
TT_LOADDB 
TT_VACUUM_MASTER 
TT_VACUUM_WORKER 
TT_NONE 

Definition at line 121 of file thread_entry.hpp.

Function Documentation

void thread_check_suspend_reason_and_wakeup ( cubthread::entry thread_p,
thread_resume_suspend_status  resume_reason,
thread_resume_suspend_status  suspend_reason 
)

Definition at line 610 of file thread_entry.cpp.

References thread_check_suspend_reason_and_wakeup_internal().

Referenced by css_stop_log_writer(), and thread_unlock_entry().

Here is the caller graph for this function:

void thread_clear_recursion_depth ( cubthread::entry thread_p)
inline

Definition at line 391 of file thread_entry.hpp.

References cubthread::entry::xasl_recursion_depth.

Referenced by css_set_thread_info().

Here is the caller graph for this function:

void thread_dec_recursion_depth ( cubthread::entry thread_p)
inline

Definition at line 385 of file thread_entry.hpp.

References cubthread::entry::xasl_recursion_depth.

Referenced by eval_pred(), fetch_peek_arith(), and qexec_execute_mainblock().

Here is the caller graph for this function:

int thread_get_recursion_depth ( cubthread::entry thread_p)
inline

Definition at line 373 of file thread_entry.hpp.

References cubthread::entry::xasl_recursion_depth.

Referenced by eval_pred(), fetch_peek_arith(), qexec_execute_mainblock(), xqmgr_execute_query(), and xqmgr_prepare_and_execute_query().

Here is the caller graph for this function:

bool thread_get_sort_stats_active ( cubthread::entry thread_p)
inline

Definition at line 427 of file thread_entry.hpp.

References cubthread::entry::sort_stats_active.

Referenced by pgbuf_claim_bcb_for_fix(), and pgbuf_copy_to_area().

Here is the caller graph for this function:

void thread_inc_recursion_depth ( cubthread::entry thread_p)
inline

Definition at line 379 of file thread_entry.hpp.

References cubthread::entry::xasl_recursion_depth.

Referenced by eval_pred(), fetch_peek_arith(), and qexec_execute_mainblock().

Here is the caller graph for this function:

bool thread_need_clear_trace ( cubthread::entry thread_p)
inline

Definition at line 421 of file thread_entry.hpp.

References cubthread::entry::clear_trace.

Referenced by qexec_execute_query(), and session_clear_trace_stats().

Here is the caller graph for this function:

void thread_set_clear_trace ( cubthread::entry thread_p,
bool  clear 
)
inline

Definition at line 415 of file thread_entry.hpp.

References cubregex::clear(), and cubthread::entry::clear_trace.

Referenced by session_clear_trace_stats(), and session_get_trace_stats().

Here is the caller graph for this function:

bool thread_set_sort_stats_active ( cubthread::entry thread_p,
bool  new_flag 
)
inline

Definition at line 433 of file thread_entry.hpp.

References cubthread::entry::sort_stats_active.

Referenced by sort_listfile().

Here is the caller graph for this function:

void thread_set_trace_format ( cubthread::entry thread_p,
int  format 
)
inline

Definition at line 403 of file thread_entry.hpp.

References cubthread::entry::trace_format.

Referenced by xqmgr_execute_query(), and xqmgr_prepare_and_execute_query().

Here is the caller graph for this function:

const char* thread_status_to_string ( cubthread::entry::status  status)
void thread_trace_on ( cubthread::entry thread_p)
inline

Definition at line 397 of file thread_entry.hpp.

References cubthread::entry::on_trace.

Referenced by xqmgr_execute_query(), and xqmgr_prepare_and_execute_query().

Here is the caller graph for this function:

const char* thread_type_to_string ( thread_type  type)

Definition at line 692 of file thread_entry.cpp.

References TT_DAEMON, TT_LOADDB, TT_MASTER, TT_NONE, TT_SERVER, TT_VACUUM_MASTER, TT_VACUUM_WORKER, and TT_WORKER.

Referenced by showstmt_array_end_scan(), and thread_unlock_entry().

Here is the caller graph for this function:

void thread_wakeup ( cubthread::entry p,
thread_resume_suspend_status  resume_reason 
)
void thread_wakeup_already_had_mutex ( cubthread::entry p,
thread_resume_suspend_status  resume_reason 
)