Commit 8e174cf228c85fc6d707d596c7a007049cfed06e

Thomas de Grivel 2023-07-15T22:38:53

pthread

diff --git a/libc3/facts.c b/libc3/facts.c
index 0800dfe..74f553d 100644
--- a/libc3/facts.c
+++ b/libc3/facts.c
@@ -356,8 +356,6 @@ void facts_lock_r (s_facts *facts)
   pthread_t thread;
   assert(facts);
   thread = pthread_self();
-  if (facts->rwlock_thread == thread)
-    return;
   if (pthread_rwlock_rdlock(&facts->rwlock))
     errx(1, "facts_lock_r: pthread_rwlock_rdlock");
 }
@@ -374,9 +372,9 @@ void facts_lock_unlock_w (s_facts *facts)
   assert(facts);
   facts->rwlock_count--;
   if (! facts->rwlock_count) {
+    facts->rwlock_thread = 0;
     if (pthread_rwlock_unlock(&facts->rwlock))
       errx(1, "facts_lock_unlock_w: pthread_rwlock_unlock");
-    facts->rwlock_thread = 0;
   }
 }