summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_clean.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2010-09-25 06:27:09 +0000
committerdavidxu <davidxu@FreeBSD.org>2010-09-25 06:27:09 +0000
commit121f2e2d6046b2925addd629e988e5e22cbb4913 (patch)
treef35b7657d512b1644b5f02154557d5cd675bd8e8 /lib/libthr/thread/thr_clean.c
parent6f2607a695bd1cec08544ece0ef78894b503df3d (diff)
downloadFreeBSD-src-121f2e2d6046b2925addd629e988e5e22cbb4913.zip
FreeBSD-src-121f2e2d6046b2925addd629e988e5e22cbb4913.tar.gz
Because old _pthread_cleanup_push/pop do not have frame address,
it is incompatible with stack unwinding code, if they are invoked, disable stack unwinding for current thread, and when thread is exiting, print a warning message.
Diffstat (limited to 'lib/libthr/thread/thr_clean.c')
-rw-r--r--lib/libthr/thread/thr_clean.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/libthr/thread/thr_clean.c b/lib/libthr/thread/thr_clean.c
index b37a1b5..71bd94a 100644
--- a/lib/libthr/thread/thr_clean.c
+++ b/lib/libthr/thread/thr_clean.c
@@ -78,12 +78,10 @@ __pthread_cleanup_pop_imp(int execute)
void
_pthread_cleanup_push(void (*routine) (void *), void *arg)
{
-#ifdef _PTHREAD_FORCED_UNWIND
- PANIC("_pthread_cleanup_push is not supported while stack unwinding is enabled.");
-#else
struct pthread *curthread = _get_curthread();
struct pthread_cleanup *newbuf;
+ curthread->unwind_disabled = 1;
if ((newbuf = (struct pthread_cleanup *)
malloc(sizeof(struct _pthread_cleanup_info))) != NULL) {
newbuf->routine = routine;
@@ -92,15 +90,10 @@ _pthread_cleanup_push(void (*routine) (void *), void *arg)
newbuf->prev = curthread->cleanup;
curthread->cleanup = newbuf;
}
-#endif
}
void
_pthread_cleanup_pop(int execute)
{
-#ifdef _PTHREAD_FORCED_UNWIND
- PANIC("_pthread_cleanup_pop is not supported while stack unwinding is enabled.");
-#else
__pthread_cleanup_pop_imp(execute);
-#endif
}
OpenPOWER on IntegriCloud