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

Namespaces

namespace  FutureHelper
 
namespace  TaskManagerHelper
 

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 , class Func >
Cgu::IntrusivePtr
< Cgu::Thread::Future< Ret > > 
make_future (Func &&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 
)
Deprecated:

DEPRECATED. Use the version of make_future() which takes a callable object.

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 
)
Deprecated:

DEPRECATED. Use the version of make_future() which takes a callable object.

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 
)
Deprecated:

DEPRECATED. Use the version of make_future() which takes a callable object.

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 Func >
Cgu::IntrusivePtr<Cgu::Thread::Future<Ret> > Cgu::Thread::make_future ( Func &&  func)

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

Parameters
funcA callable object, such as formed by a lambda expression or the result of std::bind. It must be fully bound (that is, its must take no arguments when called). It should return a value (it cannot return void).
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
1. This method will also throw if the copy or move constructor of the callable object passed as an argument throws, or the default constructor of the return value type of the function represented by the new object throws.
2. If the callable object passed as an argument has both const and non-const operator()() methods, the non-const version will be called even if the callable object passed is a const object.

Since 2.0.14