TUT HEVC Encoder
threadqueue.h
Go to the documentation of this file.
1#ifndef THREADQUEUE_H_
2#define THREADQUEUE_H_
3/*****************************************************************************
4 * This file is part of Kvazaar HEVC encoder.
5 *
6 * Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice, this
16 * list of conditions and the following disclaimer in the documentation and/or
17 * other materials provided with the distribution.
18 *
19 * * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 ****************************************************************************/
34
41#include "global.h" // IWYU pragma: keep
42
43#include <pthread.h>
44
47
49
50threadqueue_job_t * kvz_threadqueue_job_create(void (*fptr)(void *arg), void *arg);
52
54
56
58
62
63#endif // THREADQUEUE_H_
Header that is included in every other header.
Definition: threadqueue.c:127
Definition: threadqueue.c:178
int thread_count
Number of threads spawned.
Definition: threadqueue.c:203
threadqueue_queue_t * kvz_threadqueue_init(int thread_count)
Initialize the queue.
Definition: threadqueue.c:357
void kvz_threadqueue_free_job(threadqueue_job_t **job_ptr)
Free a job.
Definition: threadqueue.c:531
int kvz_threadqueue_job_dep_add(threadqueue_job_t *job, threadqueue_job_t *dependency)
Add a dependency between two jobs.
Definition: threadqueue.c:478
threadqueue_job_t * kvz_threadqueue_job_create(void(*fptr)(void *arg), void *arg)
Create a job and return a pointer to it.
Definition: threadqueue.c:420
int kvz_threadqueue_stop(threadqueue_queue_t *threadqueue)
Stop all threads after they finish the current jobs.
Definition: threadqueue.c:580
int kvz_threadqueue_waitfor(threadqueue_queue_t *threadqueue, threadqueue_job_t *job)
Wait for a job to be completed.
Definition: threadqueue.c:561
threadqueue_job_t * kvz_threadqueue_copy_ref(threadqueue_job_t *job)
Get a new pointer to a job.
Definition: threadqueue.c:513
int kvz_threadqueue_submit(threadqueue_queue_t *threadqueue, threadqueue_job_t *job)
Definition: threadqueue.c:446
void kvz_threadqueue_free(threadqueue_queue_t *threadqueue)
Stop all threads and free allocated resources.
Definition: threadqueue.c:613