#include <sm_vas.h> // which includes smthread.h
typedef void st_proc_t(void *);
class smthread_t : public sthread_t {
public:
NORET smthread_t(
st_proc_t* f,
void* arg,
priority_t priority = t_regular,
bool block_immediate = false,
bool auto_delete = false,
const char* name = 0,
long lockto = WAIT_FOREVER);
NORET smthread_t(
priority_t priority = t_regular,
bool block_immediate = false,
bool auto_delete = false,
const char* name = 0,
long lockto = WAIT_FOREVER);
NORET ~smthread_t();
virtual void run() = 0;
void attach_xct(xct_t* x);
void detach_xct(xct_t* x);
xct_t* xct();
const xct_t* const_xct() const;
static smthread_t* me();
// set and get lock_timeout value
long lock_timeout() const;
void lock_timeout(long i);
/*
* These methods are used to verify than nothing is
* left pinned accidentally. Call mark_pin_count before an
* operation and check_pin_count after it with the expected
* number of pins that should not have been released.
*/
void mark_pin_count();
void check_pin_count(int change);
void check_actual_pin_count(int actual) ;
void incr_pin_count(int amount) ;
/*
* These methods are used to verify that a thread
* is only in one ss_m::, scan::, or pin:: function at a time.
*/
void in_sm(bool in);
bool is_in_sm() const;
private:
void user(); /* disabled sthread_t::user */
};
sthread_t(priority, block_immediate, auto_delete, name, lock_timout)
Threads often run on behalf of a transaction, so there are methods for associating a thread with a transaction. For more information on transactions, see transaction(ssm)
attach_xct(xct)
A VAS that attaches a transaction to more than one thread runs a high risk of getting latch-latch deadlocks among threads. It is the responsibility of the VAS to implement its own protocol for avoiding these deadlocks. An example of such a protocol is to allow threads of multi-threaded transactions to work on non-overlapping partitions of the database.
It is also the responsibility of the VAS to see that certain operations, including commit and abort, are not attempted while a transaction is attached to several threads.
detach_xct(xct)