Changeset 116d1ef4 in mainline for generic/src/synch/rwlock.c


Ignore:
Timestamp:
2006-06-02T12:26:50Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d0c5901
Parents:
01ebbdf
Message:

Replace nonblocking argument of waitq_sleep_timeout with flags that specify mode of operation.
Now a flag can be used to specify interruptible sleep.
Modify waitq_interrupt_sleep() to only interrupt threads that used this flag.
O

File:
1 edited

Legend:

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

    r01ebbdf r116d1ef4  
    9090 * @param rwl Reader/Writer lock.
    9191 * @param usec Timeout in microseconds.
    92  * @param trylock Switches between blocking and non-blocking mode.
     92 * @param flags Specify mode of operation.
    9393 *
    9494 * For exact description of possible combinations of
    95  * @usec and @trylock, see comment for waitq_sleep_timeout().
     95 * usec and flags, see comment for waitq_sleep_timeout().
    9696 *
    9797 * @return See comment for waitq_sleep_timeout().
    9898 */
    99 int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock)
     99int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int flags)
    100100{
    101101        ipl_t ipl;
     
    112112         * They just need to acquire the exclusive mutex.
    113113         */
    114         rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock);
     114        rc = _mutex_lock_timeout(&rwl->exclusive, usec, flags);
    115115        if (SYNCH_FAILED(rc)) {
    116116
    117117                /*
    118                  * Lock operation timed out.
     118                 * Lock operation timed out or was interrupted.
    119119                 * The state of rwl is UNKNOWN at this point.
    120120                 * No claims about its holder can be made.
     
    144144 * @param rwl Reader/Writer lock.
    145145 * @param usec Timeout in microseconds.
    146  * @param trylock Switches between blocking and non-blocking mode.
     146 * @param flags Select mode of operation.
    147147 *
    148148 * For exact description of possible combinations of
    149  * usec and trylock, see comment for waitq_sleep_timeout().
     149 * usec and flags, see comment for waitq_sleep_timeout().
    150150 *
    151151 * @return See comment for waitq_sleep_timeout().
    152152 */
    153 int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock)
     153int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int flags)
    154154{
    155155        int rc;
     
    200200                #endif
    201201                                 
    202                 rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock);
     202                rc = _mutex_lock_timeout(&rwl->exclusive, usec, flags);
    203203                switch (rc) {
    204204                        case ESYNCH_WOULD_BLOCK:
     
    209209                                spinlock_unlock(&rwl->lock);
    210210                        case ESYNCH_TIMEOUT:
     211                        case ESYNCH_INTERRUPTED:
    211212                                /*
    212                                  * The sleep timeouted.
     213                                 * The sleep timed out.
    213214                                 * We just restore interrupt priority level.
    214215                                 */
Note: See TracChangeset for help on using the changeset viewer.