thread-safety in the atexit function, justin case

This commit is contained in:
tg 2008-11-15 07:59:46 +00:00
parent 24a23d52d8
commit d8bc1cf161

View File

@ -1,6 +1,6 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/aalloc.c,v 1.27 2008/11/15 07:51:53 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/aalloc.c,v 1.28 2008/11/15 07:59:46 tg Exp $");
/* mksh integration of aalloc */ /* mksh integration of aalloc */
@ -282,6 +282,7 @@ track_check(void)
TPtr lp; TPtr lp;
PBlock bp; PBlock bp;
AALLOC_THREAD_ENTER(NULL)
while (track) { while (track) {
tp = track; tp = track;
tp->ocookie ^= gcookie; tp->ocookie ^= gcookie;
@ -295,7 +296,7 @@ track_check(void)
AALLOC_WARN("AALLOC_TRACK data structure %p destroyed:" AALLOC_WARN("AALLOC_TRACK data structure %p destroyed:"
" %p, %p, %p; exiting", tp, lp.pv, tp->bp.pv, " %p, %p, %p; exiting", tp, lp.pv, tp->bp.pv,
(void *)tp->ocookie); (void *)tp->ocookie);
return; break;
} }
if (!(bp = check_bp(tp, "atexit:track_check", tp->ocookie))) if (!(bp = check_bp(tp, "atexit:track_check", tp->ocookie)))
goto track_next; goto track_next;
@ -313,6 +314,8 @@ track_check(void)
track = (PArea)lp.pv; track = (PArea)lp.pv;
free(tp); free(tp);
} }
track = NULL;
AALLOC_THREAD_LEAVE(NULL)
} }
#endif #endif