$search

asio::thread Class Reference

A simple abstraction for starting threads. More...

#include <thread.hpp>

Inheritance diagram for asio::thread:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void join ()
 Wait for the thread to exit.
template<typename Function >
 thread (Function f)
 Start a new thread that executes the supplied function.
 ~thread ()
 Destructor.

Private Attributes

detail::thread impl_

Detailed Description

A simple abstraction for starting threads.

The asio::thread class implements the smallest possible subset of the functionality of boost::thread. It is intended to be used only for starting a thread and waiting for it to exit. If more extensive threading capabilities are required, you are strongly advised to use something else.

Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe.
Example
A typical use of asio::thread would be to launch a thread to run an io_service's event processing loop:
 asio::io_service io_service;
 // ...
 asio::thread t(boost::bind(&asio::io_service::run, &io_service));
 // ...
 t.join(); 

Definition at line 47 of file thread.hpp.


Constructor & Destructor Documentation

template<typename Function >
asio::thread::thread ( Function  f  )  [inline, explicit]

Start a new thread that executes the supplied function.

This constructor creates a new thread that will execute the given function or function object.

Parameters:
f The function or function object to be run in the thread. The function signature must be:

 void f(); 

Definition at line 60 of file thread.hpp.

asio::thread::~thread (  )  [inline]

Destructor.

Definition at line 66 of file thread.hpp.


Member Function Documentation

void asio::thread::join (  )  [inline]

Wait for the thread to exit.

This function will block until the thread has exited.

If this function is not called before the thread object is destroyed, the thread itself will continue to run until completion. You will, however, no longer have the ability to wait for it to exit.

Definition at line 78 of file thread.hpp.


Member Data Documentation

Definition at line 84 of file thread.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Mar 1 14:41:43 2013