kern_synch.c (b1c00b13d61eb7cfcd3009d35ed3dc7c79625724) | kern_synch.c (37e80fcac22c6734bcdb79e160bc1eac56740c4c) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 55 unchanged lines hidden (view full) --- 64 65#include <machine/cpu.h> 66 67static void synch_setup(void *dummy); 68SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, synch_setup, NULL) 69 70int hogticks; 71int lbolt; | 1/*- 2 * Copyright (c) 1982, 1986, 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 55 unchanged lines hidden (view full) --- 64 65#include <machine/cpu.h> 66 67static void synch_setup(void *dummy); 68SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, synch_setup, NULL) 69 70int hogticks; 71int lbolt; |
72static int pause_wchan; |
|
72 73static struct callout loadav_callout; 74static struct callout lbolt_callout; 75 76struct loadavg averunnable = 77 { {0, 0, 0}, FSCALE }; /* load average, of runnable procs */ 78/* 79 * Constants for averages over 1, 5, and 15 minutes --- 79 unchanged lines hidden (view full) --- 159 /* 160 * If we are already on a sleep queue, then remove us from that 161 * sleep queue first. We have to do this to handle recursive 162 * sleeps. 163 */ 164 if (TD_ON_SLEEPQ(td)) 165 sleepq_remove(td, td->td_wchan); 166 | 73 74static struct callout loadav_callout; 75static struct callout lbolt_callout; 76 77struct loadavg averunnable = 78 { {0, 0, 0}, FSCALE }; /* load average, of runnable procs */ 79/* 80 * Constants for averages over 1, 5, and 15 minutes --- 79 unchanged lines hidden (view full) --- 160 /* 161 * If we are already on a sleep queue, then remove us from that 162 * sleep queue first. We have to do this to handle recursive 163 * sleeps. 164 */ 165 if (TD_ON_SLEEPQ(td)) 166 sleepq_remove(td, td->td_wchan); 167 |
167 flags = SLEEPQ_MSLEEP; | 168 if (ident == &pause_wchan) 169 flags = SLEEPQ_PAUSE; 170 else 171 flags = SLEEPQ_MSLEEP; |
168 if (catch) 169 flags |= SLEEPQ_INTERRUPTIBLE; 170 171 sleepq_lock(ident); 172 CTR5(KTR_PROC, "msleep: thread %p (pid %ld, %s) on %s (%p)", 173 (void *)td, (long)p->p_pid, p->p_comm, wmesg, ident); 174 175 DROP_GIANT(); --- 127 unchanged lines hidden (view full) --- 303#endif 304 PICKUP_GIANT(); 305 mtx_lock_spin(mtx); 306 WITNESS_RESTORE(&mtx->mtx_object, mtx); 307 return (rval); 308} 309 310/* | 172 if (catch) 173 flags |= SLEEPQ_INTERRUPTIBLE; 174 175 sleepq_lock(ident); 176 CTR5(KTR_PROC, "msleep: thread %p (pid %ld, %s) on %s (%p)", 177 (void *)td, (long)p->p_pid, p->p_comm, wmesg, ident); 178 179 DROP_GIANT(); --- 127 unchanged lines hidden (view full) --- 307#endif 308 PICKUP_GIANT(); 309 mtx_lock_spin(mtx); 310 WITNESS_RESTORE(&mtx->mtx_object, mtx); 311 return (rval); 312} 313 314/* |
315 * pause() is like tsleep() except that the intention is to not be 316 * explicitly woken up by another thread. Instead, the current thread 317 * simply wishes to sleep until the timeout expires. It is 318 * implemented using a dummy wait channel. 319 */ 320int 321pause(wmesg, timo) 322 const char *wmesg; 323 int timo; 324{ 325 326 KASSERT(timo != 0, ("pause: timeout required")); 327 return (tsleep(&pause_wchan, 0, wmesg, timo)); 328} 329 330/* |
|
311 * Make all threads sleeping on the specified identifier runnable. 312 */ 313void 314wakeup(ident) 315 register void *ident; 316{ 317 318 sleepq_lock(ident); --- 239 unchanged lines hidden --- | 331 * Make all threads sleeping on the specified identifier runnable. 332 */ 333void 334wakeup(ident) 335 register void *ident; 336{ 337 338 sleepq_lock(ident); --- 239 unchanged lines hidden --- |