#include <sm_vas.h> // which includes smthread.h
class smthread_t : public sthread_t {
public:
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();
void attach_xct(xct_t* x);
void detach_xct(xct_t* x);
xct_t* 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)
run()
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)
In general, only one thread can operate on behalf of a given transaction at any time (in other words, at most thread can be attached to a given transaction). The reason for this is that latch-latch deadlocks and latch-lock deadlocks are possible when two or more threads are operating on the same page, because locking does not provide concurrency control between threads. If, however, the value-added server writer takes responsibility for seeing that no such concurrency occurs, and rollback do not occur when two or more threads are attached to the same transaction, then (limited) parallelization of a transaction can be implemented.
detach_xct(xct)
xct()