XZ Utils
5.4.0
|
Multithreaded .xz Stream decoder. More...
#include "common.h"
#include "block_decoder.h"
#include "stream_decoder.h"
#include "index.h"
#include "outqueue.h"
Data Structures | |
struct | worker_thread |
struct | lzma_stream_coder |
Enumerations | |
enum | worker_state { THR_IDLE , THR_RUN , THR_STOP , THR_EXIT , THR_IDLE , THR_RUN , THR_FINISH , THR_STOP , THR_EXIT } |
enum | partial_update_mode { PARTIAL_DISABLED , PARTIAL_START , PARTIAL_ENABLED } |
Functions | |
static void | worker_enable_partial_update (void *thr_ptr) |
static void | worker_stop (struct worker_thread *thr) |
static MYTHREAD_RET_TYPE | worker_decoder (void *thr_ptr) |
static void | threads_end (struct lzma_stream_coder *coder, const lzma_allocator *allocator) |
Tells the worker threads to exit and waits for them to terminate. More... | |
static void | threads_stop (struct lzma_stream_coder *coder) |
static lzma_ret | initialize_new_thread (struct lzma_stream_coder *coder, const lzma_allocator *allocator) |
Initialize a new worker_thread structure and create a new thread. More... | |
static lzma_ret | get_thread (struct lzma_stream_coder *coder, const lzma_allocator *allocator) |
static lzma_ret | read_output_and_wait (struct lzma_stream_coder *coder, const lzma_allocator *allocator, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, bool *input_is_possible, bool waiting_allowed, mythread_condtime *wait_abs, bool *has_blocked) |
static lzma_ret | decode_block_header (struct lzma_stream_coder *coder, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size) |
static size_t | comp_blk_size (const struct lzma_stream_coder *coder) |
Get the size of the Compressed Data + Block Padding + Check. More... | |
static bool | is_direct_mode_needed (lzma_vli size) |
static lzma_ret | stream_decoder_reset (struct lzma_stream_coder *coder, const lzma_allocator *allocator) |
static lzma_ret | stream_decode_mt (void *coder_ptr, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action) |
static void | stream_decoder_mt_end (void *coder_ptr, const lzma_allocator *allocator) |
static lzma_check | stream_decoder_mt_get_check (const void *coder_ptr) |
static lzma_ret | stream_decoder_mt_memconfig (void *coder_ptr, uint64_t *memusage, uint64_t *old_memlimit, uint64_t new_memlimit) |
static void | stream_decoder_mt_get_progress (void *coder_ptr, uint64_t *progress_in, uint64_t *progress_out) |
static lzma_ret | stream_decoder_mt_init (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_mt *options) |
lzma_ret | lzma_stream_decoder_mt (lzma_stream *strm, const lzma_mt *options) |
Initialize multithreaded .xz Stream decoder. More... | |
Multithreaded .xz Stream decoder.
enum worker_state |
enum partial_update_mode |
|
static |
Enables updating of outbuf->pos. This is a callback function that is used with lzma_outq_enable_partial_output().
References PARTIAL_START, and worker_thread::partial_update.
|
static |
Things do to at THR_STOP or when finishing a Block. This is called with thr->mutex locked.
References worker_thread::coder, worker_thread::in_size, lzma_stream_coder::mem_cached, worker_thread::mem_filters, lzma_stream_coder::mem_in_use, worker_thread::next, and lzma_stream_coder::threads_free.
|
static |
Tells the worker threads to exit and waits for them to terminate.
|
static |
Initialize a new worker_thread structure and create a new thread.
|
static |
Get the size of the Compressed Data + Block Padding + Check.
References lzma_stream_coder::block_options, lzma_stream_flags::check, worker_thread::coder, lzma_block::compressed_size, lzma_check_size(), lzma_stream_coder::stream_flags, and vli_ceil4().
|
static |
Returns true if the size (compressed or uncompressed) is such that threaded decompression cannot be used. Sizes that are too big compared to SIZE_MAX must be rejected to avoid integer overflows and truncations when lzma_vli is assigned to a size_t.
References LZMA_VLI_UNKNOWN.
lzma_ret lzma_stream_decoder_mt | ( | lzma_stream * | strm, |
const lzma_mt * | options | ||
) |
Initialize multithreaded .xz Stream decoder.
strm | Pointer to properly prepared lzma_stream |
options | Pointer to multithreaded compression options |
The decoder can decode multiple Blocks in parallel. This requires that each Block Header contains the Compressed Size and Uncompressed size fields which are added by the multi-threaded encoder, see lzma_stream_encoder_mt().
A Stream with one Block will only utilize one thread. A Stream with multiple Blocks but without size information in Block Headers will be processed in single-threaded mode in the same way as done by lzma_stream_decoder(). Concatenated Streams are processed one Stream at a time; no inter-Stream parallelization is done.
This function behaves like lzma_stream_decoder() when options->threads == 1 and options->memlimit_threading <= 1.
References lzma_next_strm_init.