Deleted Added
full compact
kern_thr.c (155501) kern_thr.c (157815)
1/*-
2 * Copyright (c) 2003, Jeffrey Roberson <jeff@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

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, Jeffrey Roberson <jeff@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

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/kern/kern_thr.c 155501 2006-02-10 03:34:29Z davidxu $");
28__FBSDID("$FreeBSD: head/sys/kern/kern_thr.c 157815 2006-04-17 18:20:38Z jhb $");
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/lock.h>
33#include <sys/mutex.h>
34#include <sys/proc.h>
35#include <sys/resourcevar.h>
36#include <sys/sched.h>

--- 326 unchanged lines hidden (view full) ---

363 return (EINVAL);
364 if (ts.tv_sec == 0 && ts.tv_nsec == 0)
365 return (ETIMEDOUT);
366 TIMESPEC_TO_TIMEVAL(&tv, &ts);
367 hz = tvtohz(&tv);
368 }
369 PROC_LOCK(td->td_proc);
370 if ((td->td_flags & TDF_THRWAKEUP) == 0)
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/lock.h>
33#include <sys/mutex.h>
34#include <sys/proc.h>
35#include <sys/resourcevar.h>
36#include <sys/sched.h>

--- 326 unchanged lines hidden (view full) ---

363 return (EINVAL);
364 if (ts.tv_sec == 0 && ts.tv_nsec == 0)
365 return (ETIMEDOUT);
366 TIMESPEC_TO_TIMEVAL(&tv, &ts);
367 hz = tvtohz(&tv);
368 }
369 PROC_LOCK(td->td_proc);
370 if ((td->td_flags & TDF_THRWAKEUP) == 0)
371 error = msleep((void *)td, &td->td_proc->p_mtx,
372 td->td_priority | PCATCH, "lthr", hz);
371 error = msleep((void *)td, &td->td_proc->p_mtx, PCATCH, "lthr",
372 hz);
373 if (td->td_flags & TDF_THRWAKEUP) {
374 mtx_lock_spin(&sched_lock);
375 td->td_flags &= ~TDF_THRWAKEUP;
376 mtx_unlock_spin(&sched_lock);
377 PROC_UNLOCK(td->td_proc);
378 return (0);
379 }
380 PROC_UNLOCK(td->td_proc);

--- 59 unchanged lines hidden ---
373 if (td->td_flags & TDF_THRWAKEUP) {
374 mtx_lock_spin(&sched_lock);
375 td->td_flags &= ~TDF_THRWAKEUP;
376 mtx_unlock_spin(&sched_lock);
377 PROC_UNLOCK(td->td_proc);
378 return (0);
379 }
380 PROC_UNLOCK(td->td_proc);

--- 59 unchanged lines hidden ---