cxxtools::ThreadPool::Future Class Reference

The Future class monitors the state of a job, which runs in the thread pool. More...

#include <cxxtools/threadpool.h>

Public Member Functions

 Future ()
 A Future is default constructable.
 Future (const Future &f)
 A Future is copyable.
Futureoperator= (const Future &f)
 A Future is assignable.
 ~Future ()
bool wait (Seconds timeout=-1) const
 Wait up to timeout seconds for termination.
bool isWaiting () const
 Returns true, when the job is waiting to be run on a thread.
bool isRunning () const
 Returns true, when the job is currently running on a thread.
bool isFinished () const
 Returns true, when the job is finished.
bool isCanceled () const
 Returns true, when the job is canceled.
bool isFailed () const
 Returns true, when the job was finished with exceptoin.

Friends

class ThreadPoolImpl

Detailed Description

The Future class monitors the state of a job, which runs in the thread pool.

When a job is run on the thread pool, a future is returned. The user can wait for the future to be finished. Futures can be copied, in which case all instances point to the same instance.

Constructor & Destructor Documentation

cxxtools::ThreadPool::Future::Future ( )
inline

A Future is default constructable.

cxxtools::ThreadPool::Future::Future ( const Future f)

A Future is copyable.

cxxtools::ThreadPool::Future::~Future ( )

Member Function Documentation

bool cxxtools::ThreadPool::Future::isCanceled ( ) const

Returns true, when the job is canceled.

Canceled means, that the thread pool is stopped before the job started.

bool cxxtools::ThreadPool::Future::isFailed ( ) const

Returns true, when the job was finished with exceptoin.

bool cxxtools::ThreadPool::Future::isFinished ( ) const

Returns true, when the job is finished.

Finished may be either successfully finished, finished by exception or canceled because the thread pool is stopped before the job started to run.

bool cxxtools::ThreadPool::Future::isRunning ( ) const

Returns true, when the job is currently running on a thread.

bool cxxtools::ThreadPool::Future::isWaiting ( ) const

Returns true, when the job is waiting to be run on a thread.

Future& cxxtools::ThreadPool::Future::operator= ( const Future f)

A Future is assignable.

bool cxxtools::ThreadPool::Future::wait ( Seconds  timeout = -1) const

Wait up to timeout seconds for termination.

Wait up to timeout seconds for termination. Return true when job was finished before timeout.

Friends And Related Function Documentation

friend class ThreadPoolImpl
friend

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