The `thread` class represents threads of execution, and provides the functionality to create and manage threads within the &Boost.Thread; library. See for a precise description of thread of execution, and for definitions of threading-related terms and of thread states such as blocked.

A thread of execution has an initial function. For the program's initial thread, the initial function is `main()`. For other threads, the initial function is `operator()` of the function object passed to the `thread` object's constructor.

A thread of execution is said to be "finished" or to have "finished execution" when its initial function returns or is terminated. This includes completion of all thread cleanup handlers, and completion of the normal C++ function return behaviors, such as destruction of automatic storage (stack) objects and releasing any associated implementation resources.

A thread object has an associated state which is either "joinable" or "non-joinable".

Except as described below, the policy used by an implementation of &Boost.Thread; to schedule transitions between thread states is unspecified.

Just as the lifetime of a file may be different from the lifetime of an `iostream` object which represents the file, the lifetime of a thread of execution may be different from the `thread` object which represents the thread of execution. In particular, after a call to `join()`, the thread of execution will no longer exist even though the `thread` object continues to exist until the end of its normal lifetime. The converse is also possible; if a `thread` object is destroyed without `join()` first having been called, the thread of execution continues until its initial function completes.

`boost::noncopyable` Exposition only
Constructs a `thread` object representing the current thread of execution.
*this
is non-joinable.
Danger: `*this` is valid only within the current thread.
const boost::function0<void>&
Starts a new thread of execution and constructs a `thread` object representing it. Copies `threadfunc` (which in turn copies the function object wrapped by `threadfunc`) to an internal location which persists for the lifetime of the new thread of execution. Calls `operator()` on the copy of the `threadfunc` function object in the new thread of execution.
*this
is joinable.
boost::thread_resource_error
if a new thread of execution cannot be started.
Destroys `*this`. The actual thread of execution may continue to execute after the `thread` object has been destroyed.
If `*this` is joinable the actual thread of execution becomes "detached". Any resources used by the thread will be reclaimed when the thread of execution completes. To ensure such a thread of execution runs to completion before the `thread` object is destroyed, call `join()`.
bool

const thread&
The thread is non-terminated or `*this` is joinable.
true
if `*this` and `rhs` represent the same thread of execution.
bool

const thread&
The thread is non-terminated or `*this` is joinable.
!(*this==rhs)
.
void

*this
is joinable.
The current thread of execution blocks until the initial function of the thread of execution represented by `*this` finishes and all resources are reclaimed.
*this
is non-joinable.
If `*this == thread()` the result is implementation-defined. If the implementation doesn't detect this the result will be deadlock.
void

const `xtime`&
The current thread of execution blocks until `xt` is reached.
void

The current thread of execution is placed in the ready state.

Allow the current thread to give up the rest of its time slice (or other scheduling quota) to another thread. Particularly useful in non-preemptive implementations.

The `thread_group` class provides a container for easy grouping of threads to simplify several common thread creation and management idioms.
`boost::noncopyable` Exposition only
Constructs an empty `thread_group` container.
Destroys each contained thread object. Destroys `*this`.
Behavior is undefined if another thread references `*this` during the execution of the destructor.
`thread`*

const boost::function0<void>&
Creates a new `thread` object that executes `threadfunc` and adds it to the `thread_group` container object's list of managed `thread` objects.
Pointer to the newly created `thread` object.
void

thread
*
Adds `thrd` to the `thread_group` object's list of managed `thread` objects. The `thrd` object must have been allocated via `operator new` and will be deleted when the group is destroyed.
void

thread
*
Removes `thread` from `*this`'s list of managed `thread` objects.
??? if `thrd` is not in `*this`'s list of managed `thread` objects.
void

Calls `join()` on each of the managed `thread` objects.