New attempt at pthread_cleanup_{push,pop}.

This commit is contained in:
4lDO2
2023-04-26 15:54:32 +02:00
parent dc8ee7b2f0
commit fb3242badc
+14 -12
View File
@@ -10,20 +10,22 @@ after_includes = """
#define PTHREAD_ONCE_INIT ((pthread_once_t){0})
#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t){0})
#define pthread_cleanup_push(routine, arg) { \
struct { \
void (*routine)(void *); \
void *arg; \
void *prev; \
} __relibc_internal_pthread_ll_entry = { \
.routine = (routine), \
.arg = (arg), \
}; \
__relibc_internal_pthread_cleanup_push(&__relibc_internal_pthread_ll_entry);
#define pthread_cleanup_push(routine, arg) do { \
do { \
struct { \
void (*routine)(void *); \
void *arg; \
void *prev; \
} __relibc_internal_pthread_ll_entry = { \
.routine = (routine), \
.arg = (arg), \
}; \
__relibc_internal_pthread_cleanup_push(&__relibc_internal_pthread_ll_entry); \
} while(0)
#define pthread_cleanup_pop(execute) \
__relibc_internal_pthread_cleanup_pop(&__relibc_internal_pthread_ll_entry, (execute)); \
}
__relibc_internal_pthread_cleanup_pop((execute)); \
} while(0)
"""