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

Function thread_run

src/lib/thread.c:275–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275int thread_run(struct thread_handle *handle, enum cb_err (*func)(void *), void *arg)
276{
277 struct thread *current;
278 struct thread *t;
279
280 /* Lazy initialization */
281 threads_initialize();
282
283 current = current_thread();
284
285 if (!thread_can_yield(current)) {
286 printk(BIOS_ERR, "%s() called from non-yielding context!\n", __func__);
287 return -1;
288 }
289
290 t = get_free_thread();
291
292 if (t == NULL) {
293 printk(BIOS_ERR, "%s: No more threads!\n", __func__);
294 return -1;
295 }
296
297 prepare_thread(t, handle, func, arg, call_wrapper, NULL);
298 schedule(t);
299
300 return 0;
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)

Callers 4

mainboard_initFunction · 0.85
cbfs_preloadFunction · 0.85
start_apob_cache_readFunction · 0.85

Calls 7

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

Tested by

no test coverage detected