Skip to content
Snippets Groups Projects
Verified Commit fb3242ba authored by Jacob Lorentzon's avatar Jacob Lorentzon
Browse files

New attempt at pthread_cleanup_{push,pop}.

parent dc8ee7b2
No related branches found
No related tags found
1 merge request!380Replace pthreads-emb with a native implementation
......@@ -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)
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment