Disk ARchive: libdar::thread_cancellation Class Reference

| Disk ARchive 2.8.1 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
libdar::thread_cancellation Class Reference
Private

class to be used as parent to provide checkpoints to inherited classes More...

`#include <thread_cancellation.hpp>`

Inherited by libdar::fichier_global, libdar::null_file, and libdar::tuyau.

## Public Member Functions
| thread_cancellation ()
| the constructor
| thread_cancellation (const thread_cancellation &ref)=default
| copy constructor
| thread_cancellation (thread_cancellation &&ref) noexcept=default
| move constructor
thread_cancellation & | operator= (const thread_cancellation &ref)=default
| assignment operator
thread_cancellation & | operator= (thread_cancellation &&ref) noexcept=default
| move operator
virtual | ~thread_cancellation () noexcept(false)
| the destructor
void | check_self_cancellation () const
| Checkpoint test : whether the current libdar call must abort or not.
bool | self_is_under_cancellation () const
| get the current thread status
void | block_delayed_cancellation (bool mode)

## Static Public Member Functions
static U_I | count ()
| method for debugging/control purposes

## Detailed Description

class to be used as parent to provide checkpoints to inherited classes

the class provides a checkpoints to inherited classes and a mechanism that let any libdar external code to ask the termination of a libdar call executing in a given thread. This does not imply the termination of the thread itself but it implies the return of the thread execution to the code that called libdar

Definition at line 68 of file thread_cancellation.hpp.

## Member Function Documentation

## ◆ block_delayed_cancellation()

void libdar::thread_cancellation::block_delayed_cancellation | ( | bool | mode | ) |

by default delayed (non immediate) cancellation generate a specific exception, it is possible for delayed cancellation only, do block such exceptions for a certain time

Parameters

  [in] | mode | can be set to true to block delayed cancellations

Note
  when unblocking delayed cancellations, if a delayed cancellation has been requested during the ignore time, it will be thrown by this call

References block_delayed_cancellation().

Referenced by block_delayed_cancellation().

## ◆ check_self_cancellation()

void libdar::thread_cancellation::check_self_cancellation | ( |  | ) | const

Checkpoint test : whether the current libdar call must abort or not.

Exceptions

  Ethread_cancel | is thrown if the thread the checkpoint is running from is marked as to be canceled.

References check_self_cancellation().

Referenced by check_self_cancellation(), libdar::null_file::inherited_read(), and libdar::null_file::inherited_write().

## ◆ count()

U_I libdar::thread_cancellation::count | ( |  | ) |
| inlinestatic

method for debugging/control purposes

Definition at line 159 of file thread_cancellation.hpp.

## ◆ self_is_under_cancellation()

bool libdar::thread_cancellation::self_is_under_cancellation | ( |  | ) | const

get the current thread status

at the difference of check_self_cancellation() which throws an exception self_is_under_cancellation() return true if cancellation has been request for that thread and false if not. An exception may have already been thrown or not yet thrown by a call to check_self_cancellation(), this is independent.

References self_is_under_cancellation().

Referenced by self_is_under_cancellation().

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

- thread_cancellation.hpp