Frees a result 'r' and if free_data is true also frees the internal r->data result too.
Destroys a thread pool. The threads are joined into the main thread so they will finish their current work load.
@param p Thread pool @param q Process queue @param func Function run by the thread pool @param arg Data for use by func() @return 0 on success -1 on failure
@param p Thread pool @param q Process queue @param func Function run by the thread pool @param arg Data for use by func() @param nonblock Non-blocking flag (see description) @return 0 on success -1 on failure
@param p Thread pool @param q Process queue @param exec_func Function run by the thread pool @param arg Data for use by func() @param job_cleanup Callback to clean up when discarding jobs @param result_cleanup Callback to clean up when discarding result data @param nonblock Non-blocking flag (see description) @return 0 on success -1 on failure
Creates a worker pool with n worker threads.
Destroys a thread pool without waiting on jobs to complete. Use hts_tpool_kill(p) to quickly exit after a fatal error.
Pulls the next item off the process result queue. The caller should free it (and any internals as appropriate) after use. This doesn't wait for a result to be present.
Pulls the next item off the process result queue. The caller should free it (and any internals as appropriate) after use. This will wait for a result to be present if none are currently available.
Attach and detach a thread process-queue with / from the thread pool scheduler.
Deallocates memory for a thread process-queue. Must be called before the thread pool is destroyed.
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
Returns true if there are no items in the process results queue and also none still pending.
Flushes the process-queue, but doesn't exit. This simply drains the queue and ensures all worker threads have finished their current tasks associated with this process.
Initialises a thread process-queue.
Returns the number of completed jobs in the process results queue.
Returns the process queue size
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
Increment and decrement the reference count in a process-queue. If the queue is being driven from two external (non thread-pool) threads, eg "main" and a "reader", this permits each end to decrement its use of the process-queue independently.
Resets a process to the initial state.
Shutdown a process.
Returns the number of completed jobs in the process results queue plus the number running and queued up to run.
Returns the data portion of a hts_tpool_result, corresponding to the actual "result" itself.
Returns the number of requested threads for a pool.
Wakes up a single thread stuck in dispatch and make it return with errno EAGAIN.
The single pool structure itself.
An hts_tpool_process implements a queue of input jobs to process and a queue of resulting output post-processing. Internally it consists of two buffered queues, analogous to the pipes in a unix pipeline: ...input | process | output...
An output, after job has executed.
@file htslib/thread_pool.h Thread pool for multi-threading applications.