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

Function thread_count_inc_try

freebsd/kern/kern_thread.c:177–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175EVENTHANDLER_LIST_DEFINE(thread_fini);
176
177static bool
178thread_count_inc_try(void)
179{
180 int nthreads_new;
181
182 nthreads_new = atomic_fetchadd_int(&nthreads, 1) + 1;
183 if (nthreads_new >= maxthread - 100) {
184 if (priv_check_cred(curthread->td_ucred, PRIV_MAXPROC) != 0 ||
185 nthreads_new >= maxthread) {
186 atomic_subtract_int(&nthreads, 1);
187 return (false);
188 }
189 }
190 return (true);
191}
192
193static bool
194thread_count_inc(void)

Callers 1

thread_count_incFunction · 0.85

Calls 2

priv_check_credFunction · 0.70
atomic_fetchadd_intFunction · 0.50

Tested by

no test coverage detected