naev
0.11.5
src
threadpool.h
1
/* Copyright 2010 Reynir Reynisson
2
*
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License version 3 as
5
* published by the Free Software Foundation.
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
#pragma once
16
17
struct
ThreadQueue_
;
18
typedef
struct
ThreadQueue_
ThreadQueue;
19
20
/* Initializes the threadpool */
21
int
threadpool_init (
void
);
22
23
/* Enqueues a new job */
24
int
threadpool_newJob(
int
(*function)(
void
*),
void
*data );
25
26
/* Creates a new vpool queue. Destroy with vpool_wait. */
27
ThreadQueue* vpool_create (
void
);
28
29
/* Enqueue a job in the vpool queue. Do NOT enqueue a job that has to wait for
30
* another job to be done as this could lead to a deadlock. */
31
void
vpool_enqueue( ThreadQueue* queue,
int
(*function)(
void
*),
void
*data );
32
33
/* Run every job in the vpool queue and block until every job in the queue is
34
* done. It destroys the queue when it's done. */
35
void
vpool_wait( ThreadQueue* queue );
ThreadQueue_
Threadqueue itself.
Definition
threadpool.c:59
Generated by
1.12.0