Changeset 343fc179 in mainline


Ignore:
Timestamp:
2006-05-31T16:16:51Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
482826d
Parents:
76d7305
Message:

Allow usage of blocking synchronization primitives in functions that are also called during system initialization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/synch/waitq.c

    r76d7305 r343fc179  
    225225        ipl = interrupts_disable();
    226226
    227         /*
    228          * Busy waiting for a delayed timeout.
    229          * This is an important fix for the race condition between
    230          * a delayed timeout and a next call to waitq_sleep_timeout().
    231          * Simply, the thread is not allowed to go to sleep if
    232          * there are timeouts in progress.
    233          */
    234         spinlock_lock(&THREAD->lock);
    235         if (THREAD->timeout_pending) {
     227        if (THREAD) {   /* needed during system initiailzation */
     228                /*
     229                 * Busy waiting for a delayed timeout.
     230                 * This is an important fix for the race condition between
     231                 * a delayed timeout and a next call to waitq_sleep_timeout().
     232                 * Simply, the thread is not allowed to go to sleep if
     233                 * there are timeouts in progress.
     234                 */
     235                spinlock_lock(&THREAD->lock);
     236                if (THREAD->timeout_pending) {
     237                        spinlock_unlock(&THREAD->lock);
     238                        interrupts_restore(ipl);
     239                        goto restart;
     240                }
    236241                spinlock_unlock(&THREAD->lock);
    237                 interrupts_restore(ipl);
    238                 goto restart;
    239         }
    240         spinlock_unlock(&THREAD->lock);
     242        }
    241243                                                                                                       
    242244        spinlock_lock(&wq->lock);
Note: See TracChangeset for help on using the changeset viewer.