c++-gtk-utils
Classes | Enumerations | Functions
Cgu::Thread Namespace Reference

Classes

struct  FutureThreadError
struct  FutureWhenError
class  Future
 A class representing a pthread thread which will provide a value. More...
struct  CondError
struct  MutexError
struct  RecMutexError
class  Mutex
 A wrapper class for pthread mutexes. More...
class  Cond
 A wrapper class for pthread condition variables. More...
class  RecMutex
 A wrapper class for pthread mutexes which provides a recursive mutex. More...
class  GrecmutexLock
 A scoped locking class for exception safe locking of GStaticRecMutex objects. More...
struct  RWLockError
class  RWLock
 A wrapper class for pthread read-write locks. More...
struct  TaskError
class  TaskManager
 A thread-pool class for managing tasks in multi-threaded programs. More...
class  Thread
 A class representing a pthread thread. More...
class  JoinableHandle
 A class wrapping a Thread::Thread object representing a joinable thread. More...
class  CancelBlock
 A class enabling the cancellation state of a thread to be controlled. More...
class  Exit
 A class which can be thrown to terminate the throwing thread. More...

Enumerations

enum  Locked { locked }
enum  DeferLock { defer }

Functions

template<class Obj , class Ret , class... Params, class... Args>
Cgu::IntrusivePtr
< Cgu::Thread::Future< Ret > > 
make_future (Obj &obj, Ret(Obj::*func)(Params...), Args &&...args)
template<class Obj , class Ret , class... Params, class... Args>
Cgu::IntrusivePtr
< Cgu::Thread::Future< Ret > > 
make_future (const Obj &obj, Ret(Obj::*func)(Params...) const, Args &&...args)
template<class Ret , class... Params, class... Args>
Cgu::IntrusivePtr
< Cgu::Thread::Future< Ret > > 
make_future (Ret(*func)(Params...), Args &&...args)
template<class Ret >
Cgu::IntrusivePtr
< Cgu::Thread::Future< Ret > > 
make_future (const std::function< Ret(void)> &func)
template<class Ret >
Cgu::IntrusivePtr
< Cgu::Thread::Future< Ret > > 
make_future (std::function< Ret(void)> &&func)

Enumeration Type Documentation

Enumerator:
defer 
Enumerator:
locked 

Function Documentation

template<class Obj , class Ret , class... Params, class... Args>
Cgu::IntrusivePtr<Cgu::Thread::Future<Ret> > Cgu::Thread::make_future ( Obj &  obj,
Ret(Obj::*)(Params...)  func,
Args &&...  args 
)

A convenience helper function which calls Cgu::Thread::Future::make() to obtain a Future object without the need to specify the return value of the function represented by the new object: that is deduced from the signature of that function. This is useful shorthand when also employed with the C++11 'auto' keyword.

Exceptions:
std::bad_allocIt might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the –with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.)
Cgu::Thread::MutexErrorIt might throw Cgu::Thread::MutexError if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.)
Cgu::Thread::CondErrorIt might throw Cgu::Thread::CondError if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.)
Note:
This method will also throw if the copy or move constructor of a bound argument throws, or the default constructor of the return value type of the function represented by the new object throws.

Since 2.0.4

template<class Obj , class Ret , class... Params, class... Args>
Cgu::IntrusivePtr<Cgu::Thread::Future<Ret> > Cgu::Thread::make_future ( const Obj &  obj,
Ret(Obj::*)(Params...) const  func,
Args &&...  args 
)

A convenience helper function which calls Cgu::Thread::Future::make() to obtain a Future object without the need to specify the return value of the function represented by the new object: that is deduced from the signature of that function. This is useful shorthand when also employed with the C++11 'auto' keyword.

Exceptions:
std::bad_allocIt might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the –with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.)
Cgu::Thread::MutexErrorIt might throw Cgu::Thread::MutexError if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.)
Cgu::Thread::CondErrorIt might throw Cgu::Thread::CondError if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.)
Note:
This method will also throw if the copy or move constructor of a bound argument throws, or the default constructor of the return value type of the function represented by the new object throws.

Since 2.0.4

template<class Ret , class... Params, class... Args>
Cgu::IntrusivePtr<Cgu::Thread::Future<Ret> > Cgu::Thread::make_future ( Ret(*)(Params...)  func,
Args &&...  args 
)

A convenience helper function which calls Cgu::Thread::Future::make() to obtain a Future object without the need to specify the return value of the function represented by the new object: that is deduced from the signature of that function. This is useful shorthand when also employed with the C++11 'auto' keyword.

Exceptions:
std::bad_allocIt might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the –with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.)
Cgu::Thread::MutexErrorIt might throw Cgu::Thread::MutexError if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.)
Cgu::Thread::CondErrorIt might throw Cgu::Thread::CondError if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.)
Note:
This method will also throw if the copy or move constructor of a bound argument throws, or the default constructor of the return value type of the function represented by the new object throws.

Since 2.0.4

template<class Ret >
Cgu::IntrusivePtr<Cgu::Thread::Future<Ret> > Cgu::Thread::make_future ( const std::function< Ret(void)> &  func)

A convenience helper function which calls Cgu::Thread::Future::make() to obtain a Future object without the need to specify the return value of the function represented by the new object: that is deduced from the signature of that function. This is useful shorthand when also employed with the C++11 'auto' keyword.

Exceptions:
std::bad_allocIt might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the –with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.)
Cgu::Thread::MutexErrorIt might throw Cgu::Thread::MutexError if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.)
Cgu::Thread::CondErrorIt might throw Cgu::Thread::CondError if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.)
Note:
This method will also throw if the copy or move constructor of a bound argument throws, or the default constructor of the return value type of the function represented by the new object throws.

Since 2.0.4

template<class Ret >
Cgu::IntrusivePtr<Cgu::Thread::Future<Ret> > Cgu::Thread::make_future ( std::function< Ret(void)> &&  func)

A convenience helper function which calls Cgu::Thread::Future::make() to obtain a Future object without the need to specify the return value of the function represented by the new object: that is deduced from the signature of that function. This is useful shorthand when also employed with the C++11 'auto' keyword.

Exceptions:
std::bad_allocIt might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the –with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.)
Cgu::Thread::MutexErrorIt might throw Cgu::Thread::MutexError if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.)
Cgu::Thread::CondErrorIt might throw Cgu::Thread::CondError if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.)
Note:
This method will also throw if the copy or move constructor of a bound argument throws, or the default constructor of the return value type of the function represented by the new object throws.

Since 2.0.4