MCPcopy Create free account
hub / github.com/F-Stack/f-stack / thread_suspend_switch

Function thread_suspend_switch

freebsd/kern/kern_thread.c:1455–1481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1453}
1454
1455void
1456thread_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
1483void
1484thread_suspend_one(struct thread *td)

Callers 3

ptracestopFunction · 0.85
issignalFunction · 0.85
thread_singleFunction · 0.85

Calls 3

thread_stoppedFunction · 0.85
sched_sleepFunction · 0.70
mi_switchFunction · 0.70

Tested by

no test coverage detected