Scale Stack 0.3 Developer Documentation

scalestack::event::libevent::thread Class Reference

#include <thread.h>

Inheritance diagram for scalestack::event::libevent::thread:
scalestack::threading::thread

Public Member Functions

 thread (kernel::module &module, size_t thread_index)
 ~thread ()
void shutdown (void)
void check_handler_provider (handler_provider *handler_provider)
struct event_base * get_event_base (void)
struct timeval & get_now (void)

Private Types

typedef std::vector
< handler_provider * > 
handler_providers

Private Member Functions

 thread (const thread &)
threadoperator= (const thread &)
void run (void)
void _add_notify_pipe (void)
void _remove_notify_pipe (void)
void _send_notify (void)
void _handle_notify (int file_descriptor, short events)

Private Attributes

bool _shutdown
uint8_t _handler_providers_index
size_t _thread_index
struct event_base * _base
int _notify_pipe [2]
struct event _notify_event
struct timeval _notify_timeout
struct timeval _now
threading::mutex _handler_providers_mutex
handler_providers _handler_providers [2]

Friends

void thread_handle_notify (int file_descriptor, short events, void *context)

Detailed Description

Definition at line 50 of file thread.h.


Member Typedef Documentation

Definition at line 126 of file thread.h.


Constructor & Destructor Documentation

scalestack::event::libevent::thread::thread ( kernel::module module,
size_t  thread_index 
)

Constructor for event threads.

Parameters:
[in] module Module that the handler service is associated with.
[in] thread_index The 0-based index for this thread.

Definition at line 61 of file thread.cc.

scalestack::event::libevent::thread::~thread (  )  [virtual]

Threads should be stopped first with stop() before this destructor is run, otherwise the run() method in derived classes would still be running.

Reimplemented from scalestack::threading::thread.

Definition at line 106 of file thread.cc.

scalestack::event::libevent::thread::thread ( const thread  )  [private]

Don't allow copying of objects.


Member Function Documentation

void scalestack::event::libevent::thread::shutdown ( void   ) 

Notify a thread to shutdown. This is called by the service provider class for each thread before deleting the threads. This allows all threads to be notified to stop before any cleanup is attempted.

Definition at line 114 of file thread.cc.

void scalestack::event::libevent::thread::check_handler_provider ( handler_provider handler_provider  ) 

Queue a handler provider to be checked on this thread.

Parameters:
[in] handler_provider Event handler provider to check.

Definition at line 121 of file thread.cc.

struct event_base * scalestack::event::libevent::thread::get_event_base ( void   )  [read]

Get the event base struct. This is used by handler providers once they are added to this thread.

Definition at line 133 of file thread.cc.

struct timeval & scalestack::event::libevent::thread::get_now ( void   )  [read]

Get a cached time structure.

Definition at line 138 of file thread.cc.

thread& scalestack::event::libevent::thread::operator= ( const thread  )  [private]

Don't allow assignment of objects.

void scalestack::event::libevent::thread::run ( void   )  [private, virtual]

Method that implements the body of the running thread.

Implements scalestack::threading::thread.

Definition at line 149 of file thread.cc.

void scalestack::event::libevent::thread::_add_notify_pipe ( void   )  [private]

Start the notify pipe.

Definition at line 159 of file thread.cc.

void scalestack::event::libevent::thread::_remove_notify_pipe ( void   )  [private]

Stop the notify pipe.

Definition at line 200 of file thread.cc.

void scalestack::event::libevent::thread::_send_notify ( void   )  [private]

Send a notify to run and process events.

Definition at line 206 of file thread.cc.

void scalestack::event::libevent::thread::_handle_notify ( int  file_descriptor,
short  events 
) [private]

Handle a notify event.

Definition at line 212 of file thread.cc.


Friends And Related Function Documentation

void thread_handle_notify ( int  file_descriptor,
short  events,
void *  context 
) [friend]

Function used by notify event to invoke thread::_handle_notify().


Field Documentation

Definition at line 128 of file thread.h.

Definition at line 129 of file thread.h.

Definition at line 130 of file thread.h.

struct event_base* scalestack::event::libevent::thread::_base [private]

Definition at line 131 of file thread.h.

Definition at line 132 of file thread.h.

Definition at line 133 of file thread.h.

Definition at line 134 of file thread.h.

Definition at line 135 of file thread.h.

Definition at line 136 of file thread.h.

Definition at line 137 of file thread.h.


The documentation for this class was generated from the following files:
Generated on Thu Feb 17 13:10:22 2011 by  doxygen 1.6.3