2014-05-13 09:28:15 +00:00
|
|
|
#ifndef THREADQUEUE_H_
|
|
|
|
#define THREADQUEUE_H_
|
|
|
|
/*****************************************************************************
|
|
|
|
* This file is part of Kvazaar HEVC encoder.
|
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Copyright (C) 2013-2015 Tampere University of Technology and others (see
|
2014-05-13 09:28:15 +00:00
|
|
|
* COPYING file).
|
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Kvazaar is free software: you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2.1 of the License, or (at your
|
|
|
|
* option) any later version.
|
2014-05-13 09:28:15 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Kvazaar is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
|
|
* more details.
|
2014-05-13 09:28:15 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with Kvazaar. If not, see <http://www.gnu.org/licenses/>.
|
2014-05-13 09:28:15 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
2015-12-17 11:42:57 +00:00
|
|
|
/**
|
|
|
|
* \ingroup Threading
|
|
|
|
* \file
|
|
|
|
* Container for worker tasks.
|
|
|
|
*/
|
|
|
|
|
2014-05-13 09:28:15 +00:00
|
|
|
#include <pthread.h>
|
2016-04-01 14:14:23 +00:00
|
|
|
|
|
|
|
#include "global.h" // IWYU pragma: keep
|
2014-05-13 09:28:15 +00:00
|
|
|
|
2017-07-20 12:23:18 +00:00
|
|
|
typedef struct threadqueue_job_t threadqueue_job_t;
|
|
|
|
typedef struct threadqueue_queue_t threadqueue_queue_t;
|
2014-05-13 09:28:15 +00:00
|
|
|
|
2017-07-20 12:23:18 +00:00
|
|
|
threadqueue_queue_t * kvz_threadqueue_init(int thread_count);
|
2017-04-04 12:36:08 +00:00
|
|
|
|
2017-07-20 12:23:18 +00:00
|
|
|
threadqueue_job_t * kvz_threadqueue_job_create(void (*fptr)(void *arg), void *arg);
|
|
|
|
int kvz_threadqueue_submit(threadqueue_queue_t * threadqueue, threadqueue_job_t *job);
|
2017-04-04 12:36:08 +00:00
|
|
|
|
2017-07-20 12:23:18 +00:00
|
|
|
int kvz_threadqueue_job_dep_add(threadqueue_job_t *job, threadqueue_job_t *dependency);
|
2017-04-04 12:36:08 +00:00
|
|
|
|
|
|
|
threadqueue_job_t *kvz_threadqueue_copy_ref(threadqueue_job_t *job);
|
|
|
|
|
2017-07-20 12:23:18 +00:00
|
|
|
void kvz_threadqueue_free_job(threadqueue_job_t **job_ptr);
|
2014-05-13 09:28:15 +00:00
|
|
|
|
2015-08-26 08:50:27 +00:00
|
|
|
int kvz_threadqueue_waitfor(threadqueue_queue_t * threadqueue, threadqueue_job_t * job);
|
2017-07-20 12:23:18 +00:00
|
|
|
int kvz_threadqueue_stop(threadqueue_queue_t * threadqueue);
|
|
|
|
void kvz_threadqueue_free(threadqueue_queue_t * threadqueue);
|
2014-06-05 07:09:25 +00:00
|
|
|
|
2017-07-20 12:23:18 +00:00
|
|
|
#endif // THREADQUEUE_H_
|