Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1687 → Rev 1686

/kernel/trunk/generic/src/proc/task.c
300,7 → 300,7
ta->refcount--;
 
/*
* Interrupt all threads except ktaskclnp.
* Interrupt all threads except this one.
*/
for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
thread_t *thr;
467,7 → 467,7
for (cur = TASK->th_head.next; cur != &TASK->th_head; cur = cur->next) {
thr = list_get_instance(cur, thread_t, th_link);
spinlock_lock(&thr->lock);
if (thr != t && thr->state == Undead && thr->join_type == None) {
if (thr->state == Undead && thr->join_type == None) {
thr->join_type = TaskGC;
spinlock_unlock(&thr->lock);
break;
/kernel/trunk/generic/src/proc/thread.c
350,12 → 350,10
/*
* Attach to the containing task.
*/
ipl = interrupts_disable();
spinlock_lock(&task->lock);
if (!task->accept_new_threads) {
spinlock_unlock(&task->lock);
slab_free(thread_slab, t);
interrupts_restore(ipl);
return NULL;
}
list_append(&t->th_link, &task->th_head);
366,6 → 364,7
/*
* Register this thread in the system-wide list.
*/
ipl = interrupts_disable();
spinlock_lock(&threads_lock);
btree_insert(&threads_btree, (btree_key_t) ((__address) t), (void *) t, NULL);
spinlock_unlock(&threads_lock);
375,7 → 374,7
return t;
}
 
/** Terminate thread.
/** Make thread exiting
*
* End current thread execution and switch it to the exiting
* state. All pending timeouts are executed.
438,12 → 437,17
ipl = interrupts_disable();
spinlock_lock(&t->lock);
 
ASSERT(!t->detached);
(void) waitq_sleep_prepare(&t->join_wq);
spinlock_unlock(&t->lock);
rc = waitq_sleep_timeout_unsafe(&t->join_wq, usec, flags);
waitq_sleep_finish(&t->join_wq, rc, ipl);
interrupts_restore(ipl);
rc = waitq_sleep_timeout(&t->join_wq, usec, flags);
return rc;
}
 
462,6 → 466,7
* Since the thread is expected to not be already detached,
* pointer to it must be still valid.
*/
ipl = interrupts_disable();
spinlock_lock(&t->lock);
ASSERT(!t->detached);