/trunk/kernel/generic/src/proc/task.c |
---|
220,13 → 220,13 |
/* |
* Create the main thread. |
*/ |
t1 = thread_create(uinit, kernel_uarg, task, THREAD_FLAG_USPACE, "uinit"); |
t1 = thread_create(uinit, kernel_uarg, task, THREAD_FLAG_USPACE, "uinit", false); |
ASSERT(t1); |
/* |
* Create killer thread for the new task. |
*/ |
t2 = thread_create(ktaskgc, t1, task, 0, "ktaskgc"); |
t2 = thread_create(ktaskgc, t1, task, 0, "ktaskgc", true); |
ASSERT(t2); |
thread_ready(t2); |
285,11 → 285,12 |
thread_t *thr = list_get_instance(cur, thread_t, th_link); |
spinlock_lock(&thr->lock); |
/* Process only counted threads */ |
if (!thr->uncounted) { |
if (thr == THREAD) /* Update accounting of current thread */ |
thread_update_accounting(); |
ret += thr->cycles; |
} |
spinlock_unlock(&thr->lock); |
} |
328,7 → 329,7 |
btree_remove(&tasks_btree, ta->taskid, NULL); |
spinlock_unlock(&tasks_lock); |
t = thread_create(ktaskclnp, NULL, ta, 0, "ktaskclnp"); |
t = thread_create(ktaskclnp, NULL, ta, 0, "ktaskclnp", true); |
spinlock_lock(&ta->lock); |
ta->accept_new_threads = false; |
/trunk/kernel/generic/src/proc/thread.c |
---|
123,6 → 123,7 |
ipl_t ipl = interrupts_disable(); |
spinlock_lock(&THREAD->lock); |
if (!THREAD->uncounted) { |
thread_update_accounting(); |
uint64_t cycles = THREAD->cycles; |
THREAD->cycles = 0; |
131,6 → 132,8 |
spinlock_lock(&TASK->lock); |
TASK->cycles += cycles; |
spinlock_unlock(&TASK->lock); |
} else |
spinlock_unlock(&THREAD->lock); |
interrupts_restore(ipl); |
307,11 → 310,12 |
* @param task Task to which the thread belongs. |
* @param flags Thread flags. |
* @param name Symbolic name. |
* @param uncounted Thread's accounting doesn't affect accumulated task accounting. |
* |
* @return New thread's structure on success, NULL on failure. |
* |
*/ |
thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags, char *name) |
thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags, char *name, bool uncounted) |
{ |
thread_t *t; |
ipl_t ipl; |
344,6 → 348,7 |
t->thread_arg = arg; |
t->ticks = -1; |
t->cycles = 0; |
t->uncounted = uncounted; |
t->priority = -1; /* start in rq[0] */ |
t->cpu = NULL; |
t->flags = flags; |
649,7 → 654,7 |
return (unative_t) rc; |
} |
if ((t = thread_create(uinit, kernel_uarg, TASK, THREAD_FLAG_USPACE, namebuf))) { |
if ((t = thread_create(uinit, kernel_uarg, TASK, THREAD_FLAG_USPACE, namebuf, false))) { |
tid = t->tid; |
thread_ready(t); |
return (unative_t) tid; |