Sirikata
Public Member Functions | Private Types | Private Attributes
Sirikata::Network::IOServicePool Class Reference

IOServicePool creates a pool of IOService threads for handling IO events. More...

#include <IOServicePool.hpp>

Collaboration diagram for Sirikata::Network::IOServicePool:

List of all members.

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.
IOServiceservice ()
 Get the IOService corresponding to the given thread.

Private Types

typedef std::vector< Thread * > ThreadList

Private Attributes

IOServicemIO
ThreadList mThreads
IOWorkmWork

Detailed Description

IOServicePool creates a pool of IOService threads for handling IO events.


Member Typedef Documentation

typedef std::vector<Thread*> Sirikata::Network::IOServicePool::ThreadList [private]

Constructor & Destructor Documentation

Sirikata::Network::IOServicePool::IOServicePool ( const String &  name,
uint32  nthreads 
)
Sirikata::Network::IOServicePool::~IOServicePool ( )

References mIO, mThreads, mWork, and stopWork().


Member Function Documentation

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 ( )
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.

Parameters:
thrthe 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.

References mIO, and mWork.

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().


Member Data Documentation

Referenced by join(), run(), and ~IOServicePool().

Referenced by startWork(), stopWork(), and ~IOServicePool().


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