#define pthread_cleanup_push(func, val) \
{ \
struct __darwin_pthread_handler_rec __handler; \
pthread_t __self = pthread_self(); \
__handler.__routine = func; \
__handler.__arg = val; \
__handler.__next = __self->__cleanup_stack; \
__self->__cleanup_stack = &__handler;
#define pthread_cleanup_pop(execute) \
/* Note: 'handler' must be in this same lexical context! */ \
__self->__cleanup_stack = __handler.__next; \
if (execute) (__handler.__routine)(__handler.__arg); \
}