Subversion Repositories HelenOS-historic

Rev

Rev 557 | Rev 625 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 557 Rev 623
Line 190... Line 190...
190
         * In order to prevent a race condition when a reader
190
         * In order to prevent a race condition when a reader
191
         * could block another reader at the head of the waitq,
191
         * could block another reader at the head of the waitq,
192
         * we register a function to unlock rwl->lock
192
         * we register a function to unlock rwl->lock
193
         * after this thread is put asleep.
193
         * after this thread is put asleep.
194
         */
194
         */
-
 
195
        #ifdef CONFIG_SMP
195
        thread_register_call_me(release_spinlock, &rwl->lock);
196
        thread_register_call_me(release_spinlock, &rwl->lock);
-
 
197
        #else
-
 
198
        thread_register_call_me(release_spinlock, NULL);
-
 
199
        #endif
196
                 
200
                 
197
        rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock);
201
        rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock);
198
        switch (rc) {
202
        switch (rc) {
199
            case ESYNCH_WOULD_BLOCK:
203
            case ESYNCH_WOULD_BLOCK:
200
                /*
204
                /*
201
                 * release_spinlock() wasn't called
205
                 * release_spinlock() wasn't called
202
                 */
206
                 */
203
                thread_register_call_me(NULL, NULL);                 
207
                thread_register_call_me(NULL, NULL);
204
                spinlock_unlock(&rwl->lock);
208
                spinlock_unlock(&rwl->lock);
205
            case ESYNCH_TIMEOUT:
209
            case ESYNCH_TIMEOUT:
206
                /*
210
                /*
207
                 * The sleep timeouted.
211
                 * The sleep timeouted.
208
                 * We just restore interrupt priority level.
212
                 * We just restore interrupt priority level.