sthread_t Class Reference

Inherits sthread_named_base_t.

Inherited by smthread_t.

Inheritance diagram for sthread_t:

Inheritance graph
[legend]
Collaboration diagram for sthread_t:

Collaboration graph
[legend]
List of all members.

Detailed Description

Thread class for all threads that use the Shore Storage Manager.

All threads that perform any work on behalf of the storage manager or call any storage manager API must be an sthread_t or a class derived from sthread_t.

Storage manager threads use block/unblock methods provided by sthread, and use thread-local storage (data attributes of sthread_t).

This class also provides an os-independent API for file-system calls (open, read, write, close, etc.) used by the storage manager.

This class is a fairly thin layer over pthreads. Client threads may use pthread synchronization primitives.

Definition at line 631 of file sthread.h.

Public Types

enum  status_t
enum  priority_t
enum  

Public Member Functions

w_rc_t unblock (w_rc_t::errcode_t e)
virtual void _dump (ostream &) const
virtual void vtable_collect (vtable_row_t &)
 Collect into a virtual-table row the information about this thread.
bool isStackOK (const char *file="", int line=0) const
bool isStackFrameOK (size_t size=0)
w_rc_t set_priority (priority_t priority)
pthread_t myself ()
void sleep (timeout_in_ms timeout=WAIT_IMMEDIATE, const char *reason=0)
void wakeup ()
w_rc_t join (timeout_in_ms timeout=WAIT_FOREVER)
w_rc_t fork ()
ostream & print (ostream &) const
virtual ~sthread_t ()

Static Public Member Functions

static void initialize_sthreads_package ()
static void timeout_to_timespec (timeout_in_ms timeout, struct timespec &when)
static w_rc_t block (pthread_mutex_t &lock, timeout_in_ms timeout=WAIT_FOREVER, sthread_list_t *list=0, const char *const caller=0, const void *id=0)
static w_rc_t::errcode_t block (int4_t timeout=WAIT_FOREVER)
static void dumpall (const char *, ostream &)
static void dumpall (ostream &)
static void dump_stats (ostream &)
static void reset_stats ()
static void vtable_collect_names (vtable_row_t &)
 Stuff the attribute names in this row.
static int collect (vtable_t &v, bool attr_names_too=true)
static void for_each_thread (ThreadFunc &f)
static void check_all_stacks (const char *file="", int line=0)
static sthread_t *& me_lval ()
 Returns a (writable) reference to the a pointer to the running sthread_t.
static sthread_tme ()
static int rand ()
static double drand ()
static int randn (int max)
static void yield ()

Public Attributes

void * user
const id_t id

Static Public Attributes

static const char * status_strings []
static const char * priority_strings []
static w_base_t::int8_t max_os_file_size

Protected Member Functions

 sthread_t (priority_t priority=t_regular, const char *name=0, unsigned stack_size=default_stack)
virtual void before_run ()
virtual void after_run ()


Member Function Documentation

void sthread_t::vtable_collect ( vtable_row_t  )  [virtual]

Collect into a virtual-table row the information about this thread.

Collect a row of a virtual table. One row per thread. Subclasses override this.

Definition at line 118 of file vtable_sthread.cpp.

References vtable_row_t::set_int(), vtable_row_t::set_string(), and status_strings.

Here is the call graph for this function:

int sthread_t::collect ( vtable_t v,
bool  attr_names_too = true 
) [static]

Collect an entire table, one row per thread that the sthreads package knows about. If attr_names_too is true, the first row will be attribute names.

Definition at line 65 of file vtable_sthread.cpp.

References w_list_i< T, LOCK >::curr(), vtable_t::init(), vtable_func< T >::insert_names(), and w_list_i< T, LOCK >::next().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Jul 7 17:22:43 2010 for Shore Storage Manager by  doxygen 1.4.7