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, libdar::null_file, and libdar::tuyau.

List of all members.

Public Member Functions

 thread_cancellation ()
 the constructor
virtual ~thread_cancellation ()
 the destructor
void check_self_cancellation () const
 the checkpoint where is seen whether the current libdar call must abort
void block_delayed_cancellation (bool mode)

Static Public Member Functions

static void init ()
 must be called once before any call to thread_cancellation class's methods
static void cancel (pthread_t tid, bool x_immediate, U_64 x_flag)
 marks the thread given in argument as to be canceled
static bool cancel_status (pthread_t tid)
 gives the cancellation status of the given thread ID
static bool clear_pending_request (pthread_t tid)
 abort the pending thread cancellation
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 external program.

Definition at line 67 of file thread_cancellation.hpp.


Member Function Documentation

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

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

static void libdar::thread_cancellation::cancel ( pthread_t  tid,
bool  x_immediate,
U_64  x_flag 
) [static]

marks the thread given in argument as to be canceled

Parameters:
[in] tid the thread ID of the thread where any libdar call must abort
[in] x_immediate whether the cancellation must be as fast as possible or can take a
[in] x_flag is a value to transmit to the Ethread_cancel exception used to cancel libdar's call stack little time to make a usable archive

static bool libdar::thread_cancellation::cancel_status ( pthread_t  tid  )  [static]

gives the cancellation status of the given thread ID

Parameters:
[in] tid the thread to check
Returns:
true if the given thread is under cancellation

void libdar::thread_cancellation::check_self_cancellation (  )  const

the checkpoint where is seen whether the current libdar call must abort

Exceptions:
Euser_abort is thrown if the thread the checkpoint is running from is marked as to be canceled.

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

static bool libdar::thread_cancellation::clear_pending_request ( pthread_t  tid  )  [static]

abort the pending thread cancellation

Returns:
true if the pending thread was still running and false if it has already aborted.


The documentation for this class was generated from the following file:
Generated on Fri Jul 21 19:31:21 2006 for Disk ARchive by  doxygen 1.4.7