Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 11 → Rev 15

/SPARTAN/trunk/src/synch/rwlock.c
80,9 → 80,9
int rc;
pri = cpu_priority_high();
spinlock_lock(&the->thread->lock);
the->thread->rwlock_holder_type = RWLOCK_WRITER;
spinlock_unlock(&the->thread->lock);
spinlock_lock(&THREAD->lock);
THREAD->rwlock_holder_type = RWLOCK_WRITER;
spinlock_unlock(&THREAD->lock);
cpu_priority_restore(pri);
 
/*
120,9 → 120,9
pri_t pri;
pri = cpu_priority_high();
spinlock_lock(&the->thread->lock);
the->thread->rwlock_holder_type = RWLOCK_READER;
spinlock_unlock(&the->thread->lock);
spinlock_lock(&THREAD->lock);
THREAD->rwlock_holder_type = RWLOCK_READER;
spinlock_unlock(&THREAD->lock);
 
spinlock_lock(&rwl->lock);
 
/SPARTAN/trunk/src/synch/spinlock.c
49,7 → 49,7
 
while (test_and_set(&sl->val)) {
if (i++ > 300000) {
printf("cpu%d: looping on spinlock %X, caller=%X\n", the->cpu->id, sl, caller);
printf("cpu%d: looping on spinlock %X, caller=%X\n", CPU->id, sl, caller);
i = 0;
}
}
/SPARTAN/trunk/src/synch/waitq.c
129,13 → 129,13
* Simply, the thread is not allowed to go to sleep if
* there are timeouts in progress.
*/
spinlock_lock(&the->thread->lock);
if (the->thread->timeout_pending) {
spinlock_unlock(&the->thread->lock);
spinlock_lock(&THREAD->lock);
if (THREAD->timeout_pending) {
spinlock_unlock(&THREAD->lock);
cpu_priority_restore(pri);
goto restart;
}
spinlock_unlock(&the->thread->lock);
spinlock_unlock(&THREAD->lock);
spinlock_lock(&wq->lock);
159,30 → 159,30
/*
* Now we are firmly decided to go to sleep.
*/
spinlock_lock(&the->thread->lock);
spinlock_lock(&THREAD->lock);
if (usec) {
/* We use the timeout variant. */
if (!context_save(&the->thread->sleep_timeout_context)) {
if (!context_save(&THREAD->sleep_timeout_context)) {
/*
* Short emulation of scheduler() return code.
*/
spinlock_unlock(&the->thread->lock);
spinlock_unlock(&THREAD->lock);
cpu_priority_restore(pri);
return ESYNCH_TIMEOUT;
}
the->thread->timeout_pending = 1;
timeout_register(&the->thread->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, the->thread);
THREAD->timeout_pending = 1;
timeout_register(&THREAD->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, THREAD);
}
 
list_append(&the->thread->wq_link, &wq->head);
list_append(&THREAD->wq_link, &wq->head);
 
/*
* Suspend execution.
*/
the->thread->state = Sleeping;
the->thread->sleep_queue = wq;
THREAD->state = Sleeping;
THREAD->sleep_queue = wq;
 
spinlock_unlock(&the->thread->lock);
spinlock_unlock(&THREAD->lock);
 
scheduler(); /* wq->lock is released in scheduler_separated_stack() */
cpu_priority_restore(pri);