2011-02-12 00:22:29 -05:00
|
|
|
#include "pthread_impl.h"
|
|
|
|
|
2012-02-09 02:33:08 -05:00
|
|
|
void __do_cleanup_push();
|
|
|
|
void __do_cleanup_pop();
|
2011-08-03 19:45:21 -04:00
|
|
|
|
2012-02-09 02:33:08 -05:00
|
|
|
void _pthread_cleanup_push(struct __ptcb *cb, void (*f)(void *), void *x)
|
2011-08-03 19:45:21 -04:00
|
|
|
{
|
2012-02-28 10:13:35 -05:00
|
|
|
cb->__f = f;
|
|
|
|
cb->__x = x;
|
2012-02-09 02:33:08 -05:00
|
|
|
__do_cleanup_push(cb, f, x);
|
2011-08-03 19:45:21 -04:00
|
|
|
}
|
|
|
|
|
2012-02-09 02:33:08 -05:00
|
|
|
void _pthread_cleanup_pop(struct __ptcb *cb, int run)
|
2011-02-12 00:22:29 -05:00
|
|
|
{
|
2012-02-09 02:33:08 -05:00
|
|
|
__do_cleanup_pop(cb, run);
|
2012-02-09 21:24:56 -05:00
|
|
|
if (run) cb->__f(cb->__x);
|
2011-02-12 00:22:29 -05:00
|
|
|
}
|
|
|
|
|
2012-02-09 02:33:08 -05:00
|
|
|
static void dummy()
|
2011-02-12 00:22:29 -05:00
|
|
|
{
|
|
|
|
}
|
2012-02-09 02:33:08 -05:00
|
|
|
weak_alias(dummy, __do_cleanup_push);
|
|
|
|
weak_alias(dummy, __do_cleanup_pop);
|