|
PionNetworkLibrary
|
#include <scheduler.hpp>


Classes | |
| struct | service_pair_type |
| typedef for a pair object where first is an IO service and second is a deadline timer More... | |
Public Member Functions | |
| one_to_one_scheduler (void) | |
| constructs a new one_to_one_scheduler More... | |
| virtual | ~one_to_one_scheduler () |
| virtual destructor More... | |
| virtual boost::asio::io_service & | get_io_service (void) |
| returns an async I/O service used to schedule work More... | |
| virtual boost::asio::io_service & | get_io_service (boost::uint32_t n) |
| virtual void | startup (void) |
| Starts the thread scheduler (this is called automatically when necessary) More... | |
Public Member Functions inherited from pion::multi_thread_scheduler | |
| multi_thread_scheduler (void) | |
| constructs a new multi_thread_scheduler More... | |
| virtual | ~multi_thread_scheduler () |
| virtual destructor More... | |
Public Member Functions inherited from pion::scheduler | |
| scheduler (void) | |
| constructs a new scheduler More... | |
| virtual | ~scheduler () |
| virtual destructor More... | |
| virtual void | shutdown (void) |
| Stops the thread scheduler (this is called automatically when the program exits) More... | |
| void | join (void) |
| the calling thread will sleep until the scheduler has stopped More... | |
| void | add_active_user (void) |
| void | remove_active_user (void) |
| unregisters an active user with the thread scheduler More... | |
| bool | is_running (void) const |
| returns true if the scheduler is running More... | |
| void | set_num_threads (const boost::uint32_t n) |
| sets the number of threads to be used (these are shared by all servers) More... | |
| boost::uint32_t | get_num_threads (void) const |
| returns the number of threads currently in use More... | |
| void | set_logger (logger log_ptr) |
| sets the logger to be used More... | |
| logger | get_logger (void) |
| returns the logger currently in use More... | |
| virtual void | post (boost::function0< void > work_func) |
| void | keep_running (boost::asio::io_service &my_service, boost::asio::deadline_timer &my_timer) |
| void | process_service_work (boost::asio::io_service &service) |
| processes work passed to the asio service & handles uncaught exceptions More... | |
Protected Types | |
| typedef std::vector < boost::shared_ptr < service_pair_type > > | service_pool_type |
| typedef for a pool of IO services More... | |
Protected Types inherited from pion::multi_thread_scheduler | |
| typedef std::vector < boost::shared_ptr < boost::thread > > | ThreadPool |
| typedef for a pool of worker threads More... | |
Protected Member Functions | |
| virtual void | stop_services (void) |
| stops all services used to schedule work More... | |
| virtual void | finish_services (void) |
| finishes all services used to schedule work More... | |
Protected Member Functions inherited from pion::multi_thread_scheduler | |
| virtual void | stop_threads (void) |
| stops all threads used to perform work More... | |
| virtual void | finish_threads (void) |
| finishes all threads used to perform work More... | |
Protected Attributes | |
| service_pool_type | m_service_pool |
| pool of IO services used to schedule work More... | |
| boost::uint32_t | m_next_service |
| the next service to use for scheduling work More... | |
Protected Attributes inherited from pion::multi_thread_scheduler | |
| ThreadPool | m_thread_pool |
| pool of threads used to perform work More... | |
Protected Attributes inherited from pion::scheduler | |
| boost::mutex | m_mutex |
| mutex to make class thread-safe More... | |
| logger | m_logger |
| primary logging interface used by this class More... | |
| boost::condition | m_no_more_active_users |
| condition triggered when there are no more active users More... | |
| boost::condition | m_scheduler_has_stopped |
| condition triggered when the scheduler has stopped More... | |
| boost::uint32_t | m_num_threads |
| total number of worker threads in the pool More... | |
| boost::uint32_t | m_active_users |
| the scheduler will not shutdown until there are no more active users More... | |
| bool | m_is_running |
| true if the thread scheduler is running More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from pion::scheduler | |
| 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::scheduler | |
| static boost::system_time | get_wakeup_time (boost::uint32_t sleep_sec, boost::uint32_t sleep_nsec) |
Static Protected Attributes inherited from pion::scheduler | |
| static const boost::uint32_t | DEFAULT_NUM_THREADS = 8 |
| default number of worker threads in the thread pool More... | |
| static const boost::uint32_t | NSEC_IN_SECOND = 1000000000 |
| number of nanoseconds in one full second (10 ^ 9) More... | |
| static const boost::uint32_t | MICROSEC_IN_SECOND = 1000000 |
| number of microseconds in one full second (10 ^ 6) More... | |
| static const boost::uint32_t | KEEP_RUNNING_TIMER_SECONDS = 5 |
| number of seconds a timer should wait for to keep the IO services running More... | |
one_to_one_scheduler: uses a single IO service for each thread
|
protected |
typedef for a pool of IO services
|
inline |
constructs a new one_to_one_scheduler
|
inlinevirtual |
virtual destructor
|
inlineprotectedvirtual |
finishes all services used to schedule work
Reimplemented from pion::scheduler.
|
inlinevirtual |
returns an async I/O service used to schedule work
Implements pion::scheduler.
|
inlinevirtual |
returns an async I/O service used to schedule work (provides direct access to avoid locking when possible)
| n | integer number representing the service object |
|
virtual |
Starts the thread scheduler (this is called automatically when necessary)
Reimplemented from pion::scheduler.
References pion::scheduler::keep_running(), pion::scheduler::m_is_running, pion::scheduler::m_logger, pion::scheduler::m_mutex, pion::scheduler::m_num_threads, m_service_pool, pion::multi_thread_scheduler::m_thread_pool, PION_LOG_INFO, and pion::scheduler::process_service_work().
|
inlineprotectedvirtual |
stops all services used to schedule work
Reimplemented from pion::scheduler.
|
protected |
the next service to use for scheduling work
|
protected |
pool of IO services used to schedule work
Referenced by startup().