| 1453 | } |
| 1454 | |
| 1455 | void |
| 1456 | thread_suspend_switch(struct thread *td, struct proc *p) |
| 1457 | { |
| 1458 | |
| 1459 | KASSERT(!TD_IS_SUSPENDED(td), ("already suspended")); |
| 1460 | PROC_LOCK_ASSERT(p, MA_OWNED); |
| 1461 | PROC_SLOCK_ASSERT(p, MA_OWNED); |
| 1462 | /* |
| 1463 | * We implement thread_suspend_one in stages here to avoid |
| 1464 | * dropping the proc lock while the thread lock is owned. |
| 1465 | */ |
| 1466 | if (p == td->td_proc) { |
| 1467 | thread_stopped(p); |
| 1468 | p->p_suspcount++; |
| 1469 | } |
| 1470 | PROC_UNLOCK(p); |
| 1471 | thread_lock(td); |
| 1472 | td->td_flags &= ~TDF_NEEDSUSPCHK; |
| 1473 | TD_SET_SUSPENDED(td); |
| 1474 | sched_sleep(td, 0); |
| 1475 | PROC_SUNLOCK(p); |
| 1476 | DROP_GIANT(); |
| 1477 | mi_switch(SW_VOL | SWT_SUSPEND); |
| 1478 | PICKUP_GIANT(); |
| 1479 | PROC_LOCK(p); |
| 1480 | PROC_SLOCK(p); |
| 1481 | } |
| 1482 | |
| 1483 | void |
| 1484 | thread_suspend_one(struct thread *td) |
no test coverage detected