blob: b1a8ea84a79dcaf14b013d993856043915c1c205 [file] [log] [blame]
Cody Northrop0d5881e2014-09-17 14:06:55 -06001/*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 2014 LunarG, Inc. All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26#ifndef THREADPOOL_H
27#define THREADPOOL_H
28
29#include <stdbool.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35struct _mesa_threadpool;
36struct _mesa_threadpool_task;
37
38struct _mesa_threadpool *
39_mesa_threadpool_create(int max_threads);
40
41struct _mesa_threadpool *
42_mesa_threadpool_ref(struct _mesa_threadpool *pool);
43
44void
45_mesa_threadpool_unref(struct _mesa_threadpool *pool);
46
47void
48_mesa_threadpool_join(struct _mesa_threadpool *pool, bool graceful);
49
50struct _mesa_threadpool_task *
51_mesa_threadpool_queue_task(struct _mesa_threadpool *pool,
52 void (*func)(void *), void *data);
53
54bool
55_mesa_threadpool_complete_tasks(struct _mesa_threadpool *pool,
56 struct _mesa_threadpool_task **tasks,
57 int num_tasks);
58
59bool
60_mesa_threadpool_complete_task(struct _mesa_threadpool *pool,
61 struct _mesa_threadpool_task *task);
62
63struct _mesa_threadpool *
64_mesa_glsl_get_threadpool(int max_threads);
65
66void
67_mesa_glsl_wait_threadpool(void);
68
69void
70_mesa_glsl_destroy_threadpool(void);
71
72#ifdef __cplusplus
73}
74#endif
75
76#endif /* THREADPOOL_H */