Changeset e5200d5 in rtems


Ignore:
Timestamp:
May 22, 2007, 3:02:02 PM (13 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
804e3bd0
Parents:
7860a37
Message:

2007-05-22 Joel Sherrill <joel.sherrill@…>

  • score/src/corerwlockrelease.c: Do not dereference NULL.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r7860a37 re5200d5  
     12007-05-22      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * score/src/corerwlockrelease.c: Do not dereference NULL.
     4
    152007-05-21      Joel Sherrill <joel.sherrill@oarcorp.com>
    26
  • cpukit/score/src/corerwlockrelease.c

    r7860a37 re5200d5  
    8080    next = _Thread_queue_Dequeue( &the_rwlock->Wait_queue );
    8181   
    82     rwmode = next->Wait.option;
    83     if ( rwmode == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE ) {
    84       the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING;
    85       return CORE_RWLOCK_SUCCESSFUL;
    86     }
     82    if ( next ) {
     83      rwmode = next->Wait.option;
     84      if ( rwmode == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE ) {
     85       the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING;
     86       return CORE_RWLOCK_SUCCESSFUL;
     87     }
    8788
    88     /*
    89      * Must be CORE_RWLOCK_THREAD_WAITING_FOR_READING now see if more
    90      * readers can be let go.
    91      */
     89     /*
     90      * Must be CORE_RWLOCK_THREAD_WAITING_FOR_READING now see if more
     91      * readers can be let go.
     92      */
    9293
    93     while ( 1 ) {
    94       next = _Thread_queue_First( &the_rwlock->Wait_queue );
    95       if ( !next )
    96         return CORE_RWLOCK_SUCCESSFUL;
    97       if ( next->Wait.option != CORE_RWLOCK_THREAD_WAITING_FOR_READ )
    98         return CORE_RWLOCK_SUCCESSFUL;
     94     while ( 1 ) {
     95       next = _Thread_queue_First( &the_rwlock->Wait_queue );
     96       if ( !next )
     97         return CORE_RWLOCK_SUCCESSFUL;
     98       if ( next->Wait.option != CORE_RWLOCK_THREAD_WAITING_FOR_READ )
     99         return CORE_RWLOCK_SUCCESSFUL;
    99100
    100       /* it is definitely wanting to read */
    101       the_rwlock->number_of_readers += 1;
    102       _Thread_queue_Extract( &the_rwlock->Wait_queue, next );
    103     }
    104 
    105 
     101       /* it is definitely wanting to read */
     102       the_rwlock->number_of_readers += 1;
     103       _Thread_queue_Extract( &the_rwlock->Wait_queue, next );
     104     }
    106105
    107106    /* XXX need to put read/write lock request indicator in Wait info */
    108107
     108  }
     109
    109110  return CORE_RWLOCK_SUCCESSFUL;
    110111}
Note: See TracChangeset for help on using the changeset viewer.