summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authordchagin <dchagin@FreeBSD.org>2015-05-24 14:51:29 +0000
committerdchagin <dchagin@FreeBSD.org>2015-05-24 14:51:29 +0000
commitca0fda407756a0fda8db3d6d464117c2c88b48d0 (patch)
tree29e72220b49ea68b1cf3385e3c206b1a59e70098 /sys/kern/kern_thread.c
parent745df0287fcf54634f0950689d0ffaebcfed8d8c (diff)
downloadFreeBSD-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.c9
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);
OpenPOWER on IntegriCloud