| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#if !defined (DEX_INSIDE) && !defined (DEX_COMPILATION) |
| 24 |
# error "Only <libdex.h> can be included directly." |
| 25 |
#endif |
| 26 |
|
| 27 |
#include "dex-future.h" |
| 28 |
#include "dex-thread.h" |
| 29 |
#include "dex-version-macros.h" |
| 30 |
|
| 31 |
G_BEGIN_DECLS |
| 32 |
|
| 33 |
#define DEX_TYPE_THREAD_POOL (dex_thread_pool_get_type()) |
| 34 |
#define DEX_THREAD_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj, DEX_TYPE_THREAD_POOL, DexThreadPool)) |
| 35 |
#define DEX_IS_THREAD_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, DEX_TYPE_THREAD_POOL)) |
| 36 |
|
| 37 |
typedef struct _DexThreadPool DexThreadPool; |
| 38 |
|
| 39 |
typedef enum |
| 40 |
{ |
| 41 |
DEX_THREAD_POOL_SHUTDOWN_DRAIN, |
| 42 |
DEX_THREAD_POOL_SHUTDOWN_CANCEL_QUEUED, |
| 43 |
} DexThreadPoolShutdownMode; |
| 44 |
|
| 45 |
DEX_AVAILABLE_IN_1_2 |
| 46 |
GType dex_thread_pool_get_type (void); |
| 47 |
DEX_AVAILABLE_IN_1_2 |
| 48 |
DexThreadPool *dex_thread_pool_new (guint n_threads); |
| 49 |
DEX_AVAILABLE_IN_1_2 |
| 50 |
guint dex_thread_pool_get_n_threads (DexThreadPool *pool); |
| 51 |
DEX_AVAILABLE_IN_1_2 |
| 52 |
DexFuture *dex_thread_pool_submit (DexThreadPool *pool, |
| 53 |
const char *thread_name, |
| 54 |
DexThreadFunc thread_func, |
| 55 |
gpointer user_data, |
| 56 |
GDestroyNotify user_data_destroy) G_GNUC_WARN_UNUSED_RESULT; |
| 57 |
DEX_AVAILABLE_IN_1_2 |
| 58 |
DexFuture *dex_thread_pool_close (DexThreadPool *pool, |
| 59 |
DexThreadPoolShutdownMode mode) G_GNUC_WARN_UNUSED_RESULT; |
| 60 |
|
| 61 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DexThreadPool, dex_unref) |
| 62 |
|
| 63 |
G_END_DECLS |