Changeset 05e2a7ad in mainline for generic/src/synch/rwlock.c


Ignore:
Timestamp:
2005-12-07T13:32:31Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
839470f
Parents:
253f8590
Message:

Add comments describing locking rules for some locks.
Cleanup.

File:
1 edited

Legend:

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

    r253f8590 r05e2a7ad  
    2727 */
    2828
    29 
    30 /*
    31  * Reader/Writer locks
     29/** Reader/Writer locks
     30 *
     31 * A reader/writer lock can be held by multiple readers at a time.
     32 * Or it can be exclusively held by a sole writer at a time.
    3233 */
    3334
     
    7677 */
    7778void rwlock_initialize(rwlock_t *rwl) {
    78         spinlock_initialize(&rwl->lock, "rwlock");
     79        spinlock_initialize(&rwl->lock, "rwlock_t");
    7980        mutex_initialize(&rwl->exclusive);
    8081        rwl->readers_in = 0;
     
    219220                                break;
    220221                        case ESYNCH_OK_ATOMIC:
    221                                 panic("_mutex_lock_timeout()==ESYNCH_OK_ATOMIC");
     222                                panic("_mutex_lock_timeout()==ESYNCH_OK_ATOMIC\n");
    222223                                break;
    223224                        dafault:
    224                                 panic("invalid ESYNCH");
     225                                panic("invalid ESYNCH\n");
    225226                                break;
    226227                }
     
    284285
    285286
    286 /** Direct handoff
     287/** Direct handoff of reader/writer lock ownership.
    287288 *
    288289 * Direct handoff of reader/writer lock ownership
     
    307308        rwlock_type_t type = RWLOCK_NONE;
    308309        thread_t *t = NULL;
    309         int one_more = 1;
     310        bool one_more = true;
    310311       
    311312        spinlock_lock(&rwl->exclusive.sem.wq.lock);
     
    353354                                spinlock_lock(&t->lock);
    354355                                if (t->rwlock_holder_type != RWLOCK_READER)
    355                                         one_more = 0;
     356                                        one_more = false;
    356357                                spinlock_unlock(&t->lock);     
    357358                        }
Note: See TracChangeset for help on using the changeset viewer.