[BACK]Return to pthread_rwlock.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libpthread

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libpthread/pthread_rwlock.c between version 1.42 and 1.43

version 1.42, 2020/06/02 00:29:53 version 1.43, 2022/02/11 21:40:58
Line 228  pthread__rwlock_rdlock(pthread_rwlock_t 
Line 228  pthread__rwlock_rdlock(pthread_rwlock_t 
   
                 /* Did we get the lock? */                  /* Did we get the lock? */
                 if (self->pt_rwlocked == _RW_LOCKED) {                  if (self->pt_rwlocked == _RW_LOCKED) {
 #ifndef PTHREAD__ATOMIC_IS_MEMBAR  
                         membar_enter();                          membar_enter();
 #endif  
                         return 0;                          return 0;
                 }                  }
                 if (error != 0)                  if (error != 0)
Line 352  pthread__rwlock_wrlock(pthread_rwlock_t 
Line 350  pthread__rwlock_wrlock(pthread_rwlock_t 
   
                 /* Did we get the lock? */                  /* Did we get the lock? */
                 if (self->pt_rwlocked == _RW_LOCKED) {                  if (self->pt_rwlocked == _RW_LOCKED) {
 #ifndef PTHREAD__ATOMIC_IS_MEMBAR  
                         membar_enter();                          membar_enter();
 #endif  
                         return 0;                          return 0;
                 }                  }
                 if (error != 0)                  if (error != 0)
Line 526  pthread_rwlock_unlock(pthread_rwlock_t *
Line 522  pthread_rwlock_unlock(pthread_rwlock_t *
                          * by the writer that we are about to wake.                           * by the writer that we are about to wake.
                          */                           */
                         (void)atomic_swap_ptr(&ptr->ptr_owner, (void *)new);                          (void)atomic_swap_ptr(&ptr->ptr_owner, (void *)new);
   #ifndef PTHREAD__ATOMIC_IS_MEMBAR
                           membar_exit();
   #endif
   
                         /* Wake the writer. */                          /* Wake the writer. */
                         thread->pt_rwlocked = _RW_LOCKED;                          thread->pt_rwlocked = _RW_LOCKED;
Line 543  pthread_rwlock_unlock(pthread_rwlock_t *
Line 542  pthread_rwlock_unlock(pthread_rwlock_t *
                                 if (thread->pt_sleepobj == NULL)                                  if (thread->pt_sleepobj == NULL)
                                         continue;                                          continue;
                                 new += RW_READ_INCR;                                  new += RW_READ_INCR;
                                   membar_exit();
                                 thread->pt_rwlocked = _RW_LOCKED;                                  thread->pt_rwlocked = _RW_LOCKED;
                         }                          }
   

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43

CVSweb <webmaster@jp.NetBSD.org>