c++-gtk-utils
|
A class enabling the cancellation state of a thread to be controlled. More...
#include <c++-gtk-utils/thread.h>
Public Member Functions | |
CancelBlock (const CancelBlock &) | |
CancelBlock & | operator= (const CancelBlock &) |
int | restore (int &old_state) |
int | restore () |
CancelBlock (bool blocking=true) | |
~CancelBlock () |
Static Public Member Functions | |
static int | block (int &old_state) |
static int | block () |
static int | unblock (int &old_state) |
static int | unblock () |
A class enabling the cancellation state of a thread to be controlled.
A class enabling the cancellation state of a thread to be controlled, so as to provide exception safe cancellation state changes. When the object goes out of scope, cancellation state is returned to the state it was in prior to its construction.
Cgu::Thread::CancelBlock::CancelBlock | ( | const CancelBlock & | ) |
This class cannot be copied. The copy constructor is deleted.
Cgu::Thread::CancelBlock::CancelBlock | ( | bool | blocking = true | ) |
The constructor will not throw.
blocking | Whether the CancelBlock object should start in blocking mode. |
|
inline |
The destructor will put the thread in the cancellation state that it was in immediately before the CancelBlock object was constructed (which might be blocking). It will not throw.
|
inlinestatic |
Makes the thread uncancellable, even if the code passes through a cancellation point, while the CancelBlock object exists (when the CancelBlock object ceases to exist, cancellation state is returned to the state prior to it being constructed). It should only be called by the thread which created the CancelBlock object. This method will not throw.
old_state | Indicates the cancellation state of the calling thread immediately before this call to block() was made, either PTHREAD_CANCEL_ENABLE (if the thread was previously cancellable) or PTHREAD_CANCEL_DISABLE (if this call did nothing because the thread was already uncancellable). |
|
inlinestatic |
Makes the thread uncancellable, even if the code passes through a cancellation point, while the CancelBlock object exists (when the CancelBlock object ceases to exist, cancellation state is returned to the state prior to it being constructed). It should only be called by the thread which created the CancelBlock object. This method will not throw.
CancelBlock& Cgu::Thread::CancelBlock::operator= | ( | const CancelBlock & | ) |
This class cannot be copied. The assignment operator is deleted.
|
inline |
Restores cancellation state to the state it was in immediately before this CancelBlock object was constructed. It should only be called by the thread which created the CancelBlock object. This method will not throw.
old_state | Indicates the cancellation state of the calling thread immediately before this call to restore() was made, either PTHREAD_CANCEL_DISABLE (if the thread was previously uncancellable) or PTHREAD_CANCEL_ENABLE (if this thread was previously cancellable). |
|
inline |
Restores cancellation state to the state it was in immediately before this CancelBlock object was constructed. It should only be called by the thread which created the CancelBlock object. This method will not throw.
|
inlinestatic |
Makes the thread cancellable while the CancelBlock object exists (when the CancelBlock object ceases to exist, cancellation state is returned to the state prior to it being constructed). It should only be called by the thread which created the CancelBlock object. This method will not throw.
old_state | Indicates the cancellation state of the calling thread immediately before this call to unblock() was made, either PTHREAD_CANCEL_DISABLE (if the thread was previously uncancellable) or PTHREAD_CANCEL_ENABLE (if this call did nothing because the thread was already cancellable). |
|
inlinestatic |
Makes the thread cancellable while the CancelBlock object exists (when the CancelBlock object ceases to exist, cancellation state is returned to the state prior to it being constructed). It should only be called by the thread which created the CancelBlock object. This method will not throw.