Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1686 → Rev 1687

/kernel/trunk/generic/src/proc/task.c
300,7 → 300,7
ta->refcount--;
 
/*
* Interrupt all threads except this one.
* Interrupt all threads except ktaskclnp.
*/
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->state == Undead && thr->join_type == None) {
if (thr != t && thr->state == Undead && thr->join_type == None) {
thr->join_type = TaskGC;
spinlock_unlock(&thr->lock);
break;
/kernel/trunk/generic/src/proc/thread.c
350,10 → 350,12
/*
* 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);
364,7 → 366,6
/*
* 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);
374,7 → 375,7
return t;
}
 
/** Make thread exiting
/** Terminate thread.
*
* End current thread execution and switch it to the exiting
* state. All pending timeouts are executed.
437,17 → 438,12
ipl = interrupts_disable();
spinlock_lock(&t->lock);
 
ASSERT(!t->detached);
(void) waitq_sleep_prepare(&t->join_wq);
spinlock_unlock(&t->lock);
interrupts_restore(ipl);
rc = waitq_sleep_timeout_unsafe(&t->join_wq, usec, flags);
rc = waitq_sleep_timeout(&t->join_wq, usec, flags);
waitq_sleep_finish(&t->join_wq, rc, ipl);
interrupts_restore(ipl);
return rc;
}
 
466,7 → 462,6
* 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);