MCPcopy Create free account
hub / github.com/coreboot/coreboot / thread_run_until

Function thread_run_until

src/lib/thread.c:303–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303int thread_run_until(struct thread_handle *handle, enum cb_err (*func)(void *), void *arg,
304 boot_state_t state, boot_state_sequence_t seq)
305{
306 struct thread *current;
307 struct thread *t;
308 struct block_boot_state *bbs;
309
310 /* This is a ramstage specific API */
311 if (!ENV_RAMSTAGE)
312 dead_code();
313
314 /* Lazy initialization */
315 threads_initialize();
316
317 current = current_thread();
318
319 if (!thread_can_yield(current)) {
320 printk(BIOS_ERR, "%s() called from non-yielding context!\n", __func__);
321 return -1;
322 }
323
324 t = get_free_thread();
325
326 if (t == NULL) {
327 printk(BIOS_ERR, "%s: No more threads!\n", __func__);
328 return -1;
329 }
330
331 bbs = thread_alloc_space(t, sizeof(*bbs));
332 bbs->state = state;
333 bbs->seq = seq;
334 prepare_thread(t, handle, func, arg, call_wrapper_block_state, bbs);
335 schedule(t);
336
337 return 0;
338}
339
340int thread_yield(void)
341{

Callers

nothing calls this directly

Calls 8

threads_initializeFunction · 0.85
current_threadFunction · 0.85
thread_can_yieldFunction · 0.85
get_free_threadFunction · 0.85
thread_alloc_spaceFunction · 0.85
prepare_threadFunction · 0.85
scheduleFunction · 0.85
printkFunction · 0.50

Tested by

no test coverage detected