Subversion Repositories HelenOS

Rev

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

Rev 3022 Rev 4055
Line 80... Line 80...
80
 *
80
 *
81
 * @param rwl Reader/Writer lock.
81
 * @param rwl Reader/Writer lock.
82
 */
82
 */
83
void rwlock_initialize(rwlock_t *rwl) {
83
void rwlock_initialize(rwlock_t *rwl) {
84
    spinlock_initialize(&rwl->lock, "rwlock_t");
84
    spinlock_initialize(&rwl->lock, "rwlock_t");
85
    mutex_initialize(&rwl->exclusive);
85
    mutex_initialize(&rwl->exclusive, MUTEX_PASSIVE);
86
    rwl->readers_in = 0;
86
    rwl->readers_in = 0;
87
}
87
}
88
 
88
 
89
/** Acquire reader/writer lock for reading
89
/** Acquire reader/writer lock for reading
90
 *
90
 *
Line 229... Line 229...
229
             * events happen atomically when rwl->lock is held.)
229
             * events happen atomically when rwl->lock is held.)
230
             */
230
             */
231
            interrupts_restore(ipl);
231
            interrupts_restore(ipl);
232
            break;
232
            break;
233
        case ESYNCH_OK_ATOMIC:
233
        case ESYNCH_OK_ATOMIC:
234
            panic("_mutex_lock_timeout()==ESYNCH_OK_ATOMIC\n");
234
            panic("_mutex_lock_timeout() == ESYNCH_OK_ATOMIC.");
235
            break;
235
            break;
236
        default:
236
        default:
237
            panic("invalid ESYNCH\n");
237
            panic("Invalid ESYNCH.");
238
            break;
238
            break;
239
        }
239
        }
240
        return rc;
240
        return rc;
241
    }
241
    }
242
 
242