MCPcopy Create free account
hub / github.com/HelenOS/helenos / thread_attach

Function thread_attach

kernel/generic/src/proc/thread.c:470–493  ·  view source on GitHub ↗

Make the thread visible to the system. * * Attach the thread structure to the current task and make it visible in the * threads_tree. * * @param t Thread to be attached to the task. * @param task Task to which the thread is to be attached. * */

Source from the content-addressed store, hash-verified

468 *
469 */
470void thread_attach(thread_t *thread, task_t *task)
471{
472 /*
473 * Attach to the specified task.
474 */
475 irq_spinlock_lock(&task->lock, true);
476
477 /* Hold a reference to the task. */
478 task_hold(task);
479
480 /* Must not count kbox thread into lifecount */
481 if (thread->uspace)
482 atomic_inc(&task->lifecount);
483
484 list_append(&thread->th_link, &task->threads);
485
486 irq_spinlock_pass(&task->lock, &threads_lock);
487
488 /*
489 * Register this thread in the system-wide dictionary.
490 */
491 odict_insert(&thread->lthreads, &threads, NULL);
492 irq_spinlock_unlock(&threads_lock, true);
493}
494
495/** Terminate thread.
496 *

Callers 3

thread_createFunction · 0.85
sys_thread_createFunction · 0.85

Calls 6

irq_spinlock_lockFunction · 0.85
task_holdFunction · 0.85
irq_spinlock_passFunction · 0.85
irq_spinlock_unlockFunction · 0.85
list_appendFunction · 0.50
odict_insertFunction · 0.50

Tested by

no test coverage detected