kern_thread.c (177083) | kern_thread.c (177085) |
---|---|
1/*- 2 * Copyright (C) 2001 Julian Elischer <julian@freebsd.org>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26 * DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 2001 Julian Elischer <julian@freebsd.org>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26 * DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/kern/kern_thread.c 177083 2008-03-12 05:01:14Z jeff $"); | 30__FBSDID("$FreeBSD: head/sys/kern/kern_thread.c 177085 2008-03-12 06:31:06Z jeff $"); |
31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/lock.h> 36#include <sys/mutex.h> 37#include <sys/proc.h> 38#include <sys/resourcevar.h> --- 837 unchanged lines hidden (view full) --- 876 /* 877 * We implement thread_suspend_one in stages here to avoid 878 * dropping the proc lock while the thread lock is owned. 879 */ 880 thread_stopped(p); 881 p->p_suspcount++; 882 PROC_UNLOCK(p); 883 thread_lock(td); | 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/lock.h> 36#include <sys/mutex.h> 37#include <sys/proc.h> 38#include <sys/resourcevar.h> --- 837 unchanged lines hidden (view full) --- 876 /* 877 * We implement thread_suspend_one in stages here to avoid 878 * dropping the proc lock while the thread lock is owned. 879 */ 880 thread_stopped(p); 881 p->p_suspcount++; 882 PROC_UNLOCK(p); 883 thread_lock(td); |
884 sched_sleep(td); | |
885 TD_SET_SUSPENDED(td); | 884 TD_SET_SUSPENDED(td); |
885 sched_sleep(td, 0); |
|
886 PROC_SUNLOCK(p); 887 DROP_GIANT(); 888 mi_switch(SW_VOL, NULL); 889 thread_unlock(td); 890 PICKUP_GIANT(); 891 PROC_LOCK(p); 892 PROC_SLOCK(p); 893} 894 895void 896thread_suspend_one(struct thread *td) 897{ 898 struct proc *p = td->td_proc; 899 900 PROC_SLOCK_ASSERT(p, MA_OWNED); 901 THREAD_LOCK_ASSERT(td, MA_OWNED); 902 KASSERT(!TD_IS_SUSPENDED(td), ("already suspended")); 903 p->p_suspcount++; | 886 PROC_SUNLOCK(p); 887 DROP_GIANT(); 888 mi_switch(SW_VOL, NULL); 889 thread_unlock(td); 890 PICKUP_GIANT(); 891 PROC_LOCK(p); 892 PROC_SLOCK(p); 893} 894 895void 896thread_suspend_one(struct thread *td) 897{ 898 struct proc *p = td->td_proc; 899 900 PROC_SLOCK_ASSERT(p, MA_OWNED); 901 THREAD_LOCK_ASSERT(td, MA_OWNED); 902 KASSERT(!TD_IS_SUSPENDED(td), ("already suspended")); 903 p->p_suspcount++; |
904 sched_sleep(td); | |
905 TD_SET_SUSPENDED(td); | 904 TD_SET_SUSPENDED(td); |
905 sched_sleep(td, 0); |
|
906} 907 908void 909thread_unsuspend_one(struct thread *td) 910{ 911 struct proc *p = td->td_proc; 912 913 PROC_SLOCK_ASSERT(p, MA_OWNED); --- 85 unchanged lines hidden --- | 906} 907 908void 909thread_unsuspend_one(struct thread *td) 910{ 911 struct proc *p = td->td_proc; 912 913 PROC_SLOCK_ASSERT(p, MA_OWNED); --- 85 unchanged lines hidden --- |