27 #ifndef GENERIC_THREAD_HPP 28 #define GENERIC_THREAD_HPP 30 #include "../my_config.h" 48 static constexpr
unsigned int tampon_block_size = 102401;
49 static constexpr
unsigned int tampon_num_block = 1000;
50 static constexpr
unsigned int tampon_block_size_ctrl = 1024;
51 static constexpr
unsigned int tampon_num_block_ctrl = 10;
63 U_I data_block_size = tampon_block_size,
64 U_I data_num_block = tampon_num_block,
65 U_I ctrl_block_size = tampon_block_size_ctrl,
66 U_I ctrl_num_block = tampon_num_block_ctrl);
97 libthreadar::fast_tampon<char> toslave_data;
98 libthreadar::fast_tampon<char> tomaster_data;
99 libthreadar::fast_tampon<char> toslave_ctrl;
100 libthreadar::fast_tampon<char> tomaster_ctrl;
101 slave_thread *remote;
118 void check_answer(
msg_type expected);
120 void release_block_answer() { tomaster_ctrl.fetch_recycle(ptr); ptr =
nullptr; };
121 void release_data_ptr();
generic_thread(generic_file *ptr, U_I data_block_size=tampon_block_size, U_I data_num_block=tampon_num_block, U_I ctrl_block_size=tampon_block_size_ctrl, U_I ctrl_num_block=tampon_num_block_ctrl)
constructor
class slave_thread is runs a I/O operations on a given generic_file in a separated thread ...
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
void purge_data_pipe()
drops all data in the toslave_data pipe
char data_header
contains 1 byte header for data
virtual U_I inherited_read(char *a, U_I size) override
implementation of read() operation
virtual void inherited_read_ahead(const infinint &amount) override
tells the object that several calls to read() will follow to probably obtain at least the given amoun...
let a generic_file be managed by another thread
virtual bool skip_relative(S_I x) override
skip relatively to the current position
virtual bool skippable(skippability direction, const infinint &amount) override
whether the implementation is able to skip
virtual infinint get_position() const override
get the current read/write position
messaging_decode and messaging_encode are used to insert messages in a flow of data blocks ...
char data_header_eof
contains 1 byte header for data + eof
decoding received messages
encoding messages to be sent
virtual void inherited_write(const char *a, U_I size) override
implementation of the write() operation
void wake_up_slave_if_asked()
check whether an order to wakeup the slave has been received, and send wake up the slave ...
pthread_t tid
thread id of remote
virtual bool skip(const infinint &pos) override
skip at the absolute position
virtual void inherited_sync_write() override
generic_file inherited method to sync all pending writes
virtual bool skip_to_eof() override
skip to the end of file
bool reached_eof
whether we reached end of file
this is the interface class from which all other data transfer classes inherit
manage label data structure used in archive slice headers
bool running
whether a remote is expected to run, tid is then set
msg_type
the different types of messages
the arbitrary large positive integer class
libdar namespace encapsulate all libdar symbols
virtual void inherited_flush_read() override
reset internal engine, flush caches in order to read the data at current position ...
virtual void inherited_terminate() override
destructor-like call, except that it is allowed to throw exceptions