]> 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 561d4a5..7424078 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 bf26582..97dd288 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 57554e4..5cb36d0 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 29592f4..9c7d992 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);
   }
 }