Lines Matching refs:real_rwlock

878 	dng_pthread_rwlock_impl &real_rwlock = **rwlock;  in dng_pthread_rwlock_destroy()  local
881 ScopedLock lock (real_rwlock.mutex); in dng_pthread_rwlock_destroy()
883 if (real_rwlock.head_waiter != NULL || in dng_pthread_rwlock_destroy()
884 real_rwlock.readers_active != 0 || in dng_pthread_rwlock_destroy()
885 real_rwlock.writers_waiting != 0 || in dng_pthread_rwlock_destroy()
886 real_rwlock.writer_active) in dng_pthread_rwlock_destroy()
897 #define CHECK_RWLOCK_STATE(real_rwlock) \ argument
898 …DNG_ASSERT (!real_rwlock.writer_active || real_rwlock.readers_active == 0, "dng_pthread_rwlock_t l…
904 dng_pthread_rwlock_impl &real_rwlock = **rwlock; in dng_pthread_rwlock_rdlock() local
913 ScopedLock lock (real_rwlock.mutex); in dng_pthread_rwlock_rdlock()
915 CHECK_RWLOCK_STATE (real_rwlock); in dng_pthread_rwlock_rdlock()
917 if (real_rwlock.writers_waiting > 0 || real_rwlock.writer_active) in dng_pthread_rwlock_rdlock()
926 this_wait.prev = real_rwlock.tail_waiter; in dng_pthread_rwlock_rdlock()
927 if (real_rwlock.tail_waiter != NULL) in dng_pthread_rwlock_rdlock()
928 real_rwlock.tail_waiter->next = &this_wait; in dng_pthread_rwlock_rdlock()
929 real_rwlock.tail_waiter = &this_wait; in dng_pthread_rwlock_rdlock()
932 if (real_rwlock.head_waiter == NULL) in dng_pthread_rwlock_rdlock()
933 real_rwlock.head_waiter = &this_wait; in dng_pthread_rwlock_rdlock()
938 real_rwlock.readers_active++; in dng_pthread_rwlock_rdlock()
951 dng_pthread_rwlock_impl &real_rwlock = **rwlock; in dng_pthread_rwlock_tryrdlock() local
953 ScopedLock lock (real_rwlock.mutex); in dng_pthread_rwlock_tryrdlock()
955 CHECK_RWLOCK_STATE (real_rwlock); in dng_pthread_rwlock_tryrdlock()
957 if (real_rwlock.writers_waiting == 0 && !real_rwlock.writer_active) in dng_pthread_rwlock_tryrdlock()
959 real_rwlock.readers_active++; in dng_pthread_rwlock_tryrdlock()
970 dng_pthread_rwlock_impl &real_rwlock = **rwlock; in dng_pthread_rwlock_trywrlock() local
972 ScopedLock lock (real_rwlock.mutex); in dng_pthread_rwlock_trywrlock()
974 CHECK_RWLOCK_STATE (real_rwlock); in dng_pthread_rwlock_trywrlock()
976 if (real_rwlock.readers_active == 0 && in dng_pthread_rwlock_trywrlock()
977 real_rwlock.writers_waiting == 0 && in dng_pthread_rwlock_trywrlock()
978 !real_rwlock.writer_active) in dng_pthread_rwlock_trywrlock()
980 real_rwlock.writer_active = true; in dng_pthread_rwlock_trywrlock()
991 dng_pthread_rwlock_impl &real_rwlock = **rwlock; in dng_pthread_rwlock_unlock() local
995 ScopedLock lock (real_rwlock.mutex); in dng_pthread_rwlock_unlock()
997 CHECK_RWLOCK_STATE (real_rwlock); in dng_pthread_rwlock_unlock()
999 if (real_rwlock.readers_active > 0) in dng_pthread_rwlock_unlock()
1000 --real_rwlock.readers_active; in dng_pthread_rwlock_unlock()
1002 real_rwlock.writer_active = false; in dng_pthread_rwlock_unlock()
1004 while (real_rwlock.head_waiter != NULL) in dng_pthread_rwlock_unlock()
1006 if (real_rwlock.head_waiter->is_writer) in dng_pthread_rwlock_unlock()
1008 if (real_rwlock.readers_active == 0) in dng_pthread_rwlock_unlock()
1010 real_rwlock.writers_waiting--; in dng_pthread_rwlock_unlock()
1011 real_rwlock.writer_active = true; in dng_pthread_rwlock_unlock()
1012 real_rwlock.WakeHeadWaiter (); in dng_pthread_rwlock_unlock()
1019 ++real_rwlock.readers_active; in dng_pthread_rwlock_unlock()
1020 real_rwlock.WakeHeadWaiter (); in dng_pthread_rwlock_unlock()
1031 dng_pthread_rwlock_impl &real_rwlock = **rwlock; in dng_pthread_rwlock_wrlock() local
1039 ScopedLock lock (real_rwlock.mutex); in dng_pthread_rwlock_wrlock()
1041 CHECK_RWLOCK_STATE (real_rwlock); in dng_pthread_rwlock_wrlock()
1043 if (real_rwlock.readers_active || in dng_pthread_rwlock_wrlock()
1044 real_rwlock.writers_waiting || in dng_pthread_rwlock_wrlock()
1045 real_rwlock.writer_active) in dng_pthread_rwlock_wrlock()
1054 this_wait.prev = real_rwlock.tail_waiter; in dng_pthread_rwlock_wrlock()
1055 if (real_rwlock.tail_waiter != NULL) in dng_pthread_rwlock_wrlock()
1056 real_rwlock.tail_waiter->next = &this_wait; in dng_pthread_rwlock_wrlock()
1057 real_rwlock.tail_waiter = &this_wait; in dng_pthread_rwlock_wrlock()
1060 if (real_rwlock.head_waiter == NULL) in dng_pthread_rwlock_wrlock()
1061 real_rwlock.head_waiter = &this_wait; in dng_pthread_rwlock_wrlock()
1063 real_rwlock.writers_waiting++; in dng_pthread_rwlock_wrlock()
1068 real_rwlock.writer_active = true; in dng_pthread_rwlock_wrlock()