diff options
author | dchagin <dchagin@FreeBSD.org> | 2015-05-24 14:51:29 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2015-05-24 14:51:29 +0000 |
commit | ca0fda407756a0fda8db3d6d464117c2c88b48d0 (patch) | |
tree | 29e72220b49ea68b1cf3385e3c206b1a59e70098 /sys/kern/kern_thread.c | |
parent | 745df0287fcf54634f0950689d0ffaebcfed8d8c (diff) | |
download | FreeBSD-src-ca0fda407756a0fda8db3d6d464117c2c88b48d0.zip FreeBSD-src-ca0fda407756a0fda8db3d6d464117c2c88b48d0.tar.gz |
In preparation for switching linuxulator to the use the native 1:1
threads add a hook for cleaning thread resources before the thread die.
Differential Revision: https://reviews.freebsd.org/D1038
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r-- | sys/kern/kern_thread.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 0dd5f46..dce760c 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sched.h> #include <sys/sleepqueue.h> #include <sys/selinfo.h> +#include <sys/sysent.h> #include <sys/turnstile.h> #include <sys/ktr.h> #include <sys/rwlock.h> @@ -884,6 +885,14 @@ thread_suspend_check(int return_instead) if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { PROC_UNLOCK(p); tidhash_remove(td); + + /* + * Allow Linux emulation layer to do some work + * before thread suicide. + */ + if (__predict_false(p->p_sysent->sv_thread_detach != NULL)) + (p->p_sysent->sv_thread_detach)(td); + PROC_LOCK(p); tdsigcleanup(td); umtx_thread_exit(td); |