Esempio n. 1
0
int
sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
    /* long *state */
{

	/* Signal userland that it can free the stack. */
	if ((void *)uap->state != NULL) {
		suword_lwpid(uap->state, 1);
		kern_umtx_wake(td, uap->state, INT_MAX, 0);
	}

	return (kern_thr_exit(td));
}
Esempio n. 2
0
int
sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
    /* long *state */
{

#ifdef THRWORKQ
	if (td->td_reuse_stack != NULL) {
		thrworkq_reusestack(td->td_proc, td->td_reuse_stack);
		td->td_reuse_stack = NULL;
	}
#endif

	if ((void *)uap->state != NULL) {
		/* Signal userland that it can free the stack. */
		suword_lwpid(uap->state, 1);
		kern_umtx_wake(td, uap->state, INT_MAX, 0);
	}

	return (kern_thr_exit(td));
}
Esempio n. 3
0
int
sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
    /* long *state */
{
	struct proc *p;

	p = td->td_proc;

	/* Signal userland that it can free the stack. */
	if ((void *)uap->state != NULL) {
		suword_lwpid(uap->state, 1);
		kern_umtx_wake(td, uap->state, INT_MAX, 0);
	}

	rw_wlock(&tidhash_lock);

	PROC_LOCK(p);

	if (p->p_numthreads != 1) {
		racct_sub(p, RACCT_NTHR, 1);
		LIST_REMOVE(td, td_hash);
		rw_wunlock(&tidhash_lock);
		tdsigcleanup(td);
		PROC_SLOCK(p);
		thread_stopped(p);
		thread_exit();
		/* NOTREACHED */
	}

	/*
	 * Ignore attempts to shut down last thread in the proc.  This
	 * will actually call _exit(2) in the usermode trampoline when
	 * it returns.
	 */
	PROC_UNLOCK(p);
	rw_wunlock(&tidhash_lock);
	return (0);
}