Wt: Wt::WIOService Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::WIOService Class Reference

An I/O service. More...

`#include <Wt/WIOService>`

List of all members.

## Public Member Functions
| WIOService ()
| Creates a new IO service.
void | setThreadCount (int number)
| Configures the number of threads.
int | threadCount () const
| Returns the thread count.
void | start ()
| Starts the I/O service.
void | stop ()
| Stops the I/O service.
void | post (const boost::function< void()> &function)
| Posts a function into the thread-pool.
void | schedule (int milliSeconds, const boost::function< void()> &function)
| Schedules a function on the thread-pool.
virtual void | initializeThread ()
| Initializes a thread.

## Detailed Description

An I/O service.

! An I/O service combines a boost::asio::io_service with a thread pool.

## Constructor & Destructor Documentation

Wt::WIOService::WIOService | ( |  | ) |

Creates a new IO service.

See also:
  setServerConfiguration()

## Member Function Documentation

void Wt::WIOService::initializeThread | ( |  | ) | `[virtual]`

Initializes a thread.

This function is called for every new thread created, and can be used to configure the thread, e.g. with respect to scheduling priorities.

void Wt::WIOService::post | ( | const boost::function< void()> & | function | ) |

Posts a function into the thread-pool.

The function will be executed within a thread of the thread-pool.

This method returns immediately.

void Wt::WIOService::schedule | ( | int | milliSeconds,
|  | const boost::function< void()> & | function
| ) |  |

Schedules a function on the thread-pool.

The function will be executed after a time out, specified in milli-seconds, on the thread pool.

void Wt::WIOService::setThreadCount | ( | int | number | ) |

Configures the number of threads.

This must be configured before the server is started using start().

The default thread count is 10 (or is configured by WServer from information in the configuration file).

void Wt::WIOService::start | ( |  | ) |

Starts the I/O service.

This will start the internal thread pool to process work for the I/O service, if not already started.

void Wt::WIOService::stop | ( |  | ) |

Stops the I/O service.

This will stop the internal thread pool. The method will block until all work has been completed.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator