blob: 5a0bcf19448be38868c6c794facd633fb115ec14 (
plain) (
tree)
|
|
# 1 "main.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "main.c"
# 1 "../threadpool.h" 1
# 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stdatomic.h" 1 3 4
# 29 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stdatomic.h" 3 4
# 29 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stdatomic.h" 3 4
typedef enum {
memory_order_relaxed = 0,
memory_order_consume = 1,
memory_order_acquire = 2,
memory_order_release = 3,
memory_order_acq_rel = 4,
memory_order_seq_cst = 5
} memory_order;
typedef _Atomic _Bool atomic_bool;
typedef _Atomic char atomic_char;
typedef _Atomic signed char atomic_schar;
typedef _Atomic unsigned char atomic_uchar;
typedef _Atomic short atomic_short;
typedef _Atomic unsigned short atomic_ushort;
typedef _Atomic int atomic_int;
typedef _Atomic unsigned int atomic_uint;
typedef _Atomic long atomic_long;
typedef _Atomic unsigned long atomic_ulong;
typedef _Atomic long long atomic_llong;
typedef _Atomic unsigned long long atomic_ullong;
typedef _Atomic short unsigned int atomic_char16_t;
typedef _Atomic unsigned int atomic_char32_t;
typedef _Atomic int atomic_wchar_t;
typedef _Atomic signed char atomic_int_least8_t;
typedef _Atomic unsigned char atomic_uint_least8_t;
typedef _Atomic short int atomic_int_least16_t;
typedef _Atomic short unsigned int atomic_uint_least16_t;
typedef _Atomic int atomic_int_least32_t;
typedef _Atomic unsigned int atomic_uint_least32_t;
typedef _Atomic long int atomic_int_least64_t;
typedef _Atomic long unsigned int atomic_uint_least64_t;
typedef _Atomic signed char atomic_int_fast8_t;
typedef _Atomic unsigned char atomic_uint_fast8_t;
typedef _Atomic long int atomic_int_fast16_t;
typedef _Atomic long unsigned int atomic_uint_fast16_t;
typedef _Atomic long int atomic_int_fast32_t;
typedef _Atomic long unsigned int atomic_uint_fast32_t;
typedef _Atomic long int atomic_int_fast64_t;
typedef _Atomic long unsigned int atomic_uint_fast64_t;
typedef _Atomic long int atomic_intptr_t;
typedef _Atomic long unsigned int atomic_uintptr_t;
typedef _Atomic long unsigned int atomic_size_t;
typedef _Atomic long int atomic_ptrdiff_t;
typedef _Atomic long int atomic_intmax_t;
typedef _Atomic long unsigned int atomic_uintmax_t;
# 92 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stdatomic.h" 3 4
extern void atomic_thread_fence(memory_order);
extern void atomic_signal_fence(memory_order);
# 218 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stdatomic.h" 3 4
typedef _Atomic struct {
_Bool __val;
} atomic_flag;
extern _Bool atomic_flag_test_and_set(volatile atomic_flag *);
extern _Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *,
memory_order);
extern void atomic_flag_clear(volatile atomic_flag *);
extern void atomic_flag_clear_explicit(volatile atomic_flag *, memory_order);
# 5 "../threadpool.h" 2
# 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stddef.h" 1 3 4
# 143 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stddef.h" 3 4
typedef long int ptrdiff_t;
# 209 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stddef.h" 3 4
typedef long unsigned int size_t;
# 321 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stddef.h" 3 4
typedef int wchar_t;
# 415 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stddef.h" 3 4
typedef struct {
long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
# 426 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stddef.h" 3 4
} max_align_t;
# 6 "../threadpool.h" 2
# 1 "../ppmlib/ppmlib.h" 1
# 16 "../ppmlib/ppmlib.h"
# 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include/stddef.h" 1 3 4
# 17 "../ppmlib/ppmlib.h" 2
# 7 "../threadpool.h" 2
# 13 "../threadpool.h"
typedef void (*ThreadTask_f)(void *);
typedef atomic_char FutureStatus;
enum FurutureStatusEnum {
FUT_WAITING = 0, FUT_IN_PROGRESS = 1, FUT_DONE = 2
};
typedef struct Future {
ThreadTask_f fn;
FutureStatus status;
} Future;
# 33 "../threadpool.h"
extern int tpInit(size_t size);
extern void tpRelease(void);
# 52 "../threadpool.h"
extern void tpAsync(Future *future);
# 63 "../threadpool.h"
extern void tpAwait(Future *future);
# 2 "main.c" 2
int test_func(int);
typedef struct {
Future fut;
int int_3;
int res;
} test_func_fut;
static void test_funcThunk(void *args) {
test_func_fut *data = args;
data->res = test_func(data->int_3);
}
static inline test_func_fut test_funcFuture(
int int_3) { return (test_func_fut) {.fut = {.fn = &test_funcThunk, .status=FUT_WAITING}, .int_3 = int_3}; }
static inline test_func_fut *test_funcAsync(test_func_fut *future) { return tpAsync(&future->fut), future; }
static inline int test_funcAwait(test_func_fut *future) { return tpAwait(&future->fut), future->res; }
|