]> Kevux Git Server - fll/commitdiff
Update: Remove todo regarding delete and destroy functions for f_thread_once_t along...
authorKevin Day <Kevin@kevux.org>
Mon, 1 Dec 2025 02:04:56 +0000 (20:04 -0600)
committerKevin Day <Kevin@kevux.org>
Mon, 1 Dec 2025 02:04:56 +0000 (20:04 -0600)
The tests are not used and there are no functions to test.

Remove the `@todo` regarding adding delete and destroy functions for `f_thread_once_t`.
Document the reasons for this in the documentation comments.

level_0/f_thread/c/thread/once.h
level_0/f_thread/c/thread/onces.h
level_0/f_thread/c/thread/oncess.h
level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.c [deleted file]
level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.h [deleted file]
level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.c [deleted file]
level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.h [deleted file]
level_0/f_thread/tests/unit/c/test-thread-oncess_delete_callback.c [deleted file]
level_0/f_thread/tests/unit/c/test-thread-oncess_delete_callback.h [deleted file]
level_0/f_thread/tests/unit/c/test-thread-oncess_destroy_callback.c [deleted file]
level_0/f_thread/tests/unit/c/test-thread-oncess_destroy_callback.h [deleted file]

index 091900933b140863d71b5a884a9a5dfcdfb83b38..eb84ae7783864a1c7cad0c72170b5801791fd5e9 100644 (file)
@@ -20,6 +20,8 @@ extern "C" {
  * A typedef representing pthread_once_t.
  *
  * There are no delete functions and therefore no delete macros.
+ *
+ * This does not provide a clear macro because pthread_once_t requires special functions to perform a clear.
  */
 #ifndef _di_f_thread_once_t_
   typedef pthread_once_t f_thread_once_t;
index 958e5de9736b9ac6652c6806e74efe5fbd28d6b0..9ad68a33fd29ca687cffbf1ee80de7dd77456406 100644 (file)
@@ -19,6 +19,8 @@ extern "C" {
 /**
  * An array of thread onces.
  *
+ * There are no delete or destroy callbacks because pthread_once_t does not support deletions.
+ *
  * Properties:
  *   - array: The array of f_thread_once_t.
  *   - used:  Total number of allocated spaces used.
@@ -44,8 +46,6 @@ extern "C" {
   }
 #endif // _di_f_thread_onces_t_
 
-// @todo add delete & destroy callbacks.
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 47700aa0793834bc6ca61b1dfb5c4beaf5c77cb1..cb3935cc33cdfdd716a0e4857ef969a64894dc34 100644 (file)
@@ -19,6 +19,8 @@ extern "C" {
 /**
  * An array of an array of thread onces.
  *
+ * There are no delete or destroy callbacks because pthread_once_t does not support deletions.
+ *
  * Properties:
  *   - array: The array of f_thread_onces_t.
  *   - used:  Total number of allocated spaces used.
@@ -44,8 +46,6 @@ extern "C" {
   }
 #endif // _di_f_thread_oncess_t_
 
-// @todo add delete & destroy callbacks.
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.c b/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.c
deleted file mode 100644 (file)
index 52e916e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "test-thread.h"
-#include "test-thread-onces_delete_callback.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_thread_onces_delete_callback__fails(void **state) {
-
-  f_thread_once_t data = f_thread_once_t_initialize;
-  f_thread_once_t data_array[] = { data };
-  f_thread_onces_t datas = { .array = data_array, .used = 1, .size = 1 };
-  f_thread_onces_t datass_array[] = { datas };
-
-  int errnos[] = {
-    1,
-    mock_errno_generic,
-  };
-
-  f_status_t statuss[] = {
-    F_status_set_error(F_failure),
-    F_status_set_error(F_failure),
-  };
-
-  for (uint8_t i = 0; i < 2; ++i) {
-
-    will_return(__wrap_pthread_attr_destroy, true);
-    will_return(__wrap_pthread_attr_destroy, errnos[i]);
-
-    const f_status_t status = f_thread_onces_delete_callback(0, 1, (void *) datass_array);
-
-    assert_int_equal(status, statuss[i]);
-  } // for
-}
-
-void test__f_thread_onces_delete_callback__works(void **state) {
-
-  f_thread_once_t data = f_thread_once_t_initialize;
-  f_thread_once_t data_array[] = { data };
-  f_thread_onces_t datas = { .array = data_array, .used = 1, .size = 1 };
-  f_thread_onces_t datass_array[] = { datas };
-  const f_number_unsigned_t length = 1;
-
-  {
-    will_return(__wrap_pthread_attr_destroy, false);
-
-    const f_status_t status = f_thread_onces_delete_callback(0, length, (void *) datass_array);
-
-    assert_int_equal(status, F_okay);
-  }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.h
deleted file mode 100644 (file)
index 8f08b0e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Thread
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_thread__onces_delete_callback
-#define _TEST__F_thread__onces_delete_callback
-
-/**
- * Test that the function fails.
- *
- * @see f_thread_onces_delete_callback_()
- */
-extern void test__f_thread_onces_delete_callback__fails(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_thread_onces_delete_callback_()
- */
-extern void test__f_thread_onces_delete_callback__works(void **state);
-
-#endif // _TEST__F_thread__onces_delete_callback
diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.c b/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.c
deleted file mode 100644 (file)
index 8f8aea6..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "test-thread.h"
-#include "test-thread-onces_destroy_callback.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_thread_onces_destroy_callback__fails(void **state) {
-
-  f_thread_once_t data = f_thread_once_t_initialize;
-  f_thread_once_t data_array[] = { data };
-  f_thread_onces_t datas = { .array = data_array, .used = 1, .size = 1 };
-  f_thread_onces_t datass_array[] = { datas };
-
-  int errnos[] = {
-    1,
-    mock_errno_generic,
-  };
-
-  f_status_t statuss[] = {
-    F_status_set_error(F_failure),
-    F_status_set_error(F_failure),
-  };
-
-  for (uint8_t i = 0; i < 2; ++i) {
-
-    will_return(__wrap_pthread_attr_destroy, true);
-    will_return(__wrap_pthread_attr_destroy, errnos[i]);
-
-    const f_status_t status = f_thread_onces_destroy_callback(0, 1, (void *) datass_array);
-
-    assert_int_equal(status, statuss[i]);
-  } // for
-}
-
-void test__f_thread_onces_destroy_callback__works(void **state) {
-
-  f_thread_once_t data = f_thread_once_t_initialize;
-  f_thread_once_t data_array[] = { data };
-  f_thread_onces_t datas = { .array = data_array, .used = 1, .size = 1 };
-  f_thread_onces_t datass_array[] = { datas };
-  const f_number_unsigned_t length = 1;
-
-  {
-    will_return(__wrap_pthread_attr_destroy, false);
-
-    const f_status_t status = f_thread_onces_destroy_callback(0, length, (void *) datass_array);
-
-    assert_int_equal(status, F_okay);
-  }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.h
deleted file mode 100644 (file)
index 6976595..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Thread
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_thread__onces_destroy_callback
-#define _TEST__F_thread__onces_destroy_callback
-
-/**
- * Test that the function fails.
- *
- * @see f_thread_onces_destroy_callback_()
- */
-extern void test__f_thread_onces_destroy_callback__fails(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_thread_onces_destroy_callback_()
- */
-extern void test__f_thread_onces_destroy_callback__works(void **state);
-
-#endif // _TEST__F_thread__onces_destroy_callback
diff --git a/level_0/f_thread/tests/unit/c/test-thread-oncess_delete_callback.c b/level_0/f_thread/tests/unit/c/test-thread-oncess_delete_callback.c
deleted file mode 100644 (file)
index 8381886..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "test-thread.h"
-#include "test-thread-oncess_delete_callback.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_thread_oncess_delete_callback__fails(void **state) {
-
-  f_thread_once_t data = f_thread_once_t_initialize;
-  f_thread_once_t data_array[] = { data };
-  f_thread_onces_t datas = { .array = data_array, .used = 1, .size = 1 };
-  f_thread_onces_t datas_array[] = { datas };
-  f_thread_oncess_t datass = { .array = datas_array, .used = 1, .size = 1 };
-  f_thread_oncess_t datass_array[] = { datass };
-
-  int errnos[] = {
-    1,
-    mock_errno_generic,
-  };
-
-  f_status_t statuss[] = {
-    F_status_set_error(F_failure),
-    F_status_set_error(F_failure),
-  };
-
-  for (uint8_t i = 0; i < 2; ++i) {
-
-    will_return(__wrap_pthread_attr_destroy, true);
-    will_return(__wrap_pthread_attr_destroy, errnos[i]);
-
-    const f_status_t status = f_thread_oncess_delete_callback(0, 1, (void *) datass_array);
-
-    assert_int_equal(status, statuss[i]);
-  } // for
-}
-
-void test__f_thread_oncess_delete_callback__works(void **state) {
-
-  f_thread_once_t data = f_thread_once_t_initialize;
-  f_thread_once_t data_array[] = { data };
-  f_thread_onces_t datas = { .array = data_array, .used = 1, .size = 1 };
-  f_thread_onces_t datas_array[] = { datas };
-  f_thread_oncess_t datass = { .array = datas_array, .used = 1, .size = 1 };
-  f_thread_oncess_t datass_array[] = { datass };
-  const f_number_unsigned_t length = 1;
-
-  {
-    will_return(__wrap_pthread_attr_destroy, false);
-    will_return(__wrap_f_memory_array_resize, false);
-    will_return(__wrap_f_memory_array_resize, F_okay);
-
-    const f_status_t status = f_thread_oncess_delete_callback(0, length, (void *) datass_array);
-
-    assert_int_equal(status, F_okay);
-  }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_thread/tests/unit/c/test-thread-oncess_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-oncess_delete_callback.h
deleted file mode 100644 (file)
index bd86a1e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Thread
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_thread__oncess_delete_callback
-#define _TEST__F_thread__oncess_delete_callback
-
-/**
- * Test that the function fails.
- *
- * @see f_thread_oncess_delete_callback_()
- */
-extern void test__f_thread_oncess_delete_callback__fails(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_thread_oncess_delete_callback_()
- */
-extern void test__f_thread_oncess_delete_callback__works(void **state);
-
-#endif // _TEST__F_thread__oncess_delete_callback
diff --git a/level_0/f_thread/tests/unit/c/test-thread-oncess_destroy_callback.c b/level_0/f_thread/tests/unit/c/test-thread-oncess_destroy_callback.c
deleted file mode 100644 (file)
index 016cb90..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "test-thread.h"
-#include "test-thread-oncess_destroy_callback.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_thread_oncess_destroy_callback__fails(void **state) {
-
-  f_thread_once_t data = f_thread_once_t_initialize;
-  f_thread_once_t data_array[] = { data };
-  f_thread_onces_t datas = { .array = data_array, .used = 1, .size = 1 };
-  f_thread_onces_t datas_array[] = { datas };
-  f_thread_oncess_t datass = { .array = datas_array, .used = 1, .size = 1 };
-  f_thread_oncess_t datass_array[] = { datass };
-
-  int errnos[] = {
-    1,
-    mock_errno_generic,
-  };
-
-  f_status_t statuss[] = {
-    F_status_set_error(F_failure),
-    F_status_set_error(F_failure),
-  };
-
-  for (uint8_t i = 0; i < 2; ++i) {
-
-    will_return(__wrap_pthread_attr_destroy, true);
-    will_return(__wrap_pthread_attr_destroy, errnos[i]);
-
-    const f_status_t status = f_thread_oncess_destroy_callback(0, 1, (void *) datass_array);
-
-    assert_int_equal(status, statuss[i]);
-  } // for
-}
-
-void test__f_thread_oncess_destroy_callback__works(void **state) {
-
-  f_thread_once_t data = f_thread_once_t_initialize;
-  f_thread_once_t data_array[] = { data };
-  f_thread_onces_t datas = { .array = data_array, .used = 1, .size = 1 };
-  f_thread_onces_t datas_array[] = { datas };
-  f_thread_oncess_t datass = { .array = datas_array, .used = 1, .size = 1 };
-  f_thread_oncess_t datass_array[] = { datass };
-  const f_number_unsigned_t length = 1;
-
-  {
-    will_return(__wrap_pthread_attr_destroy, false);
-    will_return(__wrap_f_memory_array_adjust, false);
-    will_return(__wrap_f_memory_array_adjust, F_okay);
-
-    const f_status_t status = f_thread_oncess_destroy_callback(0, length, (void *) datass_array);
-
-    assert_int_equal(status, F_okay);
-  }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_thread/tests/unit/c/test-thread-oncess_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-oncess_destroy_callback.h
deleted file mode 100644 (file)
index 7c82532..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Thread
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_thread__oncess_destroy_callback
-#define _TEST__F_thread__oncess_destroy_callback
-
-/**
- * Test that the function fails.
- *
- * @see f_thread_oncess_destroy_callback_()
- */
-extern void test__f_thread_oncess_destroy_callback__fails(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_thread_oncess_destroy_callback_()
- */
-extern void test__f_thread_oncess_destroy_callback__works(void **state);
-
-#endif // _TEST__F_thread__oncess_destroy_callback