Sirikata
|
IOServicePool creates a pool of IOService threads for handling IO events. More...
#include <IOServicePool.hpp>
Public Member Functions | |
IOServicePool (const String &name, uint32 nthreads) | |
~IOServicePool () | |
void | run () |
Run the thread pool. | |
void | reset () |
Reset stopped state. | |
void | join () |
Block until all the child threads exit. | |
void | startWork () |
Add work to keep the service busy. | |
void | stopWork () |
Remove work so the service can complete and exit. | |
IOService * | service () |
Get the IOService corresponding to the given thread. | |
Private Types | |
typedef std::vector< Thread * > | ThreadList |
Private Attributes | |
IOService * | mIO |
ThreadList | mThreads |
IOWork * | mWork |
IOServicePool creates a pool of IOService threads for handling IO events.
typedef std::vector<Thread*> Sirikata::Network::IOServicePool::ThreadList [private] |
Sirikata::Network::IOServicePool::IOServicePool | ( | const String & | name, |
uint32 | nthreads | ||
) |
Sirikata::Network::IOServicePool::~IOServicePool | ( | ) |
References mIO, mThreads, mWork, and stopWork().
void Sirikata::Network::IOServicePool::join | ( | ) |
Block until all the child threads exit.
References mThreads, and stopWork().
Referenced by Sirikata::Transfer::HttpManager::~HttpManager().
void Sirikata::Network::IOServicePool::reset | ( | ) |
Reset stopped state.
References mIO, and Sirikata::Network::IOService::reset().
void Sirikata::Network::IOServicePool::run | ( | ) |
Run the thread pool.
References mIO, mThreads, and Sirikata::Network::IOService::name().
Referenced by Sirikata::Transfer::HttpManager::HttpManager().
IOService * Sirikata::Network::IOServicePool::service | ( | ) |
Get the IOService corresponding to the given thread.
Note that you rarely need a specific service, so requesting the default is sufficient.
thr | the index of the thread to retrieve the IOService for |
References mIO.
Referenced by Sirikata::Transfer::HttpManager::handle_resolve(), Sirikata::Transfer::HttpManager::HttpManager(), and Sirikata::Transfer::HttpManager::postCallback().
void Sirikata::Network::IOServicePool::startWork | ( | ) |
Add work to keep the service busy.
Referenced by Sirikata::Transfer::HttpManager::HttpManager().
void Sirikata::Network::IOServicePool::stopWork | ( | ) |
Remove work so the service can complete and exit.
References mWork.
Referenced by join(), Sirikata::Transfer::HttpManager::~HttpManager(), and ~IOServicePool().
IOService* Sirikata::Network::IOServicePool::mIO [private] |
Referenced by reset(), run(), service(), startWork(), and ~IOServicePool().
Referenced by join(), run(), and ~IOServicePool().
IOWork* Sirikata::Network::IOServicePool::mWork [private] |
Referenced by startWork(), stopWork(), and ~IOServicePool().