pion-net  4.0.9
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
pion::PionMultiThreadScheduler Class Reference

#include <PionScheduler.hpp>

Inherits pion::PionScheduler.

Inherited by pion::PionOneToOneScheduler, and pion::PionSingleServiceScheduler.

Public Member Functions

 PionMultiThreadScheduler (void)
 constructs a new PionSingleServiceScheduler
 
virtual ~PionMultiThreadScheduler ()
 virtual destructor
 
- Public Member Functions inherited from pion::PionScheduler
 PionScheduler (void)
 constructs a new PionScheduler
 
virtual ~PionScheduler ()
 virtual destructor
 
virtual void startup (void)
 Starts the thread scheduler (this is called automatically when necessary)
 
virtual void shutdown (void)
 Stops the thread scheduler (this is called automatically when the program exits)
 
void join (void)
 the calling thread will sleep until the scheduler has stopped
 
void addActiveUser (void)
 
void removeActiveUser (void)
 unregisters an active user with the thread scheduler
 
bool isRunning (void) const
 returns true if the scheduler is running
 
void setNumThreads (const boost::uint32_t n)
 sets the number of threads to be used (these are shared by all servers)
 
boost::uint32_t getNumThreads (void) const
 returns the number of threads currently in use
 
void setLogger (PionLogger log_ptr)
 sets the logger to be used
 
PionLogger getLogger (void)
 returns the logger currently in use
 
virtual boost::asio::io_service & getIOService (void)=0
 returns an async I/O service used to schedule work
 
virtual void post (boost::function0< void > work_func)
 
void keepRunning (boost::asio::io_service &my_service, boost::asio::deadline_timer &my_timer)
 
void processServiceWork (boost::asio::io_service &service)
 processes work passed to the asio service & handles uncaught exceptions
 

Protected Types

typedef std::vector< boost::shared_ptr< boost::thread > > ThreadPool
 typedef for a pool of worker threads
 

Protected Member Functions

virtual void stopThreads (void)
 stops all threads used to perform work
 
virtual void finishThreads (void)
 finishes all threads used to perform work
 
- Protected Member Functions inherited from pion::PionScheduler
virtual void stopServices (void)
 stops all services used to schedule work
 
virtual void finishServices (void)
 finishes all services used to schedule work
 

Protected Attributes

ThreadPool m_thread_pool
 pool of threads used to perform work
 
- Protected Attributes inherited from pion::PionScheduler
boost::mutex m_mutex
 mutex to make class thread-safe
 
PionLogger m_logger
 primary logging interface used by this class
 
boost::condition m_no_more_active_users
 condition triggered when there are no more active users
 
boost::condition m_scheduler_has_stopped
 condition triggered when the scheduler has stopped
 
boost::uint32_t m_num_threads
 total number of worker threads in the pool
 
boost::uint32_t m_active_users
 the scheduler will not shutdown until there are no more active users
 
bool m_is_running
 true if the thread scheduler is running
 

Additional Inherited Members

- Static Public Member Functions inherited from pion::PionScheduler
static void sleep (boost::uint32_t sleep_sec, boost::uint32_t sleep_nsec)
 
template<typename ConditionType , typename LockType >
static void sleep (ConditionType &wakeup_condition, LockType &wakeup_lock, boost::uint32_t sleep_sec, boost::uint32_t sleep_nsec)
 
- Static Protected Member Functions inherited from pion::PionScheduler
static boost::xtime getWakeupTime (boost::uint32_t sleep_sec, boost::uint32_t sleep_nsec)
 
- Static Protected Attributes inherited from pion::PionScheduler
static const boost::uint32_t DEFAULT_NUM_THREADS = 8
 default number of worker threads in the thread pool
 
static const boost::uint32_t NSEC_IN_SECOND = 1000000000
 number of nanoseconds in one full second (10 ^ 9)
 
static const boost::uint32_t MICROSEC_IN_SECOND = 1000000
 number of microseconds in one full second (10 ^ 6)
 
static const boost::uint32_t KEEP_RUNNING_TIMER_SECONDS = 5
 number of seconds a timer should wait for to keep the IO services running
 

Detailed Description

PionMultiThreadScheduler: uses a pool of threads to perform work

Definition at line 199 of file PionScheduler.hpp.


The documentation for this class was generated from the following file: