]> Kevux Git Server - fll/commitdiff
Update: Have thread condition wait functions return F_condition on success.
authorKevin Day <Kevin@kevux.org>
Thu, 6 Nov 2025 05:57:46 +0000 (23:57 -0600)
committerKevin Day <Kevin@kevux.org>
Thu, 6 Nov 2025 05:57:46 +0000 (23:57 -0600)
This provides a more accurate status code.

level_0/f_thread/c/thread/condition.c
level_0/f_thread/c/thread/condition.h
level_0/f_thread/tests/unit/c/test-thread-condition_wait.c
level_0/f_thread/tests/unit/c/test-thread-condition_wait_timed.c

index 561d4a5ff5f6657b7d72577bd2b3910d25a1538c..74240782edb9fe7285c42b85c091b3b99410e1d4 100644 (file)
@@ -98,7 +98,7 @@ extern "C" {
       return F_status_set_error(F_failure);
     }
 
-    return F_okay;
+    return F_condition;
   }
 #endif // _di_f_thread_condition_wait_
 
@@ -121,7 +121,7 @@ extern "C" {
       return F_status_set_error(F_failure);
     }
 
-    return F_okay;
+    return F_condition;
   }
 #endif // _di_f_thread_condition_wait_timed_
 
index bf265820dbb07dfb6ce9cb1c657a9572fb78a248..97dd288a6cc9b8f8881ebeccf020342be6a2a57b 100644 (file)
@@ -131,7 +131,7 @@ extern "C" {
  *   The mutex to use for waiting on condition.
  *
  * @return
- *   F_okay on success.
+ *   F_condition on success (condition is triggered).
  *
  *   F_dead (with error bit) if the owning thread terminated while holding the mutex lock (thread is dead).
  *   F_parameter (with error bit) if a parameter is invalid.
@@ -168,7 +168,7 @@ extern "C" {
  *   Must not be NULL.
  *
  * @return
- *   F_okay on success.
+ *   F_condition on success (condition is triggered).
  *   F_time on success, and wait timeout was reached before condition was triggered.
  *
  *   F_dead (with error bit) if the owning thread terminated while holding the mutex lock (thread is dead).
index 57554e42ad03bcc0cd9357515eb17d9ec9c35d60..5cb36d04e1404edfe07a3443a23639fd3259df98 100644 (file)
@@ -71,7 +71,7 @@ void test__f_thread_condition_wait__works(void **state) {
 
     const f_status_t status = f_thread_condition_wait(&condition, &mutex);
 
-    assert_int_equal(status, F_okay);
+    assert_int_equal(status, F_condition);
   }
 }
 
index 29592f442b8fab2ef5eaf309d9f6ca01cbe175d2..9c7d9927b5dc3e6324f47de96332c68ab2e10804 100644 (file)
@@ -82,7 +82,7 @@ void test__f_thread_condition_wait_timed__works(void **state) {
 
     const f_status_t status = f_thread_condition_wait_timed(&wait, &condition, &mutex);
 
-    assert_int_equal(status, F_okay);
+    assert_int_equal(status, F_condition);
   }
 }