Inheritance diagram for smthread_t:
The storage manager keeps its own thread-local state and provides for a little more control over the starting of threads than does the POSIX interface: you can do meaningful work between the time the thread is created and the time it starts to run. The thread constructor creates the underlying pthread_t, which then awaits permission (a pthread condition variable) to continue (signalled by smthread_t::fork).
create_rec.cpp, log_exceed.cpp, sort_stream.cpp, startstop.cpp, and vtable_example.cpp.
Definition at line 218 of file smthread.h.
Public Types | |
enum | SmThreadTypes |
RTTI. More... | |
Public Member Functions | |
const atomic_thread_map_t & | get_fingerprint_map () const |
NORET | smthread_t (st_proc_t *f, void *arg, priority_t priority=t_regular, const char *name=0, timeout_in_ms lockto=WAIT_FOREVER, unsigned stack_size=default_stack) |
Normal constructor for a storage manager client. | |
NORET | smthread_t (priority_t priority=t_regular, const char *name=0, timeout_in_ms lockto=WAIT_FOREVER, unsigned stack_size=default_stack) |
Normal constructor for a storage manager client. | |
w_rc_t | join (timeout_in_ms timeout=WAIT_FOREVER) |
Returns when this thread ends. | |
virtual void | before_run () |
Called before run() is called. | |
virtual void | run ()=0 |
Main work routine. | |
virtual void | after_run () |
Call when run finishes, before join() returns. | |
virtual int | thread_type () |
RTTI. | |
timeout_in_ms | lock_timeout () |
get lock_timeout value | |
void | lock_timeout (timeout_in_ms i) |
Set lock_timeout value. | |
xct_t * | xct () |
return xct this thread is running | |
xct_t * | xct () const |
return xct this thread is running | |
sm_stats_info_t & | TL_stats () |
Return thread-local statistics collected for this thread. | |
void | add_from_TL_stats (sm_stats_info_t &w) const |
Add thread-local stats into the given structure. | |
bool | generate_log_warnings () const |
void | set_generate_log_warnings (bool b) |
queue_based_lock_t::ext_qnode & | get_me3 () |
TLS variables Exported to sm. | |
queue_based_lock_t::ext_qnode & | get_me2 () |
queue_based_lock_t::ext_qnode & | get_me1 () |
queue_based_lock_t::ext_qnode & | get_log_me_node () |
queue_based_lock_t::ext_qnode & | get_xlist_mutex_node () |
queue_based_lock_t::ext_qnode & | get_1thread_log_me () |
queue_based_lock_t::ext_qnode & | get_1thread_xct_me () |
queue_based_lock_t::ext_qnode & | get_xct_t_me_node () |
tcb_t::ordinal_number_t & | get__ordinal () |
int & | get___metarecs () |
int & | get___metarecs_in () |
char * | get_kc_buf () |
cvec_t * | get_kc_vec () |
char * | get_page_check_map () |
Static Public Member Functions | |
static void | for_each_smthread (SmthreadFunc &f) |
Iterator over all smthreads. Thread-safe and so use carefully. | |
static smthread_t * | me () |
Return currently-running smthread. |
RTTI.
Run-time type info: Derived threads are expected to add thread types and override thread_type()
Definition at line 413 of file smthread.h.
NORET smthread_t::smthread_t | ( | st_proc_t * | f, | |
void * | arg, | |||
priority_t | priority = t_regular , |
|||
const char * | name = 0 , |
|||
timeout_in_ms | lockto = WAIT_FOREVER , |
|||
unsigned | stack_size = default_stack | |||
) |
Normal constructor for a storage manager client.
[in] | f | Stored in thread for client's convenience, may be used in run() method. |
[in] | arg | Stored in thread for client's convenience, may be used in run() method. |
[in] | priority | Required, but not used in storage manager. |
[in] | name | Optional thread name, used for debugging. |
[in] | lockto | Timeout for lock waiting. See timeout_in_ms. |
[in] | stack_size | Best to use default. |
NORET smthread_t::smthread_t | ( | priority_t | priority = t_regular , |
|
const char * | name = 0 , |
|||
timeout_in_ms | lockto = WAIT_FOREVER , |
|||
unsigned | stack_size = default_stack | |||
) |
Normal constructor for a storage manager client.
[in] | priority | Required, but not used in storage manager. |
[in] | name | Optional thread name, used for debugging. |
[in] | lockto | Timeout for lock waiting. See timeout_in_ms. |
[in] | stack_size | Best to use default. |
w_rc_t smthread_t::join | ( | timeout_in_ms | timeout = WAIT_FOREVER |
) |
Returns when this thread ends.
[in] | timeout | Not used. |
Reimplemented from sthread_t.
virtual int smthread_t::thread_type | ( | ) | [inline, virtual] |
RTTI.
Run-time type info: Derived threads are expected to add thread types and override thread_type()
Definition at line 419 of file smthread.h.
static void smthread_t::for_each_smthread | ( | SmthreadFunc & | f | ) | [static] |
Iterator over all smthreads. Thread-safe and so use carefully.
[in] | f | Callback function. For each smthread, this calls the callback function f. Because this grabs a lock on the list of all shore threads, whether or not they are smthreads, this prevents new threads from starting and old ones from finishing, so don't use with long-running functions. |
void smthread_t::lock_timeout | ( | timeout_in_ms | i | ) | [inline] |
Set lock_timeout value.
You can give a value WAIT_FOREVER, WAIT_IMMEDIATE, or a positive millisecond value. Every lock request made with WAIT_SPECIFIED_BY_THREAD will use this value.
A transaction can be given its own timeout on ss_m::begin_xct. The transaction's lock timeout is used for every lock request made with WAIT_SPECIFIED_BY_XCT. A transaction begun with WAIT_SPECIFIED_BY_THREAD will use the thread's lock_timeout for the transaction timeout.
All internal storage manager lock requests use WAIT_SPECIFIED_BY_XCT. Since the transaction can defer to the per-thread timeout, the client has control over which timeout to use by choosing the value given at ss_m::begin_xct.
Definition at line 482 of file smthread.h.
static smthread_t* smthread_t::me | ( | ) | [inline, static] |
Return currently-running smthread.
Reimplemented from sthread_t.
Definition at line 498 of file smthread.h.
References sthread_t::me().
Here is the call graph for this function: