diff options
| author | @syxhe <https://t.me/syxhe> | 2025-05-16 19:09:02 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2025-05-16 19:09:02 -0500 |
| commit | 60715c7785e7fbe4759df64258ad58a8e2a0769d (patch) | |
| tree | 7471bc9816853518bdbc8baa02f817d5cf73594b /src/shared.h | |
| parent | 5a5ff094101d63935f7fc65c124b3e56d553522d (diff) | |
Do some more work on the concurrent queue
Diffstat (limited to 'src/shared.h')
| -rw-r--r-- | src/shared.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/shared.h b/src/shared.h index 825814e..66d1af3 100644 --- a/src/shared.h +++ b/src/shared.h | |||
| @@ -7,6 +7,9 @@ | |||
| 7 | #define FALSE 0 | 7 | #define FALSE 0 |
| 8 | #define TRUE 1 | 8 | #define TRUE 1 |
| 9 | 9 | ||
| 10 | typedef int (*gcallback)(void*); // Generic callback signature | ||
| 11 | typedef void (*fcallback)(void*); // free()-like callback signature | ||
| 12 | |||
| 10 | #define RETURNWERR(errval, retval) do {\ | 13 | #define RETURNWERR(errval, retval) do {\ |
| 11 | errno = (errval);\ | 14 | errno = (errval);\ |
| 12 | return (retval);\ | 15 | return (retval);\ |
| @@ -60,12 +63,12 @@ char * xdirname(const char * const path); | |||
| 60 | 63 | ||
| 61 | 64 | ||
| 62 | // Cleanup callback. Should act like `free()`, in that it doesn't crash if the pointer it's given is null | 65 | // Cleanup callback. Should act like `free()`, in that it doesn't crash if the pointer it's given is null |
| 63 | typedef void (*cleanup_callback)(void*); | 66 | typedef fcallback cleanup_callback; |
| 64 | 67 | ||
| 65 | // Cleanup struct. Stores a STATICALLY defined array of callbacks and void* arguments | 68 | // Cleanup struct. Stores a STATICALLY defined array of callbacks and void* arguments |
| 66 | typedef struct cl { | 69 | typedef struct cl { |
| 67 | cleanup_callback *funcs; | 70 | cleanup_callback *funcs; // Actual type: cleanup_callback funcs[] |
| 68 | void **args; | 71 | void **args; // Actual type: void *args[] |
| 69 | 72 | ||
| 70 | int size; | 73 | int size; |
| 71 | int used; | 74 | int used; |
