It has become clear to me that I didn't actual complete the thread types.
This adds the array of array types that are missing.
The `thread.c` and `thread.h` files are huge.
Break apart the functions based on existing `thread/*` files.
Doing this requires being more particular about the ordering of the header includes.
Update and add appropriate unit tests.
Much of this is done via mass replacements.
There very likely are some unimportant oversights.
build_sources_library utf/string.c utf/triple.c utf/triples.c utf/tripless.c
build_sources_library utf/private-dynamics.c utf/private-maps.c utf/private-map_multis.c utf/private-string.c utf/private-triples.c
-build_sources_library-thread thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/barrier_full.c thread/condition.c thread/condition_attribute.c thread/condition_full.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/lock_full.c thread/mutex.c thread/mutex_attribute.c thread/mutex_full.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c
+build_sources_library-thread thread.c
+build_sources_library-thread thread/attribute.c thread/attributes.c thread/attributess.c
+build_sources_library-thread thread/barrier.c thread/barriers.c thread/barrierss.c thread/barrier_attribute.c thread/barrier_attributes.c thread/barrier_attributess.c thread/barrier_full.c thread/barrier_fulls.c thread/barrier_fullss.c
+build_sources_library-thread thread/condition.c thread/conditions.c thread/conditionss.c thread/condition_attribute.c thread/condition_attributes.c thread/condition_attributess.c thread/condition_full.c thread/condition_fulls.c thread/condition_fullss.c
+build_sources_library-thread thread/id.c thread/ids.c thread/idss.c
+build_sources_library-thread thread/key.c thread/keys.c thread/keyss.c
+build_sources_library-thread thread/lock.c thread/locks.c thread/lockss.c thread/lock_attribute.c thread/lock_attributes.c thread/lock_attributess.c thread/lock_full.c thread/lock_fulls.c thread/lock_fullss.c
+build_sources_library-thread thread/mutex.c thread/mutexs.c thread/mutexss.c thread/mutex_attribute.c thread/mutex_attributes.c thread/mutex_attributess.c thread/mutex_full.c thread/mutex_fulls.c thread/mutex_fullss.c
+build_sources_library-thread thread/once.c thread/onces.c thread/oncess.c
+build_sources_library-thread thread/semaphore.c thread/semaphores.c thread/semaphoress.c
+build_sources_library-thread thread/set.c thread/sets.c thread/setss.c
+build_sources_library-thread thread/spin.c thread/spins.c thread/spinss.c
build_sources_headers abstruse.h abstruse/abstruse.h abstruse/enum.h abstruse/map.h abstruse/type.h
build_sources_headers account.h account/accounts.h account/common.h
build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_signed.h type_array/number_unsigned.h type_array/pid.h type_array/poll.h type_array/quantity.h type_array/quantitys.h type_array/quantityss.h type_array/range.h type_array/ranges.h type_array/rangess.h type_array/range_double.h type_array/range_doubles.h type_array/range_doubless.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h
build_sources_headers utf.h utf/common.h utf/convert.h utf/dynamic.h utf/dynamics.h utf/dynamicss.h utf/is.h utf/is_character.h utf/map.h utf/maps.h utf/mapss.h utf/map_multi.h utf/map_multis.h utf/map_multiss.h utf/static.h utf/statics.h utf/staticss.h utf/string.h utf/triple.h utf/triples.h utf/tripless.h
-build_sources_headers-thread thread.h thread/attribute.h thread/barrier.h thread/barrier_attribute.h thread/barrier_full.h thread/condition.h thread/condition_attribute.h thread/condition_full.h thread/id.h thread/key.h thread/lock.h thread/lock_attribute.h thread/lock_full.h thread/mutex.h thread/mutex_attribute.h thread/mutex_full.h thread/once.h thread/semaphore.h thread/set.h thread/spin.h
+build_sources_headers-thread thread.h
+build_sources_headers-thread thread/attribute.h thread/attributes.h thread/attributess.h
+build_sources_headers-thread thread/barrier.h thread/barriers.h thread/barrierss.h thread/barrier_attribute.h thread/barrier_attributes.h thread/barrier_attributess.h thread/barrier_full.h thread/barrier_fulls.h thread/barrier_fullss.h
+build_sources_headers-thread thread/condition.h thread/conditions.h thread/conditionss.h thread/condition_attribute.h thread/condition_attributes.h thread/condition_attributess.h thread/condition_full.h thread/condition_fulls.h thread/condition_fullss.h
+build_sources_headers-thread thread/id.h thread/ids.h thread/idss.h
+build_sources_headers-thread thread/key.h thread/keys.h thread/keyss.h
+build_sources_headers-thread thread/lock.h thread/locks.h thread/lockss.h thread/lock_attribute.h thread/lock_attributes.h thread/lock_attributess.h thread/lock_full.h thread/lock_fulls.h thread/lock_fullss.h
+build_sources_headers-thread thread/mutex.h thread/mutexs.h thread/mutexss.h thread/mutex_attribute.h thread/mutex_attributes.h thread/mutex_attributess.h thread/mutex_full.h thread/mutex_fulls.h thread/mutex_fullss.h
+build_sources_headers-thread thread/once.h thread/onces.h thread/oncess.h
+build_sources_headers-thread thread/semaphore.h thread/semaphores.h thread/semaphoress.h
+build_sources_headers-thread thread/set.h thread/sets.h thread/setss.h
+build_sources_headers-thread thread/spin.h thread/spins.h thread/spinss.h
build_script yes
build_shared yes
build_sources_library level_2/print.c
build_sources_library level_2/program.c level_2/program/common.c level_2/program/print.c level_2/program/string.c level_2/private-program.c
-build_sources_library-thread level_0/thread.c level_0/thread/attribute.c level_0/thread/barrier.c level_0/thread/barrier_attribute.c level_0/thread/barrier_full.c level_0/thread/condition.c level_0/thread/condition_attribute.c level_0/thread/condition_full.c level_0/thread/id.c level_0/thread/key.c level_0/thread/lock.c level_0/thread/lock_attribute.c level_0/thread/lock_full.c level_0/thread/mutex.c level_0/thread/mutex_attribute.c level_0/thread/mutex_full.c level_0/thread/once.c level_0/thread/semaphore.c level_0/thread/set.c level_0/thread/spin.c
+build_sources_library-thread level_0/thread.c
+build_sources_library-thread level_0/thread/attribute.c level_0/thread/attributes.c level_0/thread/attributess.c
+build_sources_library-thread level_0/thread/barrier.c level_0/thread/barriers.c level_0/thread/barrierss.c level_0/thread/barrier_attribute.c level_0/thread/barrier_attributes.c level_0/thread/barrier_attributess.c level_0/thread/barrier_full.c level_0/thread/barrier_fulls.c level_0/thread/barrier_fullss.c
+build_sources_library-thread level_0/thread/condition.c level_0/thread/conditions.c level_0/thread/conditionss.c level_0/thread/condition_attribute.c level_0/thread/condition_attributes.c level_0/thread/condition_attributess.c level_0/thread/condition_full.c level_0/thread/condition_fulls.c level_0/thread/condition_fullss.c
+build_sources_library-thread level_0/thread/id.c level_0/thread/ids.c level_0/thread/idss.c
+build_sources_library-thread level_0/thread/key.c level_0/thread/keys.c level_0/thread/keyss.c
+build_sources_library-thread level_0/thread/lock.c level_0/thread/locks.c level_0/thread/lockss.c level_0/thread/lock_attribute.c level_0/thread/lock_attributes.c level_0/thread/lock_attributess.c level_0/thread/lock_full.c level_0/thread/lock_fulls.c level_0/thread/lock_fullss.c
+build_sources_library-thread level_0/thread/mutex.c level_0/thread/mutexs.c level_0/thread/mutexss.c level_0/thread/mutex_attribute.c level_0/thread/mutex_attributes.c level_0/thread/mutex_attributess.c level_0/thread/mutex_full.c level_0/thread/mutex_fulls.c level_0/thread/mutex_fullss.c
+build_sources_library-thread level_0/thread/once.c level_0/thread/onces.c level_0/thread/oncess.c
+build_sources_library-thread level_0/thread/semaphore.c level_0/thread/semaphores.c level_0/thread/semaphoress.c
+build_sources_library-thread level_0/thread/set.c level_0/thread/sets.c level_0/thread/setss.c
+build_sources_library-thread level_0/thread/spin.c level_0/thread/spins.c level_0/thread/spinss.c
build_sources_headers level_0/abstruse.h level_0/abstruse/abstruse.h level_0/abstruse/enum.h level_0/abstruse/map.h level_0/abstruse/type.h
build_sources_headers level_0/account.h level_0/account/accounts.h level_0/account/common.h
build_sources_headers level_2/print.h
build_sources_headers level_2/program.h level_2/program/common.h level_2/program/print.h level_2/program/string.h
-build_sources_headers-thread level_0/thread.h level_0/thread/attribute.h level_0/thread/barrier.h level_0/thread/barrier_attribute.h level_0/thread/barrier_full.h level_0/thread/condition.h level_0/thread/condition_attribute.h level_0/thread/condition_full.h level_0/thread/id.h level_0/thread/key.h level_0/thread/lock.h level_0/thread/lock_attribute.h level_0/thread/lock_full.h level_0/thread/mutex.h level_0/thread/mutex_attribute.h level_0/thread/mutex_full.h level_0/thread/once.h level_0/thread/semaphore.h level_0/thread/set.h level_0/thread/spin.h
+build_sources_headers-thread level_0/thread.h
+build_sources_headers-thread level_0/thread/attribute.h level_0/thread/attributes.h level_0/thread/attributess.h
+build_sources_headers-thread level_0/thread/barrier.h level_0/thread/barriers.h level_0/thread/barrierss.h level_0/thread/barrier_attribute.h level_0/thread/barrier_attributes.h level_0/thread/barrier_attributess.h level_0/thread/barrier_full.h level_0/thread/barrier_fulls.h level_0/thread/barrier_fullss.h
+build_sources_headers-thread level_0/thread/condition.h level_0/thread/conditions.h level_0/thread/conditionss.h level_0/thread/condition_attribute.h level_0/thread/condition_attributes.h level_0/thread/condition_attributess.h level_0/thread/condition_full.h level_0/thread/condition_fulls.h level_0/thread/condition_fullss.h
+build_sources_headers-thread level_0/thread/id.h level_0/thread/ids.h level_0/thread/idss.h
+build_sources_headers-thread level_0/thread/key.h level_0/thread/keys.h level_0/thread/keyss.h
+build_sources_headers-thread level_0/thread/lock.h level_0/thread/locks.h level_0/thread/lockss.h level_0/thread/lock_attribute.h level_0/thread/lock_attributes.h level_0/thread/lock_attributess.h level_0/thread/lock_full.h level_0/thread/lock_fulls.h level_0/thread/lock_fullss.h
+build_sources_headers-thread level_0/thread/mutex.h level_0/thread/mutexs.h level_0/thread/mutexss.h level_0/thread/mutex_attribute.h level_0/thread/mutex_attributes.h level_0/thread/mutex_attributess.h level_0/thread/mutex_full.h level_0/thread/mutex_fulls.h level_0/thread/mutex_fullss.h
+build_sources_headers-thread level_0/thread/once.h level_0/thread/onces.h level_0/thread/oncess.h
+build_sources_headers-thread level_0/thread/semaphore.h level_0/thread/semaphores.h level_0/thread/semaphoress.h
+build_sources_headers-thread level_0/thread/set.h level_0/thread/sets.h level_0/thread/setss.h
+build_sources_headers-thread level_0/thread/spin.h level_0/thread/spins.h level_0/thread/spinss.h
build_script yes
build_shared yes
#define _di_f_thread_attributes_t_
#define _di_f_thread_attributess_delete_callback_
#define _di_f_thread_attributess_destroy_callback_
+#define _di_f_thread_attributess_t_
#define _di_f_thread_barrier_attribute_create_
#define _di_f_thread_barrier_attribute_delete_
#define _di_f_thread_barrier_attribute_shared_get_
#define _di_f_thread_barrier_attributes_t_
#define _di_f_thread_barrier_attributess_delete_callback_
#define _di_f_thread_barrier_attributess_destroy_callback_
+#define _di_f_thread_barrier_attributess_t_
#define _di_f_thread_barrier_create_
#define _di_f_thread_barrier_delete_
#define _di_f_thread_barrier_full_delete_
#define _di_f_thread_barrier_fulls_t_
#define _di_f_thread_barrier_fullss_delete_callback_
#define _di_f_thread_barrier_fullss_destroy_callback_
+#define _di_f_thread_barrier_fullss_t_
#define _di_f_thread_barrier_t_
#define _di_f_thread_barrier_wait_
#define _di_f_thread_barriers_delete_callback_
#define _di_f_thread_barriers_t_
#define _di_f_thread_barrierss_delete_callback_
#define _di_f_thread_barrierss_destroy_callback_
+#define _di_f_thread_barrierss_t_
#define _di_f_thread_caller_
//#define _di_f_thread_cancel_
//#define _di_f_thread_cancel_state_set_
#define _di_f_thread_condition_attributes_t_
#define _di_f_thread_condition_attributess_delete_callback_
#define _di_f_thread_condition_attributess_destroy_callback_
+#define _di_f_thread_condition_attributess_t_
#define _di_f_thread_condition_create_
#define _di_f_thread_condition_delete_
#define _di_f_thread_condition_full_delete_
#define _di_f_thread_condition_fulls_t_
#define _di_f_thread_condition_fullss_delete_callback_
#define _di_f_thread_condition_fullss_destroy_callback_
+#define _di_f_thread_condition_fullss_t_
#define _di_f_thread_condition_signal_
#define _di_f_thread_condition_signal_all_
#define _di_f_thread_condition_t_
#define _di_f_thread_conditions_t_
#define _di_f_thread_conditionss_delete_callback_
#define _di_f_thread_conditionss_destroy_callback_
+#define _di_f_thread_conditionss_t_
//#define _di_f_thread_create_
#define _di_f_thread_detach_
#define _di_f_thread_exit_
//#define _di_f_thread_id_t_
+#define _di_f_thread_ids_delete_callback_
+#define _di_f_thread_ids_destroy_callback_
#define _di_f_thread_ids_t_
+#define _di_f_thread_idss_delete_callback_
+#define _di_f_thread_idss_destroy_callback_
+#define _di_f_thread_idss_t_
//#define _di_f_thread_join_
#define _di_f_thread_join_timed_
#define _di_f_thread_join_try_
#define _di_f_thread_keys_t_
#define _di_f_thread_keyss_delete_callback_
#define _di_f_thread_keyss_destroy_callback_
+#define _di_f_thread_keyss_t_
#define _di_f_thread_lock_attribute_create_
#define _di_f_thread_lock_attribute_delete_
#define _di_f_thread_lock_attribute_shared_get_
#define _di_f_thread_lock_attributes_t_
#define _di_f_thread_lock_attributess_delete_callback_
#define _di_f_thread_lock_attributess_destroy_callback_
+#define _di_f_thread_lock_attributess_t_
#define _di_f_thread_lock_create_
#define _di_f_thread_lock_delete_
#define _di_f_thread_lock_full_delete_
#define _di_f_thread_lock_fulls_t_
#define _di_f_thread_lock_fullss_delete_callback_
#define _di_f_thread_lock_fullss_destroy_callback_
+#define _di_f_thread_lock_fullss_t_
#define _di_f_thread_lock_read_
#define _di_f_thread_lock_read_timed_
#define _di_f_thread_lock_read_try_
#define _di_f_thread_locks_t_
#define _di_f_thread_lockss_delete_callback_
#define _di_f_thread_lockss_destroy_callback_
+#define _di_f_thread_lockss_t_
#define _di_f_thread_mutex_attribute_create_
#define _di_f_thread_mutex_attribute_d_
#define _di_f_thread_mutex_attribute_delete_
#define _di_f_thread_mutex_attributes_t_
#define _di_f_thread_mutex_attributess_delete_callback_
#define _di_f_thread_mutex_attributess_destroy_callback_
+#define _di_f_thread_mutex_attributess_t_
#define _di_f_thread_mutex_consistent_
#define _di_f_thread_mutex_create_
#define _di_f_thread_mutex_d_
#define _di_f_thread_mutex_fulls_t_
#define _di_f_thread_mutex_fullss_delete_callback_
#define _di_f_thread_mutex_fullss_destroy_callback_
+#define _di_f_thread_mutex_fullss_t_
#define _di_f_thread_mutex_lock_
#define _di_f_thread_mutex_lock_timed_
#define _di_f_thread_mutex_lock_try_
#define _di_f_thread_mutexs_t_
#define _di_f_thread_mutexss_delete_callback_
#define _di_f_thread_mutexss_destroy_callback_
+#define _di_f_thread_mutexss_t_
#define _di_f_thread_name_get_
#define _di_f_thread_name_set_
#define _di_f_thread_once_
#define _di_f_thread_once_t_
#define _di_f_thread_onces_t_
+#define _di_f_thread_oncess_t_
#define _di_f_thread_scheduler_parameter_get_
#define _di_f_thread_scheduler_parameter_set_
#define _di_f_thread_scheduler_priority_set_
#define _di_f_thread_semaphores_t_
#define _di_f_thread_semaphoress_delete_callback_
#define _di_f_thread_semaphoress_destroy_callback_
+#define _di_f_thread_semaphoress_t_
#define _di_f_thread_set_t_
#define _di_f_thread_sets_delete_callback_
#define _di_f_thread_sets_destroy_callback_
#define _di_f_thread_sets_t_
#define _di_f_thread_setss_delete_callback_
#define _di_f_thread_setss_destroy_callback_
+#define _di_f_thread_setss_t_
//#define _di_f_thread_signal_mask_
#define _di_f_thread_signal_queue_
#define _di_f_thread_signal_write_
#define _di_f_thread_spins_t_
#define _di_f_thread_spinss_delete_callback_
#define _di_f_thread_spinss_destroy_callback_
+#define _di_f_thread_spinss_t_
#define _di_f_thread_unlock_
#define _di_f_time_part_t_
#define _di_f_time_simple_t_
build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c
build_sources_program fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c
-build_sources_program-thread fll/level_0/thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_full.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_full.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_full.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_full.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c
+build_sources_program-thread fll/level_0/thread.c
+build_sources_program-thread fll/level_0/thread/attribute.c fll/level_0/thread/attributes.c fll/level_0/thread/attributess.c
+build_sources_program-thread fll/level_0/thread/barrier.c fll/level_0/thread/barriers.c fll/level_0/thread/barrierss.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_attributes.c fll/level_0/thread/barrier_attributess.c fll/level_0/thread/barrier_full.c fll/level_0/thread/barrier_fulls.c fll/level_0/thread/barrier_fullss.c
+build_sources_program-thread fll/level_0/thread/condition.c fll/level_0/thread/conditions.c fll/level_0/thread/conditionss.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_attributes.c fll/level_0/thread/condition_attributess.c fll/level_0/thread/condition_full.c fll/level_0/thread/condition_fulls.c fll/level_0/thread/condition_fullss.c
+build_sources_program-thread fll/level_0/thread/id.c fll/level_0/thread/ids.c fll/level_0/thread/idss.c
+build_sources_program-thread fll/level_0/thread/key.c fll/level_0/thread/keys.c fll/level_0/thread/keyss.c
+build_sources_program-thread fll/level_0/thread/lock.c fll/level_0/thread/locks.c fll/level_0/thread/lockss.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_attributes.c fll/level_0/thread/lock_attributess.c fll/level_0/thread/lock_full.c fll/level_0/thread/lock_fulls.c fll/level_0/thread/lock_fullss.c
+build_sources_program-thread fll/level_0/thread/mutex.c fll/level_0/thread/mutexs.c fll/level_0/thread/mutexss.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_attributes.c fll/level_0/thread/mutex_attributess.c fll/level_0/thread/mutex_full.c fll/level_0/thread/mutex_fulls.c fll/level_0/thread/mutex_fullss.c
+build_sources_program-thread fll/level_0/thread/once.c fll/level_0/thread/onces.c fll/level_0/thread/oncess.c
+build_sources_program-thread fll/level_0/thread/semaphore.c fll/level_0/thread/semaphores.c fll/level_0/thread/semaphoress.c
+build_sources_program-thread fll/level_0/thread/set.c fll/level_0/thread/sets.c fll/level_0/thread/setss.c
+build_sources_program-thread fll/level_0/thread/spin.c fll/level_0/thread/spins.c fll/level_0/thread/spinss.c
build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c
build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
#define _di_f_thread_attributes_t_
#define _di_f_thread_attributess_delete_callback_
#define _di_f_thread_attributess_destroy_callback_
+#define _di_f_thread_attributess_t_
#define _di_f_thread_barrier_attribute_create_
#define _di_f_thread_barrier_attribute_delete_
#define _di_f_thread_barrier_attribute_shared_get_
#define _di_f_thread_barrier_attributes_t_
#define _di_f_thread_barrier_attributess_delete_callback_
#define _di_f_thread_barrier_attributess_destroy_callback_
+#define _di_f_thread_barrier_attributess_t_
#define _di_f_thread_barrier_create_
#define _di_f_thread_barrier_delete_
#define _di_f_thread_barrier_full_delete_
#define _di_f_thread_barrier_fulls_t_
#define _di_f_thread_barrier_fullss_delete_callback_
#define _di_f_thread_barrier_fullss_destroy_callback_
+#define _di_f_thread_barrier_fullss_t_
#define _di_f_thread_barrier_t_
#define _di_f_thread_barrier_wait_
#define _di_f_thread_barriers_delete_callback_
#define _di_f_thread_barriers_t_
#define _di_f_thread_barrierss_delete_callback_
#define _di_f_thread_barrierss_destroy_callback_
+#define _di_f_thread_barrierss_t_
#define _di_f_thread_caller_
//#define _di_f_thread_cancel_
//#define _di_f_thread_cancel_state_set_
#define _di_f_thread_condition_attributes_t_
#define _di_f_thread_condition_attributess_delete_callback_
#define _di_f_thread_condition_attributess_destroy_callback_
+#define _di_f_thread_condition_attributess_t_
#define _di_f_thread_condition_create_
#define _di_f_thread_condition_delete_
#define _di_f_thread_condition_full_delete_
#define _di_f_thread_condition_fulls_t_
#define _di_f_thread_condition_fullss_delete_callback_
#define _di_f_thread_condition_fullss_destroy_callback_
+#define _di_f_thread_condition_fullss_t_
#define _di_f_thread_condition_signal_
#define _di_f_thread_condition_signal_all_
#define _di_f_thread_condition_t_
#define _di_f_thread_conditions_t_
#define _di_f_thread_conditionss_delete_callback_
#define _di_f_thread_conditionss_destroy_callback_
+#define _di_f_thread_conditionss_t_
//#define _di_f_thread_create_
#define _di_f_thread_detach_
#define _di_f_thread_exit_
//#define _di_f_thread_id_t_
+#define _di_f_thread_ids_delete_callback_
+#define _di_f_thread_ids_destroy_callback_
#define _di_f_thread_ids_t_
+#define _di_f_thread_idss_delete_callback_
+#define _di_f_thread_idss_destroy_callback_
+#define _di_f_thread_idss_t_
//#define _di_f_thread_join_
#define _di_f_thread_join_timed_
#define _di_f_thread_join_try_
#define _di_f_thread_keys_t_
#define _di_f_thread_keyss_delete_callback_
#define _di_f_thread_keyss_destroy_callback_
+#define _di_f_thread_keyss_t_
#define _di_f_thread_lock_attribute_create_
#define _di_f_thread_lock_attribute_delete_
#define _di_f_thread_lock_attribute_shared_get_
#define _di_f_thread_lock_attributes_t_
#define _di_f_thread_lock_attributess_delete_callback_
#define _di_f_thread_lock_attributess_destroy_callback_
+#define _di_f_thread_lock_attributess_t_
#define _di_f_thread_lock_create_
#define _di_f_thread_lock_delete_
#define _di_f_thread_lock_full_delete_
#define _di_f_thread_lock_fulls_t_
#define _di_f_thread_lock_fullss_delete_callback_
#define _di_f_thread_lock_fullss_destroy_callback_
+#define _di_f_thread_lock_fullss_t_
#define _di_f_thread_lock_read_
#define _di_f_thread_lock_read_timed_
#define _di_f_thread_lock_read_try_
#define _di_f_thread_locks_t_
#define _di_f_thread_lockss_delete_callback_
#define _di_f_thread_lockss_destroy_callback_
+#define _di_f_thread_lockss_t_
#define _di_f_thread_mutex_attribute_create_
#define _di_f_thread_mutex_attribute_d_
#define _di_f_thread_mutex_attribute_delete_
#define _di_f_thread_mutex_attributes_t_
#define _di_f_thread_mutex_attributess_delete_callback_
#define _di_f_thread_mutex_attributess_destroy_callback_
+#define _di_f_thread_mutex_attributess_t_
#define _di_f_thread_mutex_consistent_
#define _di_f_thread_mutex_create_
#define _di_f_thread_mutex_d_
#define _di_f_thread_mutex_fulls_t_
#define _di_f_thread_mutex_fullss_delete_callback_
#define _di_f_thread_mutex_fullss_destroy_callback_
+#define _di_f_thread_mutex_fullss_t_
#define _di_f_thread_mutex_lock_
#define _di_f_thread_mutex_lock_timed_
#define _di_f_thread_mutex_lock_try_
#define _di_f_thread_mutexs_t_
#define _di_f_thread_mutexss_delete_callback_
#define _di_f_thread_mutexss_destroy_callback_
+#define _di_f_thread_mutexss_t_
#define _di_f_thread_name_get_
#define _di_f_thread_name_set_
#define _di_f_thread_once_
#define _di_f_thread_once_t_
#define _di_f_thread_onces_t_
+#define _di_f_thread_oncess_t_
#define _di_f_thread_scheduler_parameter_get_
#define _di_f_thread_scheduler_parameter_set_
#define _di_f_thread_scheduler_priority_set_
#define _di_f_thread_semaphores_t_
#define _di_f_thread_semaphoress_delete_callback_
#define _di_f_thread_semaphoress_destroy_callback_
+#define _di_f_thread_semaphoress_t_
#define _di_f_thread_set_t_
#define _di_f_thread_sets_delete_callback_
#define _di_f_thread_sets_destroy_callback_
#define _di_f_thread_sets_t_
#define _di_f_thread_setss_delete_callback_
#define _di_f_thread_setss_destroy_callback_
+#define _di_f_thread_setss_t_
//#define _di_f_thread_signal_mask_
#define _di_f_thread_signal_queue_
#define _di_f_thread_signal_write_
#define _di_f_thread_spins_t_
#define _di_f_thread_spinss_delete_callback_
#define _di_f_thread_spinss_destroy_callback_
+#define _di_f_thread_spinss_t_
#define _di_f_thread_unlock_
#define _di_f_time_calendar_string_
#define _di_f_time_calendar_string_part_
build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c
build_sources_program fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c
-build_sources_program-thread fll/level_0/thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_full.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_full.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_full.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_full.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c
+build_sources_program-thread fll/level_0/thread.c
+build_sources_program-thread fll/level_0/thread/attribute.c fll/level_0/thread/attributes.c fll/level_0/thread/attributess.c
+build_sources_program-thread fll/level_0/thread/barrier.c fll/level_0/thread/barriers.c fll/level_0/thread/barrierss.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_attributes.c fll/level_0/thread/barrier_attributess.c fll/level_0/thread/barrier_full.c fll/level_0/thread/barrier_fulls.c fll/level_0/thread/barrier_fullss.c
+build_sources_program-thread fll/level_0/thread/condition.c fll/level_0/thread/conditions.c fll/level_0/thread/conditionss.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_attributes.c fll/level_0/thread/condition_attributess.c fll/level_0/thread/condition_full.c fll/level_0/thread/condition_fulls.c fll/level_0/thread/condition_fullss.c
+build_sources_program-thread fll/level_0/thread/id.c fll/level_0/thread/ids.c fll/level_0/thread/idss.c
+build_sources_program-thread fll/level_0/thread/key.c fll/level_0/thread/keys.c fll/level_0/thread/keyss.c
+build_sources_program-thread fll/level_0/thread/lock.c fll/level_0/thread/locks.c fll/level_0/thread/lockss.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_attributes.c fll/level_0/thread/lock_attributess.c fll/level_0/thread/lock_full.c fll/level_0/thread/lock_fulls.c fll/level_0/thread/lock_fullss.c
+build_sources_program-thread fll/level_0/thread/mutex.c fll/level_0/thread/mutexs.c fll/level_0/thread/mutexss.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_attributes.c fll/level_0/thread/mutex_attributess.c fll/level_0/thread/mutex_full.c fll/level_0/thread/mutex_fulls.c fll/level_0/thread/mutex_fullss.c
+build_sources_program-thread fll/level_0/thread/once.c fll/level_0/thread/onces.c fll/level_0/thread/oncess.c
+build_sources_program-thread fll/level_0/thread/semaphore.c fll/level_0/thread/semaphores.c fll/level_0/thread/semaphoress.c
+build_sources_program-thread fll/level_0/thread/set.c fll/level_0/thread/sets.c fll/level_0/thread/setss.c
+build_sources_program-thread fll/level_0/thread/spin.c fll/level_0/thread/spins.c fll/level_0/thread/spinss.c
build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
#define _di_f_thread_attributes_t_
#define _di_f_thread_attributess_delete_callback_
#define _di_f_thread_attributess_destroy_callback_
+#define _di_f_thread_attributess_t_
#define _di_f_thread_barrier_attribute_create_
#define _di_f_thread_barrier_attribute_delete_
#define _di_f_thread_barrier_attribute_shared_get_
#define _di_f_thread_barrier_attributes_t_
#define _di_f_thread_barrier_attributess_delete_callback_
#define _di_f_thread_barrier_attributess_destroy_callback_
+#define _di_f_thread_barrier_attributess_t_
#define _di_f_thread_barrier_create_
#define _di_f_thread_barrier_delete_
#define _di_f_thread_barrier_full_delete_
#define _di_f_thread_barrier_fulls_t_
#define _di_f_thread_barrier_fullss_delete_callback_
#define _di_f_thread_barrier_fullss_destroy_callback_
+#define _di_f_thread_barrier_fullss_t_
#define _di_f_thread_barrier_t_
#define _di_f_thread_barrier_wait_
#define _di_f_thread_barriers_delete_callback_
#define _di_f_thread_barriers_t_
#define _di_f_thread_barrierss_delete_callback_
#define _di_f_thread_barrierss_destroy_callback_
+#define _di_f_thread_barrierss_t_
#define _di_f_thread_caller_
//#define _di_f_thread_cancel_
//#define _di_f_thread_cancel_state_set_
#define _di_f_thread_condition_attributes_t_
#define _di_f_thread_condition_attributess_delete_callback_
#define _di_f_thread_condition_attributess_destroy_callback_
+#define _di_f_thread_condition_attributess_t_
#define _di_f_thread_condition_create_
#define _di_f_thread_condition_delete_
#define _di_f_thread_condition_full_delete_
#define _di_f_thread_condition_fulls_t_
#define _di_f_thread_condition_fullss_delete_callback_
#define _di_f_thread_condition_fullss_destroy_callback_
+#define _di_f_thread_condition_fullss_t_
#define _di_f_thread_condition_signal_
#define _di_f_thread_condition_signal_all_
#define _di_f_thread_condition_t_
#define _di_f_thread_conditions_t_
#define _di_f_thread_conditionss_delete_callback_
#define _di_f_thread_conditionss_destroy_callback_
+#define _di_f_thread_conditionss_t_
//#define _di_f_thread_create_
#define _di_f_thread_detach_
#define _di_f_thread_exit_
//#define _di_f_thread_id_t_
+#define _di_f_thread_ids_delete_callback_
+#define _di_f_thread_ids_destroy_callback_
#define _di_f_thread_ids_t_
+#define _di_f_thread_idss_delete_callback_
+#define _di_f_thread_idss_destroy_callback_
+#define _di_f_thread_idss_t_
//#define _di_f_thread_join_
#define _di_f_thread_join_timed_
#define _di_f_thread_join_try_
#define _di_f_thread_keys_t_
#define _di_f_thread_keyss_delete_callback_
#define _di_f_thread_keyss_destroy_callback_
+#define _di_f_thread_keyss_t_
#define _di_f_thread_lock_attribute_create_
#define _di_f_thread_lock_attribute_delete_
#define _di_f_thread_lock_attribute_shared_get_
#define _di_f_thread_lock_attributes_t_
#define _di_f_thread_lock_attributess_delete_callback_
#define _di_f_thread_lock_attributess_destroy_callback_
+#define _di_f_thread_lock_attributess_t_
#define _di_f_thread_lock_create_
#define _di_f_thread_lock_delete_
#define _di_f_thread_lock_full_delete_
#define _di_f_thread_lock_fulls_t_
#define _di_f_thread_lock_fullss_delete_callback_
#define _di_f_thread_lock_fullss_destroy_callback_
+#define _di_f_thread_lock_fullss_t_
#define _di_f_thread_lock_read_
#define _di_f_thread_lock_read_timed_
#define _di_f_thread_lock_read_try_
#define _di_f_thread_locks_t_
#define _di_f_thread_lockss_delete_callback_
#define _di_f_thread_lockss_destroy_callback_
+#define _di_f_thread_lockss_t_
#define _di_f_thread_mutex_attribute_create_
#define _di_f_thread_mutex_attribute_d_
#define _di_f_thread_mutex_attribute_delete_
#define _di_f_thread_mutex_attributes_t_
#define _di_f_thread_mutex_attributess_delete_callback_
#define _di_f_thread_mutex_attributess_destroy_callback_
+#define _di_f_thread_mutex_attributess_t_
#define _di_f_thread_mutex_consistent_
#define _di_f_thread_mutex_create_
#define _di_f_thread_mutex_d_
#define _di_f_thread_mutex_fulls_t_
#define _di_f_thread_mutex_fullss_delete_callback_
#define _di_f_thread_mutex_fullss_destroy_callback_
+#define _di_f_thread_mutex_fullss_t_
#define _di_f_thread_mutex_lock_
#define _di_f_thread_mutex_lock_timed_
#define _di_f_thread_mutex_lock_try_
#define _di_f_thread_mutexs_t_
#define _di_f_thread_mutexss_delete_callback_
#define _di_f_thread_mutexss_destroy_callback_
+#define _di_f_thread_mutexss_t_
#define _di_f_thread_name_get_
#define _di_f_thread_name_set_
#define _di_f_thread_once_
#define _di_f_thread_once_t_
#define _di_f_thread_onces_t_
+#define _di_f_thread_oncess_t_
#define _di_f_thread_scheduler_parameter_get_
#define _di_f_thread_scheduler_parameter_set_
#define _di_f_thread_scheduler_priority_set_
#define _di_f_thread_semaphores_t_
#define _di_f_thread_semaphoress_delete_callback_
#define _di_f_thread_semaphoress_destroy_callback_
+#define _di_f_thread_semaphoress_t_
#define _di_f_thread_set_t_
#define _di_f_thread_sets_delete_callback_
#define _di_f_thread_sets_destroy_callback_
#define _di_f_thread_sets_t_
#define _di_f_thread_setss_delete_callback_
#define _di_f_thread_setss_destroy_callback_
+#define _di_f_thread_setss_t_
//#define _di_f_thread_signal_mask_
#define _di_f_thread_signal_queue_
#define _di_f_thread_signal_write_
#define _di_f_thread_spins_t_
#define _di_f_thread_spinss_delete_callback_
#define _di_f_thread_spinss_destroy_callback_
+#define _di_f_thread_spinss_t_
#define _di_f_thread_unlock_
#define _di_f_time_part_t_
#define _di_f_time_simple_t_
build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c
build_sources_program fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c
-build_sources_program-thread fll/level_0/thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_full.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_full.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_full.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_full.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c
+build_sources_program-thread fll/level_0/thread.c
+build_sources_program-thread fll/level_0/thread/attribute.c fll/level_0/thread/attributes.c fll/level_0/thread/attributess.c
+build_sources_program-thread fll/level_0/thread/barrier.c fll/level_0/thread/barriers.c fll/level_0/thread/barrierss.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_attributes.c fll/level_0/thread/barrier_attributess.c fll/level_0/thread/barrier_full.c fll/level_0/thread/barrier_fulls.c fll/level_0/thread/barrier_fullss.c
+build_sources_program-thread fll/level_0/thread/condition.c fll/level_0/thread/conditions.c fll/level_0/thread/conditionss.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_attributes.c fll/level_0/thread/condition_attributess.c fll/level_0/thread/condition_full.c fll/level_0/thread/condition_fulls.c fll/level_0/thread/condition_fullss.c
+build_sources_program-thread fll/level_0/thread/id.c fll/level_0/thread/ids.c fll/level_0/thread/idss.c
+build_sources_program-thread fll/level_0/thread/key.c fll/level_0/thread/keys.c fll/level_0/thread/keyss.c
+build_sources_program-thread fll/level_0/thread/lock.c fll/level_0/thread/locks.c fll/level_0/thread/lockss.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_attributes.c fll/level_0/thread/lock_attributess.c fll/level_0/thread/lock_full.c fll/level_0/thread/lock_fulls.c fll/level_0/thread/lock_fullss.c
+build_sources_program-thread fll/level_0/thread/mutex.c fll/level_0/thread/mutexs.c fll/level_0/thread/mutexss.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_attributes.c fll/level_0/thread/mutex_attributess.c fll/level_0/thread/mutex_full.c fll/level_0/thread/mutex_fulls.c fll/level_0/thread/mutex_fullss.c
+build_sources_program-thread fll/level_0/thread/once.c fll/level_0/thread/onces.c fll/level_0/thread/oncess.c
+build_sources_program-thread fll/level_0/thread/semaphore.c fll/level_0/thread/semaphores.c fll/level_0/thread/semaphoress.c
+build_sources_program-thread fll/level_0/thread/set.c fll/level_0/thread/sets.c fll/level_0/thread/setss.c
+build_sources_program-thread fll/level_0/thread/spin.c fll/level_0/thread/spins.c fll/level_0/thread/spinss.c
build_sources_program fll/level_1/control_group.c
build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c
#define _di_f_thread_attributes_t_
#define _di_f_thread_attributess_delete_callback_
#define _di_f_thread_attributess_destroy_callback_
+#define _di_f_thread_attributess_t_
#define _di_f_thread_barrier_attribute_create_
#define _di_f_thread_barrier_attribute_delete_
#define _di_f_thread_barrier_attribute_shared_get_
#define _di_f_thread_barrier_attributes_t_
#define _di_f_thread_barrier_attributess_delete_callback_
#define _di_f_thread_barrier_attributess_destroy_callback_
+#define _di_f_thread_barrier_attributess_t_
#define _di_f_thread_barrier_create_
#define _di_f_thread_barrier_delete_
#define _di_f_thread_barrier_full_delete_
#define _di_f_thread_barrier_fulls_t_
#define _di_f_thread_barrier_fullss_delete_callback_
#define _di_f_thread_barrier_fullss_destroy_callback_
+#define _di_f_thread_barrier_fullss_t_
#define _di_f_thread_barrier_t_
#define _di_f_thread_barrier_wait_
#define _di_f_thread_barriers_delete_callback_
#define _di_f_thread_barriers_t_
#define _di_f_thread_barrierss_delete_callback_
#define _di_f_thread_barrierss_destroy_callback_
+#define _di_f_thread_barrierss_t_
#define _di_f_thread_caller_
//#define _di_f_thread_cancel_
//#define _di_f_thread_cancel_state_set_
#define _di_f_thread_condition_attributes_t_
#define _di_f_thread_condition_attributess_delete_callback_
#define _di_f_thread_condition_attributess_destroy_callback_
+#define _di_f_thread_condition_attributess_t_
#define _di_f_thread_condition_create_
#define _di_f_thread_condition_delete_
#define _di_f_thread_condition_full_delete_
#define _di_f_thread_condition_fulls_t_
#define _di_f_thread_condition_fullss_delete_callback_
#define _di_f_thread_condition_fullss_destroy_callback_
+#define _di_f_thread_condition_fullss_t_
#define _di_f_thread_condition_signal_
#define _di_f_thread_condition_signal_all_
#define _di_f_thread_condition_t_
#define _di_f_thread_conditions_t_
#define _di_f_thread_conditionss_delete_callback_
#define _di_f_thread_conditionss_destroy_callback_
+#define _di_f_thread_conditionss_t_
//#define _di_f_thread_create_
#define _di_f_thread_detach_
#define _di_f_thread_exit_
//#define _di_f_thread_id_t_
+#define _di_f_thread_ids_delete_callback_
+#define _di_f_thread_ids_destroy_callback_
#define _di_f_thread_ids_t_
+#define _di_f_thread_idss_delete_callback_
+#define _di_f_thread_idss_destroy_callback_
+#define _di_f_thread_idss_t_
//#define _di_f_thread_join_
#define _di_f_thread_join_timed_
#define _di_f_thread_join_try_
#define _di_f_thread_keys_t_
#define _di_f_thread_keyss_delete_callback_
#define _di_f_thread_keyss_destroy_callback_
+#define _di_f_thread_keyss_t_
#define _di_f_thread_lock_attribute_create_
#define _di_f_thread_lock_attribute_delete_
#define _di_f_thread_lock_attribute_shared_get_
#define _di_f_thread_lock_attributes_t_
#define _di_f_thread_lock_attributess_delete_callback_
#define _di_f_thread_lock_attributess_destroy_callback_
+#define _di_f_thread_lock_attributess_t_
#define _di_f_thread_lock_create_
#define _di_f_thread_lock_delete_
#define _di_f_thread_lock_full_delete_
#define _di_f_thread_lock_fulls_t_
#define _di_f_thread_lock_fullss_delete_callback_
#define _di_f_thread_lock_fullss_destroy_callback_
+#define _di_f_thread_lock_fullss_t_
#define _di_f_thread_lock_read_
#define _di_f_thread_lock_read_timed_
#define _di_f_thread_lock_read_try_
#define _di_f_thread_locks_t_
#define _di_f_thread_lockss_delete_callback_
#define _di_f_thread_lockss_destroy_callback_
+#define _di_f_thread_lockss_t_
#define _di_f_thread_mutex_attribute_create_
#define _di_f_thread_mutex_attribute_d_
#define _di_f_thread_mutex_attribute_delete_
#define _di_f_thread_mutex_attributes_t_
#define _di_f_thread_mutex_attributess_delete_callback_
#define _di_f_thread_mutex_attributess_destroy_callback_
+#define _di_f_thread_mutex_attributess_t_
#define _di_f_thread_mutex_consistent_
#define _di_f_thread_mutex_create_
#define _di_f_thread_mutex_d_
#define _di_f_thread_mutex_fulls_t_
#define _di_f_thread_mutex_fullss_delete_callback_
#define _di_f_thread_mutex_fullss_destroy_callback_
+#define _di_f_thread_mutex_fullss_t_
#define _di_f_thread_mutex_lock_
#define _di_f_thread_mutex_lock_timed_
#define _di_f_thread_mutex_lock_try_
#define _di_f_thread_mutexs_t_
#define _di_f_thread_mutexss_delete_callback_
#define _di_f_thread_mutexss_destroy_callback_
+#define _di_f_thread_mutexss_t_
#define _di_f_thread_name_get_
#define _di_f_thread_name_set_
#define _di_f_thread_once_
#define _di_f_thread_once_t_
#define _di_f_thread_onces_t_
+#define _di_f_thread_oncess_t_
#define _di_f_thread_scheduler_parameter_get_
#define _di_f_thread_scheduler_parameter_set_
#define _di_f_thread_scheduler_priority_set_
#define _di_f_thread_semaphores_t_
#define _di_f_thread_semaphoress_delete_callback_
#define _di_f_thread_semaphoress_destroy_callback_
+#define _di_f_thread_semaphoress_t_
#define _di_f_thread_set_t_
#define _di_f_thread_sets_delete_callback_
#define _di_f_thread_sets_destroy_callback_
#define _di_f_thread_sets_t_
#define _di_f_thread_setss_delete_callback_
#define _di_f_thread_setss_destroy_callback_
+#define _di_f_thread_setss_t_
//#define _di_f_thread_signal_mask_
#define _di_f_thread_signal_queue_
#define _di_f_thread_signal_write_
#define _di_f_thread_spins_t_
#define _di_f_thread_spinss_delete_callback_
#define _di_f_thread_spinss_destroy_callback_
+#define _di_f_thread_spinss_t_
#define _di_f_thread_unlock_
#define _di_f_time_calendar_string_
#define _di_f_time_calendar_string_part_
build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c
build_sources_program fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c
-build_sources_program-thread fll/level_0/thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_full.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_full.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_full.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_full.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c
+build_sources_program-thread fll/level_0/thread.c
+build_sources_program-thread fll/level_0/thread/attribute.c fll/level_0/thread/attributes.c fll/level_0/thread/attributess.c
+build_sources_program-thread fll/level_0/thread/barrier.c fll/level_0/thread/barriers.c fll/level_0/thread/barrierss.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_attributes.c fll/level_0/thread/barrier_attributess.c fll/level_0/thread/barrier_full.c fll/level_0/thread/barrier_fulls.c fll/level_0/thread/barrier_fullss.c
+build_sources_program-thread fll/level_0/thread/condition.c fll/level_0/thread/conditions.c fll/level_0/thread/conditionss.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_attributes.c fll/level_0/thread/condition_attributess.c fll/level_0/thread/condition_full.c fll/level_0/thread/condition_fulls.c fll/level_0/thread/condition_fullss.c
+build_sources_program-thread fll/level_0/thread/id.c fll/level_0/thread/ids.c fll/level_0/thread/idss.c
+build_sources_program-thread fll/level_0/thread/key.c fll/level_0/thread/keys.c fll/level_0/thread/keyss.c
+build_sources_program-thread fll/level_0/thread/lock.c fll/level_0/thread/locks.c fll/level_0/thread/lockss.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_attributes.c fll/level_0/thread/lock_attributess.c fll/level_0/thread/lock_full.c fll/level_0/thread/lock_fulls.c fll/level_0/thread/lock_fullss.c
+build_sources_program-thread fll/level_0/thread/mutex.c fll/level_0/thread/mutexs.c fll/level_0/thread/mutexss.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_attributes.c fll/level_0/thread/mutex_attributess.c fll/level_0/thread/mutex_full.c fll/level_0/thread/mutex_fulls.c fll/level_0/thread/mutex_fullss.c
+build_sources_program-thread fll/level_0/thread/once.c fll/level_0/thread/onces.c fll/level_0/thread/oncess.c
+build_sources_program-thread fll/level_0/thread/semaphore.c fll/level_0/thread/semaphores.c fll/level_0/thread/semaphoress.c
+build_sources_program-thread fll/level_0/thread/set.c fll/level_0/thread/sets.c fll/level_0/thread/setss.c
+build_sources_program-thread fll/level_0/thread/spin.c fll/level_0/thread/spins.c fll/level_0/thread/spinss.c
build_sources_program fll/level_1/control_group.c
build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c
#define _di_f_thread_attributes_t_
#define _di_f_thread_attributess_delete_callback_
#define _di_f_thread_attributess_destroy_callback_
+#define _di_f_thread_attributess_t_
#define _di_f_thread_barrier_attribute_create_
#define _di_f_thread_barrier_attribute_delete_
#define _di_f_thread_barrier_attribute_shared_get_
#define _di_f_thread_barrier_attributes_t_
#define _di_f_thread_barrier_attributess_delete_callback_
#define _di_f_thread_barrier_attributess_destroy_callback_
+#define _di_f_thread_barrier_attributess_t_
#define _di_f_thread_barrier_create_
#define _di_f_thread_barrier_delete_
#define _di_f_thread_barrier_full_delete_
#define _di_f_thread_barrier_fulls_t_
#define _di_f_thread_barrier_fullss_delete_callback_
#define _di_f_thread_barrier_fullss_destroy_callback_
+#define _di_f_thread_barrier_fullss_t_
#define _di_f_thread_barrier_t_
#define _di_f_thread_barrier_wait_
#define _di_f_thread_barriers_delete_callback_
#define _di_f_thread_barriers_t_
#define _di_f_thread_barrierss_delete_callback_
#define _di_f_thread_barrierss_destroy_callback_
+#define _di_f_thread_barrierss_t_
#define _di_f_thread_caller_
//#define _di_f_thread_cancel_
//#define _di_f_thread_cancel_state_set_
#define _di_f_thread_condition_attributes_t_
#define _di_f_thread_condition_attributess_delete_callback_
#define _di_f_thread_condition_attributess_destroy_callback_
+#define _di_f_thread_condition_attributess_t_
#define _di_f_thread_condition_create_
#define _di_f_thread_condition_delete_
#define _di_f_thread_condition_full_delete_
#define _di_f_thread_condition_fulls_t_
#define _di_f_thread_condition_fullss_delete_callback_
#define _di_f_thread_condition_fullss_destroy_callback_
-#define _di_f_thread_condition_full_delete_
-#define _di_f_thread_condition_full_t_
-#define _di_f_thread_condition_fulls_delete_callback_
-#define _di_f_thread_condition_fulls_destroy_callback_
-#define _di_f_thread_condition_fulls_t_
-#define _di_f_thread_condition_fullss_delete_callback_
-#define _di_f_thread_condition_fullss_destroy_callback_
+#define _di_f_thread_condition_fullss_t_
#define _di_f_thread_condition_signal_
#define _di_f_thread_condition_signal_all_
#define _di_f_thread_condition_t_
#define _di_f_thread_conditions_t_
#define _di_f_thread_conditionss_delete_callback_
#define _di_f_thread_conditionss_destroy_callback_
+#define _di_f_thread_conditionss_t_
//#define _di_f_thread_create_
#define _di_f_thread_detach_
#define _di_f_thread_exit_
//#define _di_f_thread_id_t_
+#define _di_f_thread_ids_delete_callback_
+#define _di_f_thread_ids_destroy_callback_
#define _di_f_thread_ids_t_
+#define _di_f_thread_idss_delete_callback_
+#define _di_f_thread_idss_destroy_callback_
+#define _di_f_thread_idss_t_
//#define _di_f_thread_join_
#define _di_f_thread_join_timed_
#define _di_f_thread_join_try_
#define _di_f_thread_keys_t_
#define _di_f_thread_keyss_delete_callback_
#define _di_f_thread_keyss_destroy_callback_
+#define _di_f_thread_keyss_t_
#define _di_f_thread_lock_attribute_create_
#define _di_f_thread_lock_attribute_delete_
#define _di_f_thread_lock_attribute_shared_get_
#define _di_f_thread_lock_attributes_t_
#define _di_f_thread_lock_attributess_delete_callback_
#define _di_f_thread_lock_attributess_destroy_callback_
+#define _di_f_thread_lock_attributess_t_
#define _di_f_thread_lock_create_
#define _di_f_thread_lock_delete_
#define _di_f_thread_lock_full_delete_
#define _di_f_thread_lock_fulls_t_
#define _di_f_thread_lock_fullss_delete_callback_
#define _di_f_thread_lock_fullss_destroy_callback_
+#define _di_f_thread_lock_fullss_t_
#define _di_f_thread_lock_read_
#define _di_f_thread_lock_read_timed_
#define _di_f_thread_lock_read_try_
#define _di_f_thread_locks_t_
#define _di_f_thread_lockss_delete_callback_
#define _di_f_thread_lockss_destroy_callback_
+#define _di_f_thread_lockss_t_
#define _di_f_thread_mutex_attribute_create_
#define _di_f_thread_mutex_attribute_d_
#define _di_f_thread_mutex_attribute_delete_
#define _di_f_thread_mutex_attributes_t_
#define _di_f_thread_mutex_attributess_delete_callback_
#define _di_f_thread_mutex_attributess_destroy_callback_
+#define _di_f_thread_mutex_attributess_t_
#define _di_f_thread_mutex_consistent_
#define _di_f_thread_mutex_create_
#define _di_f_thread_mutex_d_
#define _di_f_thread_mutex_fulls_t_
#define _di_f_thread_mutex_fullss_delete_callback_
#define _di_f_thread_mutex_fullss_destroy_callback_
+#define _di_f_thread_mutex_fullss_t_
#define _di_f_thread_mutex_lock_
#define _di_f_thread_mutex_lock_timed_
#define _di_f_thread_mutex_lock_try_
#define _di_f_thread_mutexs_t_
#define _di_f_thread_mutexss_delete_callback_
#define _di_f_thread_mutexss_destroy_callback_
+#define _di_f_thread_mutexss_t_
#define _di_f_thread_name_get_
#define _di_f_thread_name_set_
#define _di_f_thread_once_
#define _di_f_thread_once_t_
#define _di_f_thread_onces_t_
+#define _di_f_thread_oncess_t_
#define _di_f_thread_scheduler_parameter_get_
#define _di_f_thread_scheduler_parameter_set_
#define _di_f_thread_scheduler_priority_set_
#define _di_f_thread_semaphores_t_
#define _di_f_thread_semaphoress_delete_callback_
#define _di_f_thread_semaphoress_destroy_callback_
+#define _di_f_thread_semaphoress_t_
#define _di_f_thread_set_t_
#define _di_f_thread_sets_delete_callback_
#define _di_f_thread_sets_destroy_callback_
#define _di_f_thread_sets_t_
#define _di_f_thread_setss_delete_callback_
#define _di_f_thread_setss_destroy_callback_
+#define _di_f_thread_setss_t_
//#define _di_f_thread_signal_mask_
#define _di_f_thread_signal_queue_
#define _di_f_thread_signal_write_
#define _di_f_thread_spins_t_
#define _di_f_thread_spinss_delete_callback_
#define _di_f_thread_spinss_destroy_callback_
+#define _di_f_thread_spinss_t_
#define _di_f_thread_unlock_
#define _di_f_time_part_t_
#define _di_f_time_simple_t_
build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c
build_sources_program fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c
-build_sources_program-thread fll/level_0/thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_full.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_full.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_full.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_full.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c
+build_sources_program-thread fll/level_0/thread.c
+build_sources_program-thread fll/level_0/thread/attribute.c fll/level_0/thread/attributes.c fll/level_0/thread/attributess.c
+build_sources_program-thread fll/level_0/thread/barrier.c fll/level_0/thread/barriers.c fll/level_0/thread/barrierss.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/barrier_attributes.c fll/level_0/thread/barrier_attributess.c fll/level_0/thread/barrier_full.c fll/level_0/thread/barrier_fulls.c fll/level_0/thread/barrier_fullss.c
+build_sources_program-thread fll/level_0/thread/condition.c fll/level_0/thread/conditions.c fll/level_0/thread/conditionss.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/condition_attributes.c fll/level_0/thread/condition_attributess.c fll/level_0/thread/condition_full.c fll/level_0/thread/condition_fulls.c fll/level_0/thread/condition_fullss.c
+build_sources_program-thread fll/level_0/thread/id.c fll/level_0/thread/ids.c fll/level_0/thread/idss.c
+build_sources_program-thread fll/level_0/thread/key.c fll/level_0/thread/keys.c fll/level_0/thread/keyss.c
+build_sources_program-thread fll/level_0/thread/lock.c fll/level_0/thread/locks.c fll/level_0/thread/lockss.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/lock_attributes.c fll/level_0/thread/lock_attributess.c fll/level_0/thread/lock_full.c fll/level_0/thread/lock_fulls.c fll/level_0/thread/lock_fullss.c
+build_sources_program-thread fll/level_0/thread/mutex.c fll/level_0/thread/mutexs.c fll/level_0/thread/mutexss.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/mutex_attributes.c fll/level_0/thread/mutex_attributess.c fll/level_0/thread/mutex_full.c fll/level_0/thread/mutex_fulls.c fll/level_0/thread/mutex_fullss.c
+build_sources_program-thread fll/level_0/thread/once.c fll/level_0/thread/onces.c fll/level_0/thread/oncess.c
+build_sources_program-thread fll/level_0/thread/semaphore.c fll/level_0/thread/semaphores.c fll/level_0/thread/semaphoress.c
+build_sources_program-thread fll/level_0/thread/set.c fll/level_0/thread/sets.c fll/level_0/thread/setss.c
+build_sources_program-thread fll/level_0/thread/spin.c fll/level_0/thread/spins.c fll/level_0/thread/spinss.c
build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c
build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
return F_okay;
}
-#endif // _di_f_thread_key_create_
+#endif // _di_f_thread_at_fork_
-#if defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_get_)
- f_status_t f_thread_attribute_affinity_get(const f_thread_attribute_t attribute, const size_t affinity_size, cpu_set_t * const affinity_set) {
- #ifndef _di_level_0_parameter_checking_
- if (!affinity_set) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_caller_
+ f_thread_id_t f_thread_caller(void) {
- return F_status_set_error(F_implement_not);
+ return pthread_self();
}
-#elif !defined(_di_f_thread_attribute_affinity_get_)
- f_status_t f_thread_attribute_affinity_get(const f_thread_attribute_t attribute, const size_t affinity_size, cpu_set_t * const affinity_set) {
- #ifndef _di_level_0_parameter_checking_
- if (!affinity_set) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#endif // _di_f_thread_caller_
+
+#ifndef _di_f_thread_cancel_
+ f_status_t f_thread_cancel(const f_thread_id_t id) {
- const int error = pthread_attr_getaffinity_np(&attribute, affinity_size, affinity_set);
+ const int error = pthread_cancel(id);
if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_get_)
+#endif // _di_f_thread_cancel_
-#if defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_set_)
- f_status_t f_thread_attribute_affinity_set(const size_t affinity_size, const cpu_set_t * const affinity_set, f_thread_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_cancel_state_set_
+ f_status_t f_thread_cancel_state_set(const int state, int * const previous) {
- return F_status_set_error(F_implement_not);
- }
-#elif !defined(_di_f_thread_attribute_affinity_set_)
- f_status_t f_thread_attribute_affinity_set(const size_t affinity_size, const cpu_set_t * const affinity_set, f_thread_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+ int error = 0;
+
+ // POSIX doesn't allow "previous" to be NULL, so make POSIX happy.
+ if (!previous) {
+ int ignore = 0;
- const int error = pthread_attr_setaffinity_np(attribute, affinity_size, affinity_set);
+ error = pthread_setcancelstate(state, &ignore);
+ }
+ else {
+ error = pthread_setcancelstate(state, previous);
+ }
if (error) {
if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_set_)
+#endif // _di_f_thread_cancel_state_set_
-#ifndef _di_f_thread_attribute_concurrency_get_
- f_status_t f_thread_attribute_concurrency_get(int * const level) {
- #ifndef _di_level_0_parameter_checking_
- if (!level) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_cancel_test_
+ f_status_t f_thread_cancel_test(void) {
- *level = pthread_getconcurrency();
+ pthread_testcancel();
return F_okay;
}
-#endif // _di_f_thread_attribute_concurrency_get_
+#endif // _di_f_thread_cancel_test_
-#ifndef _di_f_thread_attribute_concurrency_set_
- f_status_t f_thread_attribute_concurrency_set(const int level) {
+#ifndef _di_f_thread_cancel_type_set_
+ f_status_t f_thread_cancel_type_set(const int type, int * const previous) {
- const int error = pthread_setconcurrency(level);
+ const int error = pthread_setcanceltype(type, previous);
if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
if (error == EINVAL) return F_status_set_error(F_parameter);
return F_status_set_error(F_failure);
return F_okay;
}
-#endif // _di_f_thread_attribute_concurrency_set_
+#endif // _di_f_thread_cancel_type_set_
-#ifndef _di_f_thread_attribute_create_
- f_status_t f_thread_attribute_create(f_thread_attribute_t * const attribute) {
+#ifndef _di_f_thread_clock_get_id_
+ f_status_t f_thread_clock_get_id(const f_thread_id_t id_thread, clockid_t * const id_clock) {
#ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
+ if (!id_clock) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- const int error = pthread_attr_init(attribute);
+ const int error = pthread_getcpuclockid(id_thread, id_clock);
if (error) {
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
+ if (error == ENOENT) return F_status_set_error(F_support_not);
+ if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_create_
-
-#ifndef _di_f_thread_attribute_default_get_
- f_status_t f_thread_attribute_default_get(f_thread_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_getattr_default_np(attribute);
+#endif // _di_f_thread_clock_get_id_
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
+#ifndef _di_f_thread_compare_
+ f_status_t f_thread_compare(const f_thread_id_t id1, const f_thread_id_t id2) {
- return F_status_set_error(F_failure);
+ if (pthread_equal(id1, id2)) {
+ return F_equal_to;
}
- return F_okay;
+ return F_equal_to_not;
}
-#endif // _di_f_thread_attribute_default_get_
+#endif // _di_f_thread_compare_
-#ifndef _di_f_thread_attribute_default_set_
- f_status_t f_thread_attribute_default_set(f_thread_attribute_t * const attribute) {
+#ifndef _di_f_thread_create_
+ f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, const f_void_pointer_call_t routine, void * const argument) {
#ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
+ if (!id) return F_status_set_error(F_parameter);
+ if (!routine) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- const int error = pthread_setattr_default_np(attribute);
+ const int error = pthread_create(id, attribute, routine, argument);
if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_default_set_
-
-#ifndef _di_f_thread_attribute_delete_
- f_status_t f_thread_attribute_delete(f_thread_attribute_t *attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (pthread_attr_destroy(attribute)) return F_status_set_error(F_failure);
-
- return F_okay;
- }
-#endif // _di_f_thread_attribute_delete_
+#endif // _di_f_thread_create_
-#ifndef _di_f_thread_attribute_detach_get_
- f_status_t f_thread_attribute_detach_get(const f_thread_attribute_t attribute, int * const state) {
- #ifndef _di_level_0_parameter_checking_
- if (!state) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_detach_
+ f_status_t f_thread_detach(const f_thread_id_t id) {
- const int error = pthread_attr_getdetachstate(&attribute, state);
+ const int error = pthread_detach(id);
if (error) {
if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_detach_get_
+#endif // _di_f_thread_detach_
-#ifndef _di_f_thread_attribute_detach_set_
- f_status_t f_thread_attribute_detach_set(const int state, f_thread_attribute_t * const attribute) {
+#ifndef _di_f_thread_exit_
+ f_status_t f_thread_exit(int * const result) {
#ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
+ if (!result) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- const int error = pthread_attr_setdetachstate(attribute, state);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
+ pthread_exit(result);
return F_okay;
}
-#endif // _di_f_thread_attribute_detach_set_
+#endif // _di_f_thread_exit_
-#ifndef _di_f_thread_attribute_guard_get_
- f_status_t f_thread_attribute_guard_get(const f_thread_attribute_t attribute, size_t * const guard) {
- #ifndef _di_level_0_parameter_checking_
- if (!guard) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_join_
+ f_status_t f_thread_join(const f_thread_id_t id, void ** const result) {
- const int error = pthread_attr_getguardsize(&attribute, guard);
+ const int error = pthread_join(id, result);
if (error) {
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_support_not);
+ if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_guard_get_
+#endif // _di_f_thread_join_
-#ifndef _di_f_thread_attribute_guard_set_
- f_status_t f_thread_attribute_guard_set(const size_t guard, f_thread_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_join_try_
+ f_status_t f_thread_join_try(const f_thread_id_t id, void ** const result) {
- const int error = pthread_attr_setguardsize(attribute, guard);
+ const int error = pthread_tryjoin_np(id, result);
if (error) {
+ if (error == EBUSY) return F_busy;
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_support_not);
+ if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_guard_set_
+#endif // _di_f_thread_join_try_
-#ifndef _di_f_thread_attribute_scheduler_inherit_get_
- f_status_t f_thread_attribute_scheduler_inherit_get(const f_thread_attribute_t attribute, int * const inherit) {
- #ifndef _di_level_0_parameter_checking_
- if (!inherit) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_join_timed_
+ f_status_t f_thread_join_timed(const f_thread_id_t id, const f_time_spec_t wait, void ** const result) {
- const int error = pthread_attr_getinheritsched(&attribute, inherit);
+ const int error = pthread_timedjoin_np(id, result, &wait);
if (error) {
+ if (error == EBUSY) return F_busy;
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_support_not);
+ if (error == ESRCH) return F_status_set_error(F_found_not);
+ if (error == ETIMEDOUT) return F_time;
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_scheduler_inherit_get_
+#endif // _di_f_thread_join_timed_
-#ifndef _di_f_thread_attribute_scheduler_inherit_set_
- f_status_t f_thread_attribute_scheduler_inherit_set(const int inherit, f_thread_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#if defined(_pthread_setname_np_unsupported_) && !defined(_di_f_thread_name_set_)
+ f_status_t f_thread_name_set(const f_thread_id_t id, const f_string_static_t name) {
+ return F_status_set_error(F_implement_not);
+ }
+#elif !defined(_di_f_thread_name_set_)
+ f_status_t f_thread_name_set(const f_thread_id_t id, const f_string_static_t name) {
+
+ if (!name.used || !name.string) return F_data_not;
- const int error = pthread_attr_setinheritsched(attribute, inherit);
+ const int error = pthread_setname_np(id, name.string);
if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ERANGE) return F_status_set_error(F_buffer_overflow);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_scheduler_inherit_set_
+#endif // defined(_pthread_getname_np_unsupported_) && !defined(_di_f_thread_name_get_)
-#ifndef _di_f_thread_attribute_scheduler_parameter_get_
- f_status_t f_thread_attribute_scheduler_parameter_get(const f_thread_attribute_t attribute, struct sched_param * const parameter) {
+#if defined(_pthread_getname_np_unsupported_) && !defined(_di_f_thread_name_get_)
+ f_status_t f_thread_name_get(const f_thread_id_t id, f_string_static_t * const name) {
#ifndef _di_level_0_parameter_checking_
- if (!parameter) return F_status_set_error(F_parameter);
+ if (!name) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- const int error = pthread_attr_getschedparam(&attribute, parameter);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
+ return F_status_set_error(F_implement_not);
}
-#endif // _di_f_thread_attribute_scheduler_parameter_get_
-
-#ifndef _di_f_thread_attribute_scheduler_parameter_set_
- f_status_t f_thread_attribute_scheduler_parameter_set(const struct sched_param parameter, f_thread_attribute_t * const attribute) {
+#elif !defined(_di_f_thread_name_get_)
+ f_status_t f_thread_name_get(const f_thread_id_t id, f_string_static_t * const name) {
#ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
+ if (!name) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- const int error = pthread_attr_setschedparam(attribute, ¶meter);
+ if (name->size) {
+ if (name->used > name->size) return F_status_set_error(F_parameter);
+ if (name->used == name->size) return F_status_set_error(F_buffer_underflow);
+ }
+ else if (!name->used) return F_status_set_error(F_buffer_underflow);
+
+ const int error = name->size
+ ? pthread_getname_np(id, name->string + name->used, name->size - name->used)
+ : pthread_getname_np(id, name->string, name->used);
if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ERANGE) return F_status_set_error(F_buffer_overflow);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_scheduler_parameter_set_
+#endif // _di_f_thread_name_get_
-#ifndef _di_f_thread_attribute_scheduler_policy_get_
- f_status_t f_thread_attribute_scheduler_policy_get(const f_thread_attribute_t attribute, int * const policy) {
+#ifndef _di_f_thread_scheduler_parameter_get_
+ f_status_t f_thread_scheduler_parameter_get(const f_thread_id_t id, int * const policy, struct sched_param * const parameter) {
#ifndef _di_level_0_parameter_checking_
if (!policy) return F_status_set_error(F_parameter);
+ if (!parameter) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- const int error = pthread_attr_getschedpolicy(&attribute, policy);
+ const int error = pthread_getschedparam(id, policy, parameter);
if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOTSUP) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_scheduler_policy_get_
+#endif // _di_f_thread_scheduler_parameter_get_
-#ifndef _di_f_thread_attribute_scheduler_policy_set_
- f_status_t f_thread_attribute_scheduler_policy_set(const int policy, f_thread_attribute_t * const attribute) {
+#ifndef _di_f_thread_scheduler_parameter_set_
+ f_status_t f_thread_scheduler_parameter_set(const f_thread_id_t id, const int policy, const struct sched_param * const parameter) {
#ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
+ if (!parameter) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- const int error = pthread_attr_setschedpolicy(attribute, policy);
+ const int error = pthread_setschedparam(id, policy, parameter);
if (error) {
if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_scheduler_policy_set_
+#endif // _di_f_thread_scheduler_parameter_set_
-#ifndef _di_f_thread_attribute_scope_get_
- f_status_t f_thread_attribute_scope_get(const f_thread_attribute_t attribute, int * const scope) {
- #ifndef _di_level_0_parameter_checking_
- if (!scope) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_scheduler_priority_set_
+ f_status_t f_thread_scheduler_priority_set(const f_thread_id_t id, const int priority) {
- const int error = pthread_attr_getscope(&attribute, scope);
+ const int error = pthread_setschedprio(id, priority);
if (error) {
if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+ if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_scope_get_
+#endif // _di_f_thread_scheduler_priority_set_
-#ifndef _di_f_thread_attribute_scope_set_
- f_status_t f_thread_attribute_scope_set(const int scope, f_thread_attribute_t * const attribute) {
+#ifndef _di_f_thread_signal_mask_
+ f_status_t f_thread_signal_mask(const int how, const sigset_t *next, sigset_t * const current) {
#ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
+ if (!next && !current) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- const int error = pthread_attr_setscope(attribute, scope);
+ const int error = pthread_sigmask(how, next, current);
if (error) {
+ if (error == EFAULT) return F_status_set_error(F_buffer);
if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOTSUP) return F_status_set_error(F_support_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_scope_set_
-
-#ifndef _di_f_thread_attribute_stack_get_
- f_status_t f_thread_attribute_stack_get(const f_thread_attribute_t attribute, size_t * const stack_size, void ** const stack) {
- #ifndef _di_level_0_parameter_checking_
- if (!stack_size) return F_status_set_error(F_parameter);
- if (!stack) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_attr_getstack(&attribute, stack, stack_size);
-
- if (error) {
- if (error == EACCES) return F_status_set_error(F_access_denied);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+#endif // _di_f_thread_signal_mask_
- return F_status_set_error(F_failure);
- }
+#if defined(_pthread_sigqueue_unsupported_) && !defined(_di_f_thread_signal_queue_)
+ f_status_t f_thread_signal_queue(const f_thread_id_t id, const int signal, const union sigval value) {
- return F_okay;
+ return F_status_set_error(F_implement_not);
}
-#endif // _di_f_thread_attribute_stack_get_
-
-#ifndef _di_f_thread_attribute_stack_set_
- f_status_t f_thread_attribute_stack_set(const size_t stack_size, void * const stack, f_thread_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!stack) return F_status_set_error(F_parameter);
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#elif !defined(_di_f_thread_signal_queue_)
+ f_status_t f_thread_signal_queue(const f_thread_id_t id, const int signal, const union sigval value) {
- const int error = pthread_attr_setstack(attribute, stack, stack_size);
+ const int error = pthread_sigqueue(id, signal, value);
if (error) {
- if (error == EACCES) return F_status_set_error(F_access_denied);
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == ENOSYS) return F_status_set_error(F_support_not);
if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ESRCH) return F_status_set_error(F_found_not);
return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attribute_stack_set_
+#endif // defined(_pthread_sigqueue_unsupported_) && !defined(_di_f_thread_signal_queue_)
-#ifndef _di_f_thread_attribute_stack_size_get_
- f_status_t f_thread_attribute_stack_size_get(const f_thread_attribute_t attribute, size_t * const stack_size) {
- #ifndef _di_level_0_parameter_checking_
- if (!stack_size) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_thread_signal_write_
+ f_status_t f_thread_signal_write(const f_thread_id_t id, const int signal) {
- const int error = pthread_attr_getstacksize(&attribute, stack_size);
+ const int error = pthread_kill(id, signal);
if (error) {
if (error == EINVAL) return F_status_set_error(F_parameter);
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_attribute_stack_size_get_
-
-#ifndef _di_f_thread_attribute_stack_size_set_
- f_status_t f_thread_attribute_stack_size_set(const size_t stack_size, f_thread_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_attr_setstacksize(attribute, stack_size);
+ if (error == ESRCH) {
+ if (signal) return F_status_set_error(F_found_not);
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ return F_found_not;
+ }
return F_status_set_error(F_failure);
}
- return F_okay;
- }
-#endif // _di_f_thread_attribute_stack_size_set_
-
-#ifndef _di_f_thread_barrier_attribute_create_
- f_status_t f_thread_barrier_attribute_create(f_thread_barrier_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_barrierattr_init(attribute);
-
- if (error) {
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_attribute_create_
-
-#ifndef _di_f_thread_barrier_attribute_delete_
- f_status_t f_thread_barrier_attribute_delete(f_thread_barrier_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return pthread_barrierattr_destroy(attribute) ? F_status_set_error(F_failure) : F_okay;
- }
-#endif // _di_f_thread_barrier_attribute_delete_
-
-#ifndef _di_f_thread_barrier_attribute_shared_get_
- f_status_t f_thread_barrier_attribute_shared_get(const f_thread_barrier_attribute_t * const attribute, int * const shared) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!shared) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_barrierattr_getpshared(attribute, shared);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_attribute_shared_get_
-
-#ifndef _di_f_thread_barrier_attribute_shared_set_
- f_status_t f_thread_barrier_attribute_shared_set(const int shared, f_thread_barrier_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_barrierattr_setpshared(attribute, shared);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_attribute_shared_set_
-
-#ifndef _di_f_thread_barrier_create_
- f_status_t f_thread_barrier_create(const unsigned int count, f_thread_barrier_attribute_t * const attribute, f_thread_barrier_t * const barrier) {
- #ifndef _di_level_0_parameter_checking_
- if (!barrier) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_barrier_init(barrier, attribute, count);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_create_
-
-#ifndef _di_f_thread_barrier_delete_
- f_status_t f_thread_barrier_delete(f_thread_barrier_t * const barrier) {
- #ifndef _di_level_0_parameter_checking_
- if (!barrier) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_barrier_destroy(barrier);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_delete_
-
-#ifndef _di_f_thread_barrier_full_delete_
- f_status_t f_thread_barrier_full_delete(f_thread_barrier_full_t * const full) {
- #ifndef _di_level_0_parameter_checking_
- if (!full) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- {
- const int error = pthread_barrier_destroy(&full->barrier);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- }
-
- return pthread_barrierattr_destroy(&full->attribute) ? F_status_set_error(F_failure) : F_okay;
- }
-#endif // _di_f_thread_barrier_full_delete_
-
-#ifndef _di_f_thread_barrier_wait_
- f_status_t f_thread_barrier_wait(f_thread_barrier_t * const barrier, int * const result) {
- #ifndef _di_level_0_parameter_checking_
- if (!barrier) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (result) {
- *result = pthread_barrier_wait(barrier);
- }
- else {
- pthread_barrier_wait(barrier);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_wait_
-
-#ifndef _di_f_thread_caller_
- f_thread_id_t f_thread_caller(void) {
-
- return pthread_self();
- }
-#endif // _di_f_thread_caller_
-
-#ifndef _di_f_thread_cancel_
- f_status_t f_thread_cancel(const f_thread_id_t id) {
-
- const int error = pthread_cancel(id);
-
- if (error) {
- if (error == ESRCH) return F_status_set_error(F_found_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_cancel_
-
-#ifndef _di_f_thread_cancel_state_set_
- f_status_t f_thread_cancel_state_set(const int state, int * const previous) {
-
- int error = 0;
-
- // POSIX doesn't allow "previous" to be NULL, so make POSIX happy.
- if (!previous) {
- int ignore = 0;
-
- error = pthread_setcancelstate(state, &ignore);
- }
- else {
- error = pthread_setcancelstate(state, previous);
- }
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_cancel_state_set_
-
-#ifndef _di_f_thread_cancel_test_
- f_status_t f_thread_cancel_test(void) {
-
- pthread_testcancel();
-
- return F_okay;
- }
-#endif // _di_f_thread_cancel_test_
-
-#ifndef _di_f_thread_cancel_type_set_
- f_status_t f_thread_cancel_type_set(const int type, int * const previous) {
-
- const int error = pthread_setcanceltype(type, previous);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_cancel_type_set_
-
-#ifndef _di_f_thread_clock_get_id_
- f_status_t f_thread_clock_get_id(const f_thread_id_t id_thread, clockid_t * const id_clock) {
- #ifndef _di_level_0_parameter_checking_
- if (!id_clock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_getcpuclockid(id_thread, id_clock);
-
- if (error) {
- if (error == ENOENT) return F_status_set_error(F_support_not);
- if (error == ESRCH) return F_status_set_error(F_found_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_clock_get_id_
-
-#ifndef _di_f_thread_compare_
- f_status_t f_thread_compare(const f_thread_id_t id1, const f_thread_id_t id2) {
-
- if (pthread_equal(id1, id2)) {
- return F_equal_to;
- }
-
- return F_equal_to_not;
- }
-#endif // _di_f_thread_compare_
-
-#ifndef _di_f_thread_condition_attribute_clock_get_
- f_status_t f_thread_condition_attribute_clock_get(const f_thread_condition_attribute_t * const attribute, clockid_t * const id) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!id) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_condattr_getclock(attribute, id);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_attribute_clock_get_
-
-#ifndef _di_f_thread_condition_attribute_clock_set_
- f_status_t f_thread_condition_attribute_clock_set(const clockid_t id, f_thread_condition_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_condattr_setclock(attribute, id);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_attribute_clock_set_
-
-#ifndef _di_f_thread_condition_attribute_create_
- f_status_t f_thread_condition_attribute_create(f_thread_condition_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_condattr_init(attribute);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_attribute_create_
-
-#ifndef _di_f_thread_condition_attribute_delete_
- f_status_t f_thread_condition_attribute_delete(f_thread_condition_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return pthread_condattr_destroy(attribute) ? F_status_set_error(F_failure) : F_okay;
- }
-#endif // _di_f_thread_condition_attribute_delete_
-
-#ifndef _di_f_thread_condition_attribute_shared_get_
- f_status_t f_thread_condition_attribute_shared_get(const f_thread_condition_attribute_t * const attribute, int * const shared) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!shared) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_condattr_getpshared(attribute, shared);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_attribute_shared_get_
-
-#ifndef _di_f_thread_condition_attribute_shared_set_
- f_status_t f_thread_condition_attribute_shared_set(const int shared, f_thread_condition_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_condattr_setpshared(attribute, shared);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_attribute_shared_set_
-
-#ifndef _di_f_thread_condition_create_
- f_status_t f_thread_condition_create(const f_thread_condition_attribute_t * const attribute, f_thread_condition_t * const condition) {
- #ifndef _di_level_0_parameter_checking_
- if (!condition) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_cond_init(condition, attribute);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_create_
-
-#ifndef _di_f_thread_condition_delete_
- f_status_t f_thread_condition_delete(f_thread_condition_t * const condition) {
- #ifndef _di_level_0_parameter_checking_
- if (!condition) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_cond_destroy(condition);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_delete_
-
-#ifndef _di_f_thread_condition_full_delete_
- f_status_t f_thread_condition_full_delete(f_thread_condition_full_t * const full) {
- #ifndef _di_level_0_parameter_checking_
- if (!full) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- {
- const int error = pthread_cond_destroy(&full->condition);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- }
-
- return pthread_condattr_destroy(&full->attribute) ? F_status_set_error(F_failure) : F_okay;
- }
-#endif // _di_f_thread_condition_full_delete_
-
-#ifndef _di_f_thread_condition_signal_
- f_status_t f_thread_condition_signal(f_thread_condition_t * const condition) {
- #ifndef _di_level_0_parameter_checking_
- if (!condition) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_cond_signal(condition);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_signal_
-
-#ifndef _di_f_thread_condition_signal_all_
- f_status_t f_thread_condition_signal_all(f_thread_condition_t * const condition) {
- #ifndef _di_level_0_parameter_checking_
- if (!condition) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_cond_broadcast(condition);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_signal_all_
-
-#ifndef _di_f_thread_condition_wait_
- f_status_t f_thread_condition_wait(f_thread_condition_t * const condition, f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!condition) return F_status_set_error(F_parameter);
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_cond_wait(condition, mutex);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
- if (error == EOWNERDEAD) return F_status_set_error(F_dead);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_wait_
-
-#ifndef _di_f_thread_condition_wait_timed_
- f_status_t f_thread_condition_wait_timed(const f_time_spec_t * const wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!condition) return F_status_set_error(F_parameter);
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_cond_timedwait(condition, mutex, wait);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
- if (error == EOWNERDEAD) return F_status_set_error(F_dead);
- if (error == EPERM) return F_status_set_error(F_prohibited);
- if (error == ETIMEDOUT) return F_time;
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_wait_timed_
-
-#ifndef _di_f_thread_create_
- f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, const f_void_pointer_call_t routine, void * const argument) {
- #ifndef _di_level_0_parameter_checking_
- if (!id) return F_status_set_error(F_parameter);
- if (!routine) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_create(id, attribute, routine, argument);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_create_
-
-#ifndef _di_f_thread_detach_
- f_status_t f_thread_detach(const f_thread_id_t id) {
-
- const int error = pthread_detach(id);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ESRCH) return F_status_set_error(F_found_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_detach_
-
-#ifndef _di_f_thread_exit_
- f_status_t f_thread_exit(int * const result) {
- #ifndef _di_level_0_parameter_checking_
- if (!result) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- pthread_exit(result);
-
- return F_okay;
- }
-#endif // _di_f_thread_exit_
-
-#ifndef _di_f_thread_join_
- f_status_t f_thread_join(const f_thread_id_t id, void ** const result) {
-
- const int error = pthread_join(id, result);
-
- if (error) {
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_support_not);
- if (error == ESRCH) return F_status_set_error(F_found_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_join_
-
-#ifndef _di_f_thread_join_try_
- f_status_t f_thread_join_try(const f_thread_id_t id, void ** const result) {
-
- const int error = pthread_tryjoin_np(id, result);
-
- if (error) {
- if (error == EBUSY) return F_busy;
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_support_not);
- if (error == ESRCH) return F_status_set_error(F_found_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_join_try_
-
-#ifndef _di_f_thread_join_timed_
- f_status_t f_thread_join_timed(const f_thread_id_t id, const f_time_spec_t wait, void ** const result) {
-
- const int error = pthread_timedjoin_np(id, result, &wait);
-
- if (error) {
- if (error == EBUSY) return F_busy;
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_support_not);
- if (error == ESRCH) return F_status_set_error(F_found_not);
- if (error == ETIMEDOUT) return F_time;
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_join_timed_
-
-#ifndef _di_f_thread_key_create_
- f_status_t f_thread_key_create(void (*routine) (void *), f_thread_key_t * const key) {
- #ifndef _di_level_0_parameter_checking_
- if (!routine) return F_status_set_error(F_parameter);
- if (!key) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_key_create(key, routine);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_key_create_
-
-#ifndef _di_f_thread_key_delete_
- f_status_t f_thread_key_delete(f_thread_key_t * const key) {
- #ifndef _di_level_0_parameter_checking_
- if (!key) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (pthread_key_delete(*key)) return F_status_set_error(F_failure);
-
- *key = 0;
-
- return F_okay;
- }
-#endif // _di_f_thread_key_delete_
-
-#ifndef _di_f_thread_key_get_
- f_status_t f_thread_key_get(const f_thread_key_t key, void ** const value) {
- #ifndef _di_level_0_parameter_checking_
- if (!value) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- *value = pthread_getspecific(key);
-
- return F_okay;
- }
-#endif // _di_f_thread_key_get_
-
-#ifndef _di_f_thread_key_set_
- f_status_t f_thread_key_set(const f_thread_key_t key, const void * const value) {
- #ifndef _di_level_0_parameter_checking_
- if (!value) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_setspecific(key, value);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_key_set_
-
-#ifndef _di_f_thread_lock_attribute_create_
- f_status_t f_thread_lock_attribute_create(f_thread_lock_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlockattr_init(attribute);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_attribute_create_
-
-#ifndef _di_f_thread_lock_attribute_delete_
- f_status_t f_thread_lock_attribute_delete(f_thread_lock_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return pthread_rwlockattr_destroy(attribute) ? F_status_set_error(F_failure) : F_okay;
- }
-#endif // _di_f_thread_lock_attribute_delete_
-
-#ifndef _di_f_thread_lock_attribute_shared_get_
- f_status_t f_thread_lock_attribute_shared_get(const f_thread_lock_attribute_t * const attribute, int * const shared) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!shared) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (pthread_rwlockattr_getpshared(attribute, shared)) {
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_attribute_shared_get_
-
-#ifndef _di_f_thread_lock_attribute_shared_set_
- f_status_t f_thread_lock_attribute_shared_set(const int shared, f_thread_lock_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlockattr_setpshared(attribute, shared);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_attribute_shared_set_
-
-#ifndef _di_f_thread_lock_create_
- f_status_t f_thread_lock_create(const f_thread_lock_attribute_t * const attribute, f_thread_lock_t * const lock) {
- #ifndef _di_level_0_parameter_checking_
- if (!lock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlock_init(lock, attribute);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_create_
-
-#ifndef _di_f_thread_lock_delete_
- f_status_t f_thread_lock_delete(f_thread_lock_t * const lock) {
- #ifndef _di_level_0_parameter_checking_
- if (!lock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- {
- const int error = pthread_rwlock_destroy(lock);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_delete_
-
-#ifndef _di_f_thread_lock_full_delete_
- f_status_t f_thread_lock_full_delete(f_thread_lock_full_t * const full) {
- #ifndef _di_level_0_parameter_checking_
- if (!full) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- {
- const int error = pthread_rwlock_destroy(&full->lock);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- }
-
- return pthread_rwlockattr_destroy(&full->attribute) ? F_status_set_error(F_failure) : F_okay;
- }
-#endif // _di_f_thread_lock_full_delete_
-
-#ifndef _di_f_thread_lock_read_
- f_status_t f_thread_lock_read(f_thread_lock_t * const lock) {
- #ifndef _di_level_0_parameter_checking_
- if (!lock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlock_rdlock(lock);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_read_
-
-#ifndef _di_f_thread_lock_read_timed_
- f_status_t f_thread_lock_read_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock) {
- #ifndef _di_level_0_parameter_checking_
- if (!timeout) return F_status_set_error(F_parameter);
- if (!lock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlock_timedrdlock(lock, timeout);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ETIMEDOUT) return F_time;
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_read_timed_
-
-#ifndef _di_f_thread_lock_read_try_
- f_status_t f_thread_lock_read_try(f_thread_lock_t * const lock) {
- #ifndef _di_level_0_parameter_checking_
- if (!lock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlock_tryrdlock(lock);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_busy;
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_read_try_
-
-#ifndef _di_f_thread_lock_write_
- f_status_t f_thread_lock_write(f_thread_lock_t * const lock) {
- #ifndef _di_level_0_parameter_checking_
- if (!lock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlock_wrlock(lock);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_write_
-
-#ifndef _di_f_thread_lock_write_timed_
- f_status_t f_thread_lock_write_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock) {
- #ifndef _di_level_0_parameter_checking_
- if (!timeout) return F_status_set_error(F_parameter);
- if (!lock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlock_timedwrlock(lock, timeout);
-
- if (error) {
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ETIMEDOUT) return F_time;
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_write_timed_
-
-#ifndef _di_f_thread_lock_write_try_
- f_status_t f_thread_lock_write_try(f_thread_lock_t * const lock) {
- #ifndef _di_level_0_parameter_checking_
- if (!lock) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_rwlock_trywrlock(lock);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_busy;
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_write_try_
-
-#ifndef _di_f_thread_mutex_attribute_create_
- f_status_t f_thread_mutex_attribute_create(f_thread_mutex_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_init(attribute);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_create_
-
-#ifndef _di_f_thread_mutex_attribute_delete_
- f_status_t f_thread_mutex_attribute_delete(f_thread_mutex_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return pthread_mutexattr_destroy(attribute) ? F_status_set_error(F_failure) : F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_delete_
-
-#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_)
- f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!ceiling) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return F_status_set_error(F_implement_not);
- }
-#elif !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_)
- f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!ceiling) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_getprioceiling(attribute, ceiling);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_)
-
-#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_)
- f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return F_status_set_error(F_implement_not);
- }
-#elif !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_)
- f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_setprioceiling(attribute, ceiling);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_)
-
-#ifndef _di_f_thread_mutex_attribute_protocol_get_
- f_status_t f_thread_mutex_attribute_protocol_get(const f_thread_mutex_attribute_t * const attribute, int * const protocol) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!protocol) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_getprotocol(attribute, protocol);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_protocol_get_
-
-#ifndef _di_f_thread_mutex_attribute_protocol_set_
- f_status_t f_thread_mutex_attribute_protocol_set(const int protocol, f_thread_mutex_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_setprotocol(attribute, protocol);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
- if (error == ENOTSUP) return F_status_set_error(F_support_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_protocol_set_
-
-#ifndef _di_f_thread_mutex_attribute_robust_get_
- f_status_t f_thread_mutex_attribute_robust_get(f_thread_mutex_attribute_t * const attribute, int * const robust) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!robust) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_getrobust(attribute, robust);
-
- if (error) {
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_robust_get_
-
-#ifndef _di_f_thread_mutex_attribute_robust_set_
- f_status_t f_thread_mutex_attribute_robust_set(const int robust, f_thread_mutex_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_setrobust(attribute, robust);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_robust_set_
-
-#ifndef _di_f_thread_mutex_attribute_shared_get_
- f_status_t f_thread_mutex_attribute_shared_get(const f_thread_mutex_attribute_t * const attribute, int * const shared) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!shared) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (pthread_mutexattr_getpshared(attribute, shared)) {
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_shared_get_
-
-#ifndef _di_f_thread_mutex_attribute_shared_set_
- f_status_t f_thread_mutex_attribute_shared_set(const int shared, f_thread_mutex_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_setpshared(attribute, shared);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_shared_set_
-
-#ifndef _di_f_thread_mutex_attribute_type_get_
- f_status_t f_thread_mutex_attribute_type_get(const f_thread_mutex_attribute_t * const attribute, int * const type) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- if (!type) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (pthread_mutexattr_gettype(attribute, type)) {
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_type_get_
-
-#ifndef _di_f_thread_mutex_attribute_type_set_
- f_status_t f_thread_mutex_attribute_type_set(const int type, f_thread_mutex_attribute_t * const attribute) {
- #ifndef _di_level_0_parameter_checking_
- if (!attribute) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutexattr_settype(attribute, type);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_attribute_type_set_
-
-#ifndef _di_f_thread_mutex_consistent_
- f_status_t f_thread_mutex_consistent(f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutex_consistent(mutex);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_robust_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_consistent_
-
-#ifndef _di_f_thread_mutex_create_
- f_status_t f_thread_mutex_create(f_thread_mutex_attribute_t * const attribute, f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutex_init(mutex, attribute);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_create_
-
-#ifndef _di_f_thread_mutex_delete_
- f_status_t f_thread_mutex_delete(f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- {
- const int error = pthread_mutex_destroy(mutex);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_delete_
-
-#ifndef _di_f_thread_mutex_full_delete_
- f_status_t f_thread_mutex_full_delete(f_thread_mutex_full_t * const full) {
- #ifndef _di_level_0_parameter_checking_
- if (!full) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- {
- const int error = pthread_mutex_destroy(&full->mutex);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- }
-
- return pthread_mutexattr_destroy(&full->attribute) ? F_status_set_error(F_failure) : F_okay;
- }
-#endif // _di_f_thread_mutex_full_delete_
-
-#ifndef _di_f_thread_mutex_lock_
- f_status_t f_thread_mutex_lock(f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutex_lock(mutex);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
- if (error == EOWNERDEAD) return F_status_set_error(F_dead);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_lock_
-
-#ifndef _di_f_thread_mutex_lock_timed_
- f_status_t f_thread_mutex_lock_timed(const f_time_spec_t * const timeout, f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!timeout) return F_status_set_error(F_parameter);
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutex_timedlock(mutex, timeout);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
- if (error == EOWNERDEAD) return F_status_set_error(F_dead);
- if (error == ETIMEDOUT) return F_time;
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_lock_timed_
-
-#ifndef _di_f_thread_mutex_lock_try_
- f_status_t f_thread_mutex_lock_try(f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutex_trylock(mutex);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_busy;
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
- if (error == EOWNERDEAD) return F_status_set_error(F_dead);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_lock_try_
-
-#if defined(_pthread_setname_np_unsupported_) && !defined(_di_f_thread_name_set_)
- f_status_t f_thread_name_set(const f_thread_id_t id, const f_string_static_t name) {
- return F_status_set_error(F_implement_not);
- }
-#elif !defined(_di_f_thread_name_set_)
- f_status_t f_thread_name_set(const f_thread_id_t id, const f_string_static_t name) {
-
- if (!name.used || !name.string) return F_data_not;
-
- const int error = pthread_setname_np(id, name.string);
-
- if (error) {
- if (error == ERANGE) return F_status_set_error(F_buffer_overflow);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // defined(_pthread_getname_np_unsupported_) && !defined(_di_f_thread_name_get_)
-
-#if defined(_pthread_getname_np_unsupported_) && !defined(_di_f_thread_name_get_)
- f_status_t f_thread_name_get(const f_thread_id_t id, f_string_static_t * const name) {
- #ifndef _di_level_0_parameter_checking_
- if (!name) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return F_status_set_error(F_implement_not);
- }
-#elif !defined(_di_f_thread_name_get_)
- f_status_t f_thread_name_get(const f_thread_id_t id, f_string_static_t * const name) {
- #ifndef _di_level_0_parameter_checking_
- if (!name) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (name->size) {
- if (name->used > name->size) return F_status_set_error(F_parameter);
- if (name->used == name->size) return F_status_set_error(F_buffer_underflow);
- }
- else if (!name->used) return F_status_set_error(F_buffer_underflow);
-
- const int error = name->size
- ? pthread_getname_np(id, name->string + name->used, name->size - name->used)
- : pthread_getname_np(id, name->string, name->used);
-
- if (error) {
- if (error == ERANGE) return F_status_set_error(F_buffer_overflow);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_name_get_
-
-#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_get_)
- f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t * const mutex, int * const ceiling) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- if (!ceiling) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return F_status_set_error(F_implement_not);
- }
-#elif !defined(_di_f_thread_mutex_priority_ceiling_get_)
- f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t * const mutex, int * const ceiling) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- if (!ceiling) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutex_getprioceiling(mutex, ceiling);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_get_)
-
-#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_set_)
- f_status_t f_thread_mutex_priority_ceiling_set(const int ceiling, f_thread_mutex_t * const mutex, int * const previous) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return F_status_set_error(F_implement_not);
- }
-#elif !defined(_di_f_thread_mutex_priority_ceiling_set_)
- f_status_t f_thread_mutex_priority_ceiling_set(const int ceiling, f_thread_mutex_t * const mutex, int * const previous) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutex_setprioceiling(mutex, ceiling, previous);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
- if (error == EOWNERDEAD) return F_status_set_error(F_dead);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_set_)
-
-#ifndef _di_f_thread_mutex_unlock_
- f_status_t f_thread_mutex_unlock(f_thread_mutex_t * const mutex) {
- #ifndef _di_level_0_parameter_checking_
- if (!mutex) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_mutex_unlock(mutex);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_unlock_
-
-#ifndef _di_f_thread_once_
- f_status_t f_thread_once(const f_void_call_t routine, f_thread_once_t * const once) {
- #ifndef _di_level_0_parameter_checking_
- if (!routine) return F_status_set_error(F_parameter);
- if (!once) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_once(once, routine);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_once_
-
-#ifndef _di_f_thread_scheduler_parameter_get_
- f_status_t f_thread_scheduler_parameter_get(const f_thread_id_t id, int * const policy, struct sched_param * const parameter) {
- #ifndef _di_level_0_parameter_checking_
- if (!policy) return F_status_set_error(F_parameter);
- if (!parameter) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_getschedparam(id, policy, parameter);
-
- if (error) {
- if (error == ENOTSUP) return F_status_set_error(F_support_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_scheduler_parameter_get_
-
-#ifndef _di_f_thread_scheduler_parameter_set_
- f_status_t f_thread_scheduler_parameter_set(const f_thread_id_t id, const int policy, const struct sched_param * const parameter) {
- #ifndef _di_level_0_parameter_checking_
- if (!parameter) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_setschedparam(id, policy, parameter);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_scheduler_parameter_set_
-
-#ifndef _di_f_thread_scheduler_priority_set_
- f_status_t f_thread_scheduler_priority_set(const f_thread_id_t id, const int priority) {
-
- const int error = pthread_setschedprio(id, priority);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
- if (error == ESRCH) return F_status_set_error(F_found_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_scheduler_priority_set_
-
-#ifndef _di_f_thread_semaphore_create_
- f_status_t f_thread_semaphore_create(const bool shared, const unsigned int value, f_thread_semaphore_t * const semaphore) {
- #ifndef _di_level_0_parameter_checking_
- if (!semaphore) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (sem_init(semaphore, shared, value) == -1) {
- if (errno == EINVAL) return F_status_set_error(F_parameter);
- if (errno == ENOSYS) return F_status_set_error(F_support_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_create_
-
-#ifndef _di_f_thread_semaphore_delete_
- f_status_t f_thread_semaphore_delete(f_thread_semaphore_t * const semaphore) {
- #ifndef _di_level_0_parameter_checking_
- if (!semaphore) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (sem_destroy(semaphore) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_delete_
-
-#ifndef _di_f_thread_semaphore_file_close_
- f_status_t f_thread_semaphore_file_close(f_thread_semaphore_t * const semaphore) {
- #ifndef _di_level_0_parameter_checking_
- if (!semaphore) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (sem_close(semaphore) == -1) {
- if (errno == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_file_close_
-
-#ifndef _di_f_thread_semaphore_file_delete_
- f_status_t f_thread_semaphore_file_delete(const f_string_static_t name) {
-
- if (sem_unlink(name.string) == -1) {
- if (errno == EACCES) return F_status_set_error(F_access_denied);
- if (errno == EINVAL) return F_status_set_error(F_parameter);
- if (errno == ENAMETOOLONG) return F_status_set_error(F_name_not);
- if (errno == ENOENT) return F_file_found_not;
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_file_delete_
-
-#ifndef _di_f_thread_semaphore_file_open_
- f_status_t f_thread_semaphore_file_open(const f_string_static_t name, const int flag, mode_t * const mode, unsigned int value, f_thread_semaphore_t ** const semaphore) {
- #ifndef _di_level_0_parameter_checking_
- if (!semaphore) return F_status_set_error(F_parameter);
- if ((flag & O_CREAT) && !mode) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if ((flag & O_CREAT) || mode) {
- *semaphore = sem_open(name.string, flag, mode, value);
- }
- else {
- *semaphore = sem_open(name.string, flag);
- }
-
- if (*semaphore == SEM_FAILED) {
- if (errno == EACCES) return F_status_set_error(F_access_denied);
- if (errno == EEXIST) return F_status_set_error(F_file_found);
- if (errno == EINVAL) return F_status_set_error(F_parameter);
- if (errno == EMFILE) return F_status_set_error(F_file_descriptor_max);
- if (errno == ENAMETOOLONG) return F_status_set_error(F_name_not);
- if (errno == ENFILE) return F_status_set_error(F_file_open_max);
- if (errno == ENOENT) return F_status_set_error(F_file_found_not);
- if (errno == ENOMEM) return F_status_set_error(F_memory_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_file_open_
-
-#ifndef _di_f_thread_semaphore_lock_
- f_status_t f_thread_semaphore_lock(f_thread_semaphore_t * const semaphore) {
- #ifndef _di_level_0_parameter_checking_
- if (!semaphore) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (sem_wait(semaphore) == -1) {
- if (errno == EINTR) return F_status_set_error(F_interrupt);
- if (errno == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_lock_
-
-#ifndef _di_f_thread_semaphore_lock_timed_
- f_status_t f_thread_semaphore_lock_timed(const f_time_spec_t * const timeout, f_thread_semaphore_t * const semaphore) {
- #ifndef _di_level_0_parameter_checking_
- if (!timeout) return F_status_set_error(F_parameter);
- if (!semaphore) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (sem_timedwait(semaphore, timeout) == -1) {
- if (errno == EINTR) return F_status_set_error(F_interrupt);
- if (errno == EINVAL) return F_status_set_error(F_parameter);
- if (errno == ETIMEDOUT) return F_time;
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_lock_timed_
-
-#ifndef _di_f_thread_semaphore_lock_try_
- f_status_t f_thread_semaphore_lock_try(f_thread_semaphore_t * const semaphore) {
- #ifndef _di_level_0_parameter_checking_
- if (!semaphore) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (sem_trywait(semaphore) == -1) {
- if (errno == EAGAIN) return F_status_set_error(F_resource_not);
- if (errno == EINTR) return F_status_set_error(F_interrupt);
- if (errno == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_lock_try_
-
-#ifndef _di_f_thread_semaphore_unlock_
- f_status_t f_thread_semaphore_unlock(f_thread_semaphore_t * const semaphore) {
- #ifndef _di_level_0_parameter_checking_
- if (!semaphore) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (sem_post(semaphore) == -1) {
- if (errno == EOVERFLOW) return F_status_set_error(F_number_overflow);
- if (errno == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_unlock_
-
-#ifndef _di_f_thread_semaphore_value_get_
- f_status_t f_thread_semaphore_value_get(f_thread_semaphore_t * const semaphore, int * const value) {
- #ifndef _di_level_0_parameter_checking_
- if (!semaphore) return F_status_set_error(F_parameter);
- if (!value) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (sem_getvalue(semaphore, value) == -1) {
- if (errno == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_semaphore_value_get_
-
-#ifndef _di_f_thread_signal_mask_
- f_status_t f_thread_signal_mask(const int how, const sigset_t *next, sigset_t * const current) {
- #ifndef _di_level_0_parameter_checking_
- if (!next && !current) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_sigmask(how, next, current);
-
- if (error) {
- if (error == EFAULT) return F_status_set_error(F_buffer);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_signal_mask_
-
-#if defined(_pthread_sigqueue_unsupported_) && !defined(_di_f_thread_signal_queue_)
- f_status_t f_thread_signal_queue(const f_thread_id_t id, const int signal, const union sigval value) {
-
- return F_status_set_error(F_implement_not);
- }
-#elif !defined(_di_f_thread_signal_queue_)
- f_status_t f_thread_signal_queue(const f_thread_id_t id, const int signal, const union sigval value) {
-
- const int error = pthread_sigqueue(id, signal, value);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == ENOSYS) return F_status_set_error(F_support_not);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == ESRCH) return F_status_set_error(F_found_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // defined(_pthread_sigqueue_unsupported_) && !defined(_di_f_thread_signal_queue_)
-
-#ifndef _di_f_thread_signal_write_
- f_status_t f_thread_signal_write(const f_thread_id_t id, const int signal) {
-
- const int error = pthread_kill(id, signal);
-
- if (error) {
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- if (error == ESRCH) {
- if (signal) return F_status_set_error(F_found_not);
-
- return F_found_not;
- }
-
- return F_status_set_error(F_failure);
- }
-
- if (signal) {
- return F_okay;
- }
+ if (signal) {
+ return F_okay;
+ }
return F_found;
}
#endif // _di_f_thread_signal_write_
-#ifndef _di_f_thread_spin_create_
- f_status_t f_thread_spin_create(const int shared, f_thread_spin_t * const spin) {
- #ifndef _di_level_0_parameter_checking_
- if (!spin) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_spin_init(spin, shared);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == ENOMEM) return F_status_set_error(F_memory_not);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_spin_create_
-
-#ifndef _di_f_thread_spin_delete_
- f_status_t f_thread_spin_delete(f_thread_spin_t * const spin) {
- #ifndef _di_level_0_parameter_checking_
- if (!spin) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_spin_destroy(spin);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_spin_delete_
-
-#ifndef _di_f_thread_spin_lock_
- f_status_t f_thread_spin_lock(f_thread_spin_t * const spin) {
- #ifndef _di_level_0_parameter_checking_
- if (!spin) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_spin_lock(spin);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EDEADLK) return F_status_set_error(F_deadlock);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_spin_lock_
-
-#ifndef _di_f_thread_spin_lock_try_
- f_status_t f_thread_spin_lock_try(f_thread_spin_t * const spin) {
- #ifndef _di_level_0_parameter_checking_
- if (!spin) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_spin_trylock(spin);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_busy;
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_spin_lock_try_
-
-#ifndef _di_f_thread_spin_unlock_
- f_status_t f_thread_spin_unlock(f_thread_spin_t * const spin) {
- #ifndef _di_level_0_parameter_checking_
- if (!spin) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- const int error = pthread_spin_unlock(spin);
-
- if (error) {
- if (error == EAGAIN) return F_status_set_error(F_resource_not);
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error == EPERM) return F_status_set_error(F_prohibited);
-
- return F_status_set_error(F_failure);
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_spin_unlock_
-
#ifndef _di_f_thread_unlock_
f_status_t f_thread_unlock(f_thread_lock_t * const lock) {
#ifndef _di_level_0_parameter_checking_
#include <fcntl.h>
#include <semaphore.h>
#include <signal.h>
+#include <stddef.h>
#include <sys/types.h>
#include <time.h>
#include <pthread.h>
// FLL-0 thread includes.
#include <fll/level_0/thread/attribute.h>
-#include <fll/level_0/thread/barrier.h>
+#include <fll/level_0/thread/attributes.h>
+#include <fll/level_0/thread/attributess.h>
#include <fll/level_0/thread/barrier_attribute.h>
-#include <fll/level_0/thread/barrier_full.h>
-#include <fll/level_0/thread/condition.h>
+#include <fll/level_0/thread/barrier_attributes.h>
+#include <fll/level_0/thread/barrier_attributess.h>
+#include <fll/level_0/thread/barrier.h>
+#include <fll/level_0/thread/barriers.h>
+#include <fll/level_0/thread/barrierss.h>
#include <fll/level_0/thread/condition_attribute.h>
-#include <fll/level_0/thread/condition_full.h>
+#include <fll/level_0/thread/condition_attributes.h>
+#include <fll/level_0/thread/condition_attributess.h>
#include <fll/level_0/thread/id.h>
+#include <fll/level_0/thread/ids.h>
+#include <fll/level_0/thread/idss.h>
#include <fll/level_0/thread/key.h>
-#include <fll/level_0/thread/lock.h>
+#include <fll/level_0/thread/keys.h>
+#include <fll/level_0/thread/keyss.h>
#include <fll/level_0/thread/lock_attribute.h>
-#include <fll/level_0/thread/lock_full.h>
-#include <fll/level_0/thread/mutex.h>
+#include <fll/level_0/thread/lock_attributes.h>
+#include <fll/level_0/thread/lock_attributess.h>
+#include <fll/level_0/thread/lock.h>
+#include <fll/level_0/thread/locks.h>
+#include <fll/level_0/thread/lockss.h>
#include <fll/level_0/thread/mutex_attribute.h>
-#include <fll/level_0/thread/mutex_full.h>
+#include <fll/level_0/thread/mutex_attributes.h>
+#include <fll/level_0/thread/mutex_attributess.h>
+#include <fll/level_0/thread/mutex.h>
+#include <fll/level_0/thread/mutexs.h>
+#include <fll/level_0/thread/mutexss.h>
#include <fll/level_0/thread/once.h>
+#include <fll/level_0/thread/onces.h>
+#include <fll/level_0/thread/oncess.h>
#include <fll/level_0/thread/semaphore.h>
+#include <fll/level_0/thread/semaphores.h>
+#include <fll/level_0/thread/semaphoress.h>
#include <fll/level_0/thread/set.h>
+#include <fll/level_0/thread/sets.h>
+#include <fll/level_0/thread/setss.h>
#include <fll/level_0/thread/spin.h>
+#include <fll/level_0/thread/spins.h>
+#include <fll/level_0/thread/spinss.h>
+
+// Must be after mutex.h.
+#include <fll/level_0/thread/condition.h>
+#include <fll/level_0/thread/conditions.h>
+#include <fll/level_0/thread/conditionss.h>
+
+// These must be after several of the above.
+#include <fll/level_0/thread/barrier_full.h>
+#include <fll/level_0/thread/barrier_fulls.h>
+#include <fll/level_0/thread/barrier_fullss.h>
+#include <fll/level_0/thread/condition_full.h>
+#include <fll/level_0/thread/condition_fulls.h>
+#include <fll/level_0/thread/condition_fullss.h>
+#include <fll/level_0/thread/lock_full.h>
+#include <fll/level_0/thread/lock_fulls.h>
+#include <fll/level_0/thread/lock_fullss.h>
+#include <fll/level_0/thread/mutex_full.h>
+#include <fll/level_0/thread/mutex_fulls.h>
+#include <fll/level_0/thread/mutex_fullss.h>
#ifdef __cplusplus
extern "C" {
#endif // _di_f_thread_at_fork_
/**
- * Get the affinity state of the thread attribute.
- *
- * @param attribute
- * The thread attributes to process.
- * @param affinity_size
- * The size of the affinity_set.
- * @param affinity_set
- * The assigned affinity information.
- *
- * Must not be NULL.
+ * Get the ID of the calling thread.
*
* @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
+ * ID of the calling thread
*
- * @see pthread_attr_getaffinity_np()
+ * @see pthread_self()
*/
-#ifndef _di_f_thread_attribute_affinity_get_
- extern f_status_t f_thread_attribute_affinity_get(const f_thread_attribute_t attribute, const size_t affinity_size, cpu_set_t * const affinity_set);
-#endif // _di_f_thread_attribute_affinity_get_
+#ifndef _di_f_thread_caller_
+ extern f_thread_id_t f_thread_caller(void);
+#endif // _di_f_thread_caller_
/**
- * Set the affinity state of the thread attribute.
- *
- * @param affinity_size
- * The size of the affinity_set.
- * @param affinity_set
- * The affinity information to assign.
- * @param attribute
- * The thread attributes to update.
+ * Cancel a thread.
*
- * Must not be NULL.
+ * @param id
+ * The thread to cancel.
*
* @return
* F_okay on success.
*
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
+ * F_found_not (with error bit) if no thread by the given ID was found.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_attr_setaffinity_np()
+ * @see pthread_cancel()
*/
-#ifndef _di_f_thread_attribute_affinity_set_
- extern f_status_t f_thread_attribute_affinity_set(const size_t affinity_size, const cpu_set_t *affinity_set, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_affinity_set_
+#ifndef _di_f_thread_cancel_
+ extern f_status_t f_thread_cancel(const f_thread_id_t id);
+#endif // _di_f_thread_cancel_
/**
- * Get the level of concurrency.
- *
- * A level of 0 designates the system to automatically choose concurrency level.
- * Any non-zero level is considered a hint and will be followed at the systems discretion.
+ * Assign a cancellation state.
*
- * @param level
- * The concurrency level.
+ * @param state
+ * The cancellation state to assign.
+ * @param previous
+ * (optional) The previously assigned cancellation state.
*
- * Must not be NULL.
+ * Set to NULL to not use.
*
* @return
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if the new level would cause the system to exceed available resources.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_getconcurrency()
+ * @see pthread_setcancelstate()
*/
-#ifndef _di_f_thread_attribute_concurrency_get_
- extern f_status_t f_thread_attribute_concurrency_get(int * const level);
-#endif // _di_f_thread_attribute_concurrency_get_
+#ifndef _di_f_thread_cancel_state_set_
+ extern f_status_t f_thread_cancel_state_set(const int state, int * const previous);
+#endif // _di_f_thread_cancel_state_set_
/**
- * Set the level of concurrency.
- *
- * A level of 0 designates the system to automatically choose concurrency level.
- * Any non-zero level is considered a hint and will be followed at the systems discretion.
+ * Force any pending thread cancellation to be processed.
*
- * @param level
- * The concurrency level.
+ * If there is no pending thread cancel, nothing happens.
+ * If there is a pending thread cancel, the thread cancels and this function never returns.
*
* @return
* F_okay on success.
*
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_setconcurrency()
+ * @see pthread_testcancel()
*/
-#ifndef _di_f_thread_attribute_concurrency_set_
- extern f_status_t f_thread_attribute_concurrency_set(const int level);
-#endif // _di_f_thread_attribute_concurrency_set_
+#ifndef _di_f_thread_cancel_test_
+ extern f_status_t f_thread_cancel_test(void);
+#endif // _di_f_thread_cancel_test_
/**
- * Create (initialize) a thread attribute structure.
+ * Assign a cancellation type.
*
- * @param attribute
- * The attribute to set.
+ * @param type
+ * The cancellation type to assign.
+ * @param previous
+ * (optional) The previously assigned cancellation type.
*
- * Must not be NULL.
+ * Set to NULL to not use.
+ * (Note: Linux allows this to be optional/NULL but POSIX does not explicitly defined this and there may be portability issues.)
*
* @return
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
- * F_memory_not (with error bit) if out of memory.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_attr_init()
+ * @see pthread_setcanceltype()
*/
-#ifndef _di_f_thread_attribute_create_
- extern f_status_t f_thread_attribute_create(f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_create_
+#ifndef _di_f_thread_cancel_type_set_
+ extern f_status_t f_thread_cancel_type_set(const int type, int * const previous);
+#endif // _di_f_thread_cancel_type_set_
/**
- * Get the default thread attribute.
+ * Get the clock ID for the given thread.
*
- * @param attribute
- * The thread attributes to process.
+ * @param id_thread
+ * The ID of the thread to use.
+ * @param id_clock
+ * The retrieved clock ID.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_parameter (with error bit) if a parameter is invalid.
+ * F_found_not (with error bit) if no thread by the given ID was found.
+ * F_support_not (with error bit) if per-CPU clocks are not supported by the OS.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_getattr_default_np()
+ * @see pthread_getcpuclockid()
*/
-#ifndef _di_f_thread_attribute_default_get_
- extern f_status_t f_thread_attribute_default_get(f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_default_get_
+#ifndef _di_f_thread_clock_get_id_
+ extern f_status_t f_thread_clock_get_id(const f_thread_id_t id_thread, clockid_t * const id_clock);
+#endif // _di_f_thread_clock_get_id_
/**
- * Set the default thread attribute.
- *
- * @param attribute
- * The thread attributes to update.
+ * Compare two different thread IDs.
*
- * Must not be NULL.
+ * POSIX designates that the thread id (pthread_t) to be loosely defined and can be anything from an integer to a structure.
+ * For portability purposes, calling pthread_equal() is the only safe way to compare two thread ids.
*
* @return
- * F_okay on success.
- *
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
+ * F_equal_to if the two thread IDs are the same.
+ * F_equal_to_not if the two thread IDs are different.
*
- * @see pthread_setattr_default_np()
+ * @see pthread_equal()
*/
-#ifndef _di_f_thread_attribute_default_set_
- extern f_status_t f_thread_attribute_default_set(f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_default_set_
+#ifndef _di_f_thread_compare_
+ extern f_status_t f_thread_compare(const f_thread_id_t id1, const f_thread_id_t id2);
+#endif // _di_f_thread_compare_
/**
- * Delete a thread attribute structure.
- *
- * On successfully delete, the pointer address is set to 0.
- *
- * The pthread_attr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
+ * Create a thread.
*
* @param attribute
- * The thread attributes to delete.
+ * (optional) The thread attributes.
+ * Set to NULL to use default attributes.
+ * @param id
+ * The thread ID.
+ * This gets populated with the created thread ID (aka: the "child" thread).
*
* Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_destroy()
- */
-#ifndef _di_f_thread_attribute_delete_
- extern f_status_t f_thread_attribute_delete(f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_delete_
-
-/**
- * Get the detached state of the thread attribute.
- *
- * @param attribute
- * The thread attributes to process.
- * @param state
- * The currently assigned state.
+ * @param routine
+ * The function to execute.
*
* Must not be NULL.
+ * @param argument
+ * (optional) The structure containing all arguments to pass to the routine.
+ * Set to NULL to not pass an argument.
*
* @return
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to set the scheduling policy and parameters specified in attribute.
+ * F_resource_not (with error bit) if there are not enough resources to create another thread.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_attr_getdetachstate()
+ * @see pthread_create()
*/
-#ifndef _di_f_thread_attribute_detach_get_
- extern f_status_t f_thread_attribute_detach_get(const f_thread_attribute_t attribute, int * const state);
-#endif // _di_f_thread_attribute_detach_get_
+#ifndef _di_f_thread_create_
+ extern f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, const f_void_pointer_call_t routine, void * const argument);
+#endif // _di_f_thread_create_
/**
- * Set the detached state of the thread attribute.
- *
- * @param state
- * The state to assign (such as PTHREAD_CREATE_DETACHED or PTHREAD_CREATE_JOINABLE).
- * @param attribute
- * The thread attributes to update.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
+ * Detatch the given thread.
*
- * F_failure (with error bit) on any other error.
+ * When a detached thread exits, the resources will automatically be returned to the system without needing another thread to join with it.
*
- * @see pthread_attr_setdetachstate()
- */
-#ifndef _di_f_thread_attribute_detach_set_
- extern f_status_t f_thread_attribute_detach_set(const int state, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_detach_set_
-
-/**
- * Get the guard size of the thread attribute.
+ * Only joinable, undetached, threads are detachable.
*
- * @param attribute
- * The thread attributes to process.
- * @param guard
- * The currently assigned guard size.
+ * Once a thread is detached, it can no longer be joined.
*
- * Must not be NULL.
+ * @param id
+ * The ID of the thread to detach.
*
* @return
* F_okay on success.
*
+ * F_found_not (with error bit) if no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_attr_getguardsize()
+ * @see pthread_detach()
*/
-#ifndef _di_f_thread_attribute_guard_get_
- extern f_status_t f_thread_attribute_guard_get(const f_thread_attribute_t attribute, size_t * const guard);
-#endif // _di_f_thread_attribute_guard_get_
+#ifndef _di_f_thread_detach_
+ extern f_status_t f_thread_detach(const f_thread_id_t id);
+#endif // _di_f_thread_detach_
/**
- * Set the guard size of the thread attribute.
+ * Have the current thread exit.
*
- * @param guard
- * The guard size to assign.
- * @param attribute
- * The thread attributes to update.
+ * @param result
+ * The code returned by the exited thread.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_setguardsize()
+ * @see pthread_exit()
*/
-#ifndef _di_f_thread_attribute_guard_set_
- extern f_status_t f_thread_attribute_guard_set(const size_t guard, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_guard_set_
+#ifndef _di_f_thread_exit_
+ extern f_status_t f_thread_exit(int * const result);
+#endif // _di_f_thread_exit_
/**
- * Get the scheduler inherit state of the thread attribute.
- *
- * @param attribute
- * The thread attributes to process.
- * @param inherit
- * The currently assigned scheduler inherit state.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
+ * Wait until the given thread exits and then join it to the current thread.
*
- * @see pthread_attr_getinheritsched()
- */
-#ifndef _di_f_thread_attribute_scheduler_inherit_get_
- extern f_status_t f_thread_attribute_scheduler_inherit_get(const f_thread_attribute_t attribute, int * const inherit);
-#endif // _di_f_thread_attribute_scheduler_inherit_get_
-
-/**
- * Set the scheduler inherit state of the thread attribute.
+ * This is a blocking operation.
*
- * @param inherit
- * The inherit state of the scheduler (such as PTHREAD_INHERIT_SCHED or PTHREAD_EXPLICIT_SCHED).
- * @param attribute
- * The thread attributes to update.
+ * @param id
+ * The ID of the thread to wait for.
+ * @param result
+ * (optional) The data returned by the terminated thread (usually the exit status).
+ * If the terminated thread is cancelled, then this holds PTHREAD_CANCELED.
*
- * Must not be NULL.
+ * Set to NULL to not use.
*
* @return
* F_okay on success.
*
+ * F_deadlock (with error bit) if operation would cause a deadlock.ead.
+ * F_found_not (with error bit) if no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_attr_setinheritsched()
+ * @see pthread_join()
*/
-#ifndef _di_f_thread_attribute_scheduler_inherit_set_
- extern f_status_t f_thread_attribute_scheduler_inherit_set(const int inherit, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_scheduler_inherit_set_
+#ifndef _di_f_thread_join_
+ extern f_status_t f_thread_join(const f_thread_id_t id, void ** const result);
+#endif // _di_f_thread_join_
/**
- * Get the scheduler parameter state of the thread attribute.
+ * Try to join the given thread to the current thread.
*
- * @param attribute
- * The thread attributes to process.
- * @param parameter
- * The currently assigned scheduler parameters.
+ * This is a non-blocking operation.
*
- * Must not be NULL.
+ * @param id
+ * The ID of the thread to wait for.
+ * @param result
+ * (optional) The data returned by the terminated thread (usually the exit status).
+ * If the terminated thread is cancelled, then this holds PTHREAD_CANCELED.
+ *
+ * Set to NULL to not use.
*
* @return
* F_okay on success.
+ * F_busy on success, but thread could not be joined because it has not yet exited.
*
+ * F_deadlock (with error bit) if operation would cause a deadlock.ead.
+ * F_found_not (with error bit) if no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_attr_getschedparam()
+ * @see pthread_tryjoin_np()
*/
-#ifndef _di_f_thread_attribute_scheduler_parameter_get_
- extern f_status_t f_thread_attribute_scheduler_parameter_get(const f_thread_attribute_t attribute, struct sched_param * const parameter);
-#endif // _di_f_thread_attribute_scheduler_parameter_get_
+#ifndef _di_f_thread_join_try_
+ extern f_status_t f_thread_join_try(const f_thread_id_t id, void ** const result);
+#endif // _di_f_thread_join_try_
/**
- * Set the scheduler parameter state of the thread attribute.
+ * Try to join the given thread to the current thread, blocking until the timeout expires.
*
- * @param parameter
- * The parameters of the scheduler.
- * @param attribute
- * The thread attributes to update.
+ * This is a semi-blocking operation.
+ * This blocks until timeout and then no longer block.
*
- * Must not be NULL.
+ * @param id
+ * The ID of the thread to wait for.
+ * @param wait
+ * The amount of time to wait for.
+ * The wait time is relative to the clock, so consider calling clock_gettime() or gettimeofday() and then adding the amount of wait time.
+ * @param result
+ * (optional) The data returned by the terminated thread (usually the exit status).
+ * If the terminated thread is cancelled, then this holds PTHREAD_CANCELED.
+ *
+ * Set to NULL to not use.
*
* @return
* F_okay on success.
+ * F_busy on success, but thread could not be joined because it has not yet exited.
+ * F_time on success, but thread could not be joined because it has not yet exited and the wait timeout was reached.
*
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_setschedparam()
- */
-#ifndef _di_f_thread_attribute_scheduler_parameter_set_
- extern f_status_t f_thread_attribute_scheduler_parameter_set(const struct sched_param parameter, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_scheduler_parameter_set_
-
-/**
- * Get the scheduler policy state of the thread attribute.
- *
- * @param attribute
- * The thread attributes to process.
- * @param policy
- * The currently assigned scheduler policy state.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_getschedpolicy()
- */
-#ifndef _di_f_thread_attribute_scheduler_policy_get_
- extern f_status_t f_thread_attribute_scheduler_policy_get(const f_thread_attribute_t attribute, int * const policy);
-#endif // _di_f_thread_attribute_scheduler_policy_get_
-
-/**
- * Set the scheduler policy state of the thread attribute.
- *
- * @param policy
- * The policy state of the scheduler (such as SCHED_FIFO, SCHED_RR, or SCHED_OTHER).
- * @param attribute
- * The thread attributes to update.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_setschedpolicy()
- */
-#ifndef _di_f_thread_attribute_scheduler_policy_set_
- extern f_status_t f_thread_attribute_scheduler_policy_set(const int policy, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_scheduler_policy_set_
-
-/**
- * Get the scheduler scope state of the thread attribute.
- *
- * @param attribute
- * The thread attributes to process.
- * @param scope
- * The currently assigned scheduler scope state.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_getscope()
- */
-#ifndef _di_f_thread_attribute_scope_get_
- extern f_status_t f_thread_attribute_scope_get(const f_thread_attribute_t attribute, int * const scope);
-#endif // _di_f_thread_attribute_scope_get_
-
-/**
- * Set the scheduler scope state of the thread attribute.
- *
- * @param scope
- * The scope state of the scheduler (such as PTHREAD_SCOPE_SYSTEM or PTHREAD_SCOPE_PROCESS).
- * @param attribute
- * The thread attributes to update.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_support_not (with error bit) if the scope is not supported by the current OS (such as Linux not supporting PTHREAD_SCOPE_PROCESS).
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_setscope()
- */
-#ifndef _di_f_thread_attribute_scope_set_
- extern f_status_t f_thread_attribute_scope_set(const int scope, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_scope_set_
-
-/**
- * Get the stack of the thread attribute.
- *
- * @param attribute
- * The thread attributes to process.
- * @param stack_size
- * The size of the stack.
- *
- * Must not be NULL.
- * @param stack
- * The assigned stack.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_access_denied (with error bit) if the caller cannot both read and write to the stack address.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_getstack()
- */
-#ifndef _di_f_thread_attribute_stack_get_
- extern f_status_t f_thread_attribute_stack_get(const f_thread_attribute_t attribute, size_t * const stack_size, void ** const stack);
-#endif // _di_f_thread_attribute_stack_get_
-
-/**
- * Set the stack of the thread attribute.
- *
- * @param stack_size
- * The size of the stack.
- * @param stack
- * The stack to assign.
- *
- * Must not be NULL.
- * @param attribute
- * The thread attributes to update
- * Must not be NULL..
- *
- * @return
- * F_okay on success.
- *
- * F_access_denied (with error bit) if the caller cannot both read and write to the stack address.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_setstack()
- */
-#ifndef _di_f_thread_attribute_stack_set_
- extern f_status_t f_thread_attribute_stack_set(const size_t stack_size, void * const stack, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_stack_set_
-
-/**
- * Get the stack size of the thread attribute.
- *
- * @param attribute
- * The thread attributes to process.
- * @param stack_size
- * The assigned size of the stack.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_getstacksize()
- */
-#ifndef _di_f_thread_attribute_stack_size_get_
- extern f_status_t f_thread_attribute_stack_size_get(const f_thread_attribute_t attribute, size_t * const stack_size);
-#endif // _di_f_thread_attribute_stack_size_get_
-
-/**
- * Set the stack size of the thread attribute.
- *
- * @param stack_size
- * The size of the stack.
- * @param attribute
- * The thread attributes to update.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_attr_setstacksize()
- */
-#ifndef _di_f_thread_attribute_stack_size_set_
- extern f_status_t f_thread_attribute_stack_size_set(const size_t stack_size, f_thread_attribute_t * const attribute);
-#endif // _di_f_thread_attribute_stack_size_set_
-
-/**
- * Create (initialize) a thread barrier attribute structure.
- *
- * @param attribute
- * The attribute to set.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_memory_not (with error bit) if out of memory.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_barrierattr_init()
- */
-#ifndef _di_f_thread_barrier_attribute_create_
- extern f_status_t f_thread_barrier_attribute_create(f_thread_barrier_attribute_t * const attribute);
-#endif // _di_f_thread_barrier_attribute_create_
-
-/**
- * Delete a thread barrier attribute structure.
- *
- * On successfully delete, the pointer address is set to 0.
- *
- * The pthread_barrierattr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param attribute
- * The thread barrier_attributes to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_barrierattr_destroy()
- */
-#ifndef _di_f_thread_barrier_attribute_delete_
- extern f_status_t f_thread_barrier_attribute_delete(f_thread_barrier_attribute_t * const attribute);
-#endif // _di_f_thread_barrier_attribute_delete_
-
-/**
- * Get the barrier process shared thread attribute.
- *
- * @param attribute
- * The barrier thread attribute.
- *
- * Must not be NULL.
- * @param shared
- * The process shared attribute value.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_barrierattr_getpshared()
- */
-#ifndef _di_f_thread_barrier_attribute_shared_get_
- extern f_status_t f_thread_barrier_attribute_shared_get(const f_thread_barrier_attribute_t * const attribute, int * const shared);
-#endif // _di_f_thread_barrier_attribute_shared_get_
-
-/**
- * Set the barrier process shared thread attribute.
- *
- * @param shared
- * The process shared attribute value.
- * @param attribute
- * The barrier thread attribute.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_barrierattr_setpshared()
- */
-#ifndef _di_f_thread_barrier_attribute_shared_set_
- extern f_status_t f_thread_barrier_attribute_shared_set(const int shared, f_thread_barrier_attribute_t * const attribute);
-#endif // _di_f_thread_barrier_attribute_shared_set_
-
-/**
- * Create (initialize) a thread barrier structure.
- *
- * @param count
- * The number of threads that must call the barrier wait function before any can successfully return.
- * @param attribute
- * (optional) The default attributes to initialize the barrier to.
- * Set to NULL to not use (in which case the default barrier attributes are used).
- * @param barrier
- * The barrier to set.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if barrier is already in use (a re-initialization attempt).
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if necessary resouces to perform create are unavailable.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_barrier_init()
- */
-#ifndef _di_f_thread_barrier_create_
- extern f_status_t f_thread_barrier_create(const unsigned int count, f_thread_barrier_attribute_t * const attribute, f_thread_barrier_t * const barrier);
-#endif // _di_f_thread_barrier_create_
-
-/**
- * Delete a thread barrier structure.
- *
- * On successfully delete, the pointer address is set to 0.
- *
- * The pthread_barrier_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param barrier
- * The thread barriers to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a barrier is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_barrier_destroy()
- */
-#ifndef _di_f_thread_barrier_delete_
- extern f_status_t f_thread_barrier_delete(f_thread_barrier_t * const barrier);
-#endif // _di_f_thread_barrier_delete_
-
-/**
- * Delete a thread barrier full structure.
- *
- * On successfully delete, the pointer address is set to 0.
- *
- * The pthread_barrier_destroy() and pthread_barrierattr_destroy() functions have no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param full
- * The thread barrier_fulls to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a barrier is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_barrier_destroy()
- * @see pthread_barrierattr_destroy()
- */
-#ifndef _di_f_thread_barrier_full_delete_
- extern f_status_t f_thread_barrier_full_delete(f_thread_barrier_full_t * const full);
-#endif // _di_f_thread_barrier_full_delete_
-
-/**
- * Wait on a barrier, effectively synchronizing multiple threads with some barrier.
- *
- * @param barrier
- * The barrier to wait on.
- *
- * Must not be NULL.
- * @param result
- * (optional) the return value, which will be PTHREAD_BARRIER_SERIAL_THREAD for one thread and 0 for others.
- *
- * Set to NULL to not use.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * @see pthread_barrier_wait()
- */
-#ifndef _di_f_thread_barrier_wait_
- extern f_status_t f_thread_barrier_wait(f_thread_barrier_t * const barrier, int * const result);
-#endif // _di_f_thread_barrier_wait_
-
-/**
- * Get the ID of the calling thread.
- *
- * @return
- * ID of the calling thread
- *
- * @see pthread_self()
- */
-#ifndef _di_f_thread_caller_
- extern f_thread_id_t f_thread_caller(void);
-#endif // _di_f_thread_caller_
-
-/**
- * Cancel a thread.
- *
- * @param id
- * The thread to cancel.
- *
- * @return
- * F_okay on success.
- *
- * F_found_not (with error bit) if no thread by the given ID was found.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_cancel()
- */
-#ifndef _di_f_thread_cancel_
- extern f_status_t f_thread_cancel(const f_thread_id_t id);
-#endif // _di_f_thread_cancel_
-
-/**
- * Assign a cancellation state.
- *
- * @param state
- * The cancellation state to assign.
- * @param previous
- * (optional) The previously assigned cancellation state.
- *
- * Set to NULL to not use.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_setcancelstate()
- */
-#ifndef _di_f_thread_cancel_state_set_
- extern f_status_t f_thread_cancel_state_set(const int state, int * const previous);
-#endif // _di_f_thread_cancel_state_set_
-
-/**
- * Force any pending thread cancellation to be processed.
- *
- * If there is no pending thread cancel, nothing happens.
- * If there is a pending thread cancel, the thread cancels and this function never returns.
- *
- * @return
- * F_okay on success.
- *
- * @see pthread_testcancel()
- */
-#ifndef _di_f_thread_cancel_test_
- extern f_status_t f_thread_cancel_test(void);
-#endif // _di_f_thread_cancel_test_
-
-/**
- * Assign a cancellation type.
- *
- * @param type
- * The cancellation type to assign.
- * @param previous
- * (optional) The previously assigned cancellation type.
- *
- * Set to NULL to not use.
- * (Note: Linux allows this to be optional/NULL but POSIX does not explicitly defined this and there may be portability issues.)
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_setcanceltype()
- */
-#ifndef _di_f_thread_cancel_type_set_
- extern f_status_t f_thread_cancel_type_set(const int type, int * const previous);
-#endif // _di_f_thread_cancel_type_set_
-
-/**
- * Get the clock ID for the given thread.
- *
- * @param id_thread
- * The ID of the thread to use.
- * @param id_clock
- * The retrieved clock ID.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_found_not (with error bit) if no thread by the given ID was found.
- * F_support_not (with error bit) if per-CPU clocks are not supported by the OS.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_getcpuclockid()
- */
-#ifndef _di_f_thread_clock_get_id_
- extern f_status_t f_thread_clock_get_id(const f_thread_id_t id_thread, clockid_t * const id_clock);
-#endif // _di_f_thread_clock_get_id_
-
-/**
- * Compare two different thread IDs.
- *
- * POSIX designates that the thread id (pthread_t) to be loosely defined and can be anything from an integer to a structure.
- * For portability purposes, calling pthread_equal() is the only safe way to compare two thread ids.
- *
- * @return
- * F_equal_to if the two thread IDs are the same.
- * F_equal_to_not if the two thread IDs are different.
- *
- * @see pthread_equal()
- */
-#ifndef _di_f_thread_compare_
- extern f_status_t f_thread_compare(const f_thread_id_t id1, const f_thread_id_t id2);
-#endif // _di_f_thread_compare_
-
-/**
- * Initialize a attribute.
- *
- * @param attribute
- * The attribute to set.
- * This assigns the default to the attribute.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_condattr_init()
- */
-#ifndef _di_f_thread_condition_attribute_create_
- extern f_status_t f_thread_condition_attribute_create(f_thread_condition_attribute_t * const attribute);
-#endif // _di_f_thread_condition_attribute_create_
-
-/**
- * Get the clock selection thread condition attribute.
- *
- * @param attribute
- * The thread condition attribute.
- *
- * Must not be NULL.
- * @param id
- * The clock ID.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_condattr_getclock()
- */
-#ifndef _di_f_thread_condition_attribute_clock_get_
- extern f_status_t f_thread_condition_attribute_clock_get(const f_thread_condition_attribute_t * const attribute, clockid_t * const id);
-#endif // _di_f_thread_condition_attribute_clock_get_
-
-/**
- * Set the clock selection thread condition attribute.
- *
- * @param id
- * The clock ID.
- * @param attribute
- * The thread condition attribute.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_condattr_setclock()
- */
-#ifndef _di_f_thread_condition_attribute_clock_set_
- extern f_status_t f_thread_condition_attribute_clock_set(const clockid_t id, f_thread_condition_attribute_t * const attribute);
-#endif // _di_f_thread_condition_attribute_clock_set_
-
-/**
- * Delete a thread condition attribute.
- *
- * The pthread_condattr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param attribute
- * The attribute to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_condattr_destroy()
- */
-#ifndef _di_f_thread_condition_attribute_delete_
- extern f_status_t f_thread_condition_attribute_delete(f_thread_condition_attribute_t * const attribute);
-#endif // _di_f_thread_condition_attribute_delete_
-
-/**
- * Get the process shared thread condition attribute.
- *
- * @param attribute
- * The thread condition attribute.
- * @param shared
- * The process shared attribute value.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_condattr_getpshared()
- */
-#ifndef _di_f_thread_condition_attribute_shared_get_
- extern f_status_t f_thread_condition_attribute_shared_get(const f_thread_condition_attribute_t * const attribute, int * const shared);
-#endif // _di_f_thread_condition_attribute_shared_get_
-
-/**
- * Set the process shared thread condition attribute.
- *
- * @param shared
- * The process shared attribute value.
- * @param attribute
- * The thread condition attribute.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_condattr_setpshared()
- */
-#ifndef _di_f_thread_condition_attribute_shared_set_
- extern f_status_t f_thread_condition_attribute_shared_set(const int shared, f_thread_condition_attribute_t * const attribute);
-#endif // _di_f_thread_condition_attribute_shared_set_
-
-/**
- * Initialize a condition.
- *
- * @param attribute
- * (optional) The attribute to set.
- * Set to NULL to not use (in which case the default attribute is used).
- * @param condition
- * The condition to wait on.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_cond_init()
- */
-#ifndef _di_f_thread_condition_create_
- extern f_status_t f_thread_condition_create(const f_thread_condition_attribute_t * const attribute, f_thread_condition_t * const condition);
-#endif // _di_f_thread_condition_create_
-
-/**
- * Delete a thread condition.
- *
- * The pthread_cond_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param condition
- * The condition to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the condition is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_cond_destroy()
- */
-#ifndef _di_f_thread_condition_delete_
- extern f_status_t f_thread_condition_delete(f_thread_condition_t * const condition);
-#endif // _di_f_thread_condition_delete_
-
-/**
- * Delete a thread condition full.
- *
- * The pthread_condattr_destroy() and pthread_condattr_destroy() functions have no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param full
- * The full to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the full is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_cond_destroy()
- * @see pthread_condattr_destroy()
- */
-#ifndef _di_f_thread_condition_full_delete_
- extern f_status_t f_thread_condition_full_delete(f_thread_condition_full_t * const full);
-#endif // _di_f_thread_condition_full_delete_
-
-/**
- * Signal a thread waiting on a condition.
- *
- * Only a single thread waiting on this condition is signaled.
- *
- * @param condition
- * The condition to broadcast the unblock signal to.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_cond_signal()
- */
-#ifndef _di_f_thread_condition_signal_
- extern f_status_t f_thread_condition_signal(f_thread_condition_t * const condition);
-#endif // _di_f_thread_condition_signal_
-
-/**
- * Signal all threads waiting on a condition.
- *
- * @param condition
- * The condition to broadcast the unblock signal to.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_cond_broadcast()
- */
-#ifndef _di_f_thread_condition_signal_all_
- extern f_status_t f_thread_condition_signal_all(f_thread_condition_t * const condition);
-#endif // _di_f_thread_condition_signal_all_
-
-/**
- * Wait until condition is triggered.
- *
- * This is a blocking operation.
- *
- * The caller must lock the mutex before calling this.
- * The caller should unlock the mutex after calling this.
- *
- * @param condition
- * The condition to wait on.
- * @param mutex
- * The mutex to use for waiting on condition.
- *
- * @return
- * F_okay on success.
- *
- * 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.
- * F_prohibited (with error bit) if not allowed to perform the operation (possibly because mutex is not owned by current thread).
- * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_cond_wait()
- */
-#ifndef _di_f_thread_condition_wait_
- extern f_status_t f_thread_condition_wait(f_thread_condition_t * const condition, f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_condition_wait_
-
-/**
- * Wait until condition is triggered, blocking until the timeout expires.
- *
- * This is a semi-blocking operation.
- * This blocks until timeout and then no longer block.
- *
- * The caller must lock the mutex before calling this.
- * The caller should unlock the mutex after calling this.
- *
- * @param wait
- * The amount of time to wait for.
- * The wait time is relative to the clock, so consider calling clock_gettime() or gettimeofday() and then adding the amount of wait time.
- * @param condition
- * The condition to wait on.
- *
- * Must not be NULL.
- * @param mutex
- * The mutex to use for waiting on condition.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * 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).
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation (possibly because mutex is not owned by current thread).
- * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_cond_timedwait()
- */
-#ifndef _di_f_thread_condition_wait_timed_
- extern f_status_t f_thread_condition_wait_timed(const f_time_spec_t * const wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_condition_wait_timed_
-
-/**
- * Create a thread.
- *
- * @param attribute
- * (optional) The thread attributes.
- * Set to NULL to use default attributes.
- * @param id
- * The thread ID.
- * This gets populated with the created thread ID (aka: the "child" thread).
- *
- * Must not be NULL.
- * @param routine
- * The function to execute.
- *
- * Must not be NULL.
- * @param argument
- * (optional) The structure containing all arguments to pass to the routine.
- * Set to NULL to not pass an argument.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to set the scheduling policy and parameters specified in attribute.
- * F_resource_not (with error bit) if there are not enough resources to create another thread.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_create()
- */
-#ifndef _di_f_thread_create_
- extern f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, const f_void_pointer_call_t routine, void * const argument);
-#endif // _di_f_thread_create_
-
-/**
- * Detatch the given thread.
- *
- * When a detached thread exits, the resources will automatically be returned to the system without needing another thread to join with it.
- *
- * Only joinable, undetached, threads are detachable.
- *
- * Once a thread is detached, it can no longer be joined.
- *
- * @param id
- * The ID of the thread to detach.
- *
- * @return
- * F_okay on success.
- *
- * F_found_not (with error bit) if no thread by the given ID was found.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_detach()
- */
-#ifndef _di_f_thread_detach_
- extern f_status_t f_thread_detach(const f_thread_id_t id);
-#endif // _di_f_thread_detach_
-
-/**
- * Have the current thread exit.
- *
- * @param result
- * The code returned by the exited thread.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * @see pthread_exit()
- */
-#ifndef _di_f_thread_exit_
- extern f_status_t f_thread_exit(int * const result);
-#endif // _di_f_thread_exit_
-
-/**
- * Wait until the given thread exits and then join it to the current thread.
- *
- * This is a blocking operation.
- *
- * @param id
- * The ID of the thread to wait for.
- * @param result
- * (optional) The data returned by the terminated thread (usually the exit status).
- * If the terminated thread is cancelled, then this holds PTHREAD_CANCELED.
- *
- * Set to NULL to not use.
- *
- * @return
- * F_okay on success.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.ead.
- * F_found_not (with error bit) if no thread by the given ID was found.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_join()
- */
-#ifndef _di_f_thread_join_
- extern f_status_t f_thread_join(const f_thread_id_t id, void ** const result);
-#endif // _di_f_thread_join_
-
-/**
- * Try to join the given thread to the current thread.
- *
- * This is a non-blocking operation.
- *
- * @param id
- * The ID of the thread to wait for.
- * @param result
- * (optional) The data returned by the terminated thread (usually the exit status).
- * If the terminated thread is cancelled, then this holds PTHREAD_CANCELED.
- *
- * Set to NULL to not use.
- *
- * @return
- * F_okay on success.
- * F_busy on success, but thread could not be joined because it has not yet exited.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.ead.
- * F_found_not (with error bit) if no thread by the given ID was found.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_tryjoin_np()
- */
-#ifndef _di_f_thread_join_try_
- extern f_status_t f_thread_join_try(const f_thread_id_t id, void ** const result);
-#endif // _di_f_thread_join_try_
-
-/**
- * Try to join the given thread to the current thread, blocking until the timeout expires.
- *
- * This is a semi-blocking operation.
- * This blocks until timeout and then no longer block.
- *
- * @param id
- * The ID of the thread to wait for.
- * @param wait
- * The amount of time to wait for.
- * The wait time is relative to the clock, so consider calling clock_gettime() or gettimeofday() and then adding the amount of wait time.
- * @param result
- * (optional) The data returned by the terminated thread (usually the exit status).
- * If the terminated thread is cancelled, then this holds PTHREAD_CANCELED.
- *
- * Set to NULL to not use.
- *
- * @return
- * F_okay on success.
- * F_busy on success, but thread could not be joined because it has not yet exited.
- * F_time on success, but thread could not be joined because it has not yet exited and the wait timeout was reached.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.
- * F_found_not (with error bit) if no thread by the given ID was found.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_timedjoin_np()
- */
-#ifndef _di_f_thread_join_timed_
- extern f_status_t f_thread_join_timed(const f_thread_id_t id, const f_time_spec_t wait, void ** const result);
-#endif // _di_f_thread_join_timed_
-
-/**
- * Create a thread key.
- *
- * @param routine
- * The function to execute for deallocation/deleting.
- *
- * Must not be NULL.
- * @param key
- * The thread key.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to set the scheduling policy and parameters specified in attribute.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_key_create()
- */
-#ifndef _di_f_thread_key_create_
- extern f_status_t f_thread_key_create(void (*routine) (void *), f_thread_key_t * const key);
-#endif // _di_f_thread_key_create_
-
-/**
- * Delete a thread key.
- *
- * The pthread_key_delete() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param key
- * The key to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_key_delete()
- */
-#ifndef _di_f_thread_key_delete_
- extern f_status_t f_thread_key_delete(f_thread_key_t * const key);
-#endif // _di_f_thread_key_delete_
-
-/**
- * Get the value of a thread key.
- *
- * @param key
- * The thread key.
- * @param value
- * The assigned thread key value.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * @see pthread_getspecific()
- */
-#ifndef _di_f_thread_key_get_
- extern f_status_t f_thread_key_get(const f_thread_key_t key, void ** const value);
-#endif // _di_f_thread_key_get_
-
-/**
- * Get the value of a thread key.
- *
- * @param key
- * The thread key.
- * @param value
- * The thread key value to assign.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_setspecific()
- */
-#ifndef _di_f_thread_key_set_
- extern f_status_t f_thread_key_set(const f_thread_key_t key, const void * const value);
-#endif // _di_f_thread_key_set_
-
-/**
- * Create a thread lock attribute.
- *
- * @param attribute
- * The lock attributes to create.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the lock is busy.
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- * F_resource_not (with error bit) if max lockes is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlockattr_init()
- */
-#ifndef _di_f_thread_lock_attribute_create_
- extern f_status_t f_thread_lock_attribute_create(f_thread_lock_attribute_t * const attribute);
-#endif // _di_f_thread_lock_attribute_create_
-
-/**
- * Delete a thread lock attribute.
- *
- * The pthread_rwlockattr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param attribute
- * The attribute to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlockattr_destroy()
- */
-#ifndef _di_f_thread_lock_attribute_delete_
- extern f_status_t f_thread_lock_attribute_delete(f_thread_lock_attribute_t * const attribute);
-#endif // _di_f_thread_lock_attribute_delete_
-
-/**
- * Get the lock attribute process shared thread attribute.
- *
- * @param attribute
- * The lock attribute.
- *
- * Must not be NULL.
- * @param shared
- * The lock shared attribute value.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlockattr_getpshared()
- */
-#ifndef _di_f_thread_lock_attribute_shared_get_
- extern f_status_t f_thread_lock_attribute_shared_get(const f_thread_lock_attribute_t * const attribute, int * const shared);
-#endif // _di_f_thread_lock_attribute_shared_get_
-
-/**
- * Set the lock attribute process shared thread attribute.
- *
- * @param shared
- * The lock shared attribute value.
- * @param attribute
- * The lock attribute.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlockattr_setpshared()
- */
-#ifndef _di_f_thread_lock_attribute_shared_set_
- extern f_status_t f_thread_lock_attribute_shared_set(const int shared, f_thread_lock_attribute_t * const attribute);
-#endif // _di_f_thread_lock_attribute_shared_set_
-
-/**
- * Create a thread read/write lock.
- *
- * @param attribute
- * The lock attribute.
- *
- * Must not be NULL.
- * @param lock
- * The lock to create.
- *
- * @return
- * F_okay on success.
- *
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max lockes is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlock_init()
- */
-#ifndef _di_f_thread_lock_create_
- extern f_status_t f_thread_lock_create(const f_thread_lock_attribute_t * const attribute, f_thread_lock_t * const lock);
-#endif // _di_f_thread_lock_create_
-
-/**
- * Delete a thread read/write lock.
- *
- * The pthread_rwlock_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param lock
- * The lock to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the lock is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlock_destroy()
- */
-#ifndef _di_f_thread_lock_delete_
- extern f_status_t f_thread_lock_delete(f_thread_lock_t * const lock);
-#endif // _di_f_thread_lock_delete_
-
-/**
- * Delete a thread lock full.
- *
- * The pthread_rwlock_destroy() and pthread_rwlockattr_destroy() functions have no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param full
- * The full to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlockattr_destroy()
- */
-#ifndef _di_f_thread_lock_full_delete_
- extern f_status_t f_thread_lock_full_delete(f_thread_lock_full_t * const full);
-#endif // _di_f_thread_lock_full_delete_
-
-/**
- * Lock the read part of a read/write lock.
- *
- * This is a blocking function.
- *
- * @param lock
- * The thread lock.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max number of read locks allowed is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlock_rdlock()
- */
-#ifndef _di_f_thread_lock_read_
- extern f_status_t f_thread_lock_read(f_thread_lock_t * const lock);
-#endif // _di_f_thread_lock_read_
-
-/**
- * Lock the read part of a read/write lock, waiting for a set period of time to get the lock if already locked.
- *
- * If the read part of the read/write lock is already locked and the timeout expires, then the lock attempt fails.
- *
- * This is a blocking function (until timeout expires).
- *
- * @param timeout
- * The timeout.
- *
- * Must not be NULL.
- * @param lock
- * The read/write lock.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_time if the timeout was reached before obtaining the lock.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max number of read locks allowed is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlock_timedrdlock()
- */
-#ifndef _di_f_thread_lock_read_timed_
- extern f_status_t f_thread_lock_read_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock);
-#endif // _di_f_thread_lock_read_timed_
-
-/**
- * Try to lock the read part of a read/write lock.
- *
- * If lock is already locked, return immediately.
- *
- * This is a non-blocking function.
- *
- * @param lock
- * The thread lock.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_busy on success, but the lock is already locked.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max number of read locks allowed is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlock_tryrdlock()
- */
-#ifndef _di_f_thread_lock_read_try_
- extern f_status_t f_thread_lock_read_try(f_thread_lock_t * const lock);
-#endif // _di_f_thread_lock_read_try_
-
-/**
- * Lock the write part of a read/write lock.
- *
- * This is a blocking function.
- *
- * @param lock
- * The thread lock.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max locks is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlock_wrlock()
- */
-#ifndef _di_f_thread_lock_write_
- extern f_status_t f_thread_lock_write(f_thread_lock_t * const lock);
-#endif // _di_f_thread_lock_write_
-
-/**
- * Lock the write part of a read/write lock, waiting for a set period of time to get the lock if already locked.
- *
- * If the write part of the read/write lock is already locked and the timeout expires, then the lock attempt fails.
- *
- * This is a blocking function (until timeout expires).
- *
- * @param timeout
- * The timeout.
- *
- * Must not be NULL.
- * @param lock
- * The read/write lock.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_time if the timeout was reached before obtaining the lock.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlock_timedwrlock()
- */
-#ifndef _di_f_thread_lock_write_timed_
- extern f_status_t f_thread_lock_write_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock);
-#endif // _di_f_thread_lock_write_timed_
-
-/**
- * Try to lock the read part of a read/write lock.
- *
- * If lock is already locked, return immediately.
- *
- * This is a non-blocking function.
- *
- * @param lock
- * The thread lock.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_busy on success, but the lock is already locked.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max locks is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_rwlock_trywrlock()
- */
-#ifndef _di_f_thread_lock_write_try_
- extern f_status_t f_thread_lock_write_try(f_thread_lock_t * const lock);
-#endif // _di_f_thread_lock_write_try_
-
-/**
- * Create a thread mutex attribute.
- *
- * @param attribute
- * The mutex attributes to create.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the mutex is busy.
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- * F_resource_not (with error bit) if max mutexes is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_init()
- */
-#ifndef _di_f_thread_mutex_attribute_create_
- extern f_status_t f_thread_mutex_attribute_create(f_thread_mutex_attribute_t * const attribute);
-#endif // _di_f_thread_mutex_attribute_create_
-
-/**
- * Delete a thread mutex attribute.
- *
- * The pthread_mutexattr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param attribute
- * The attribute to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_destroy()
- */
-#ifndef _di_f_thread_mutex_attribute_delete_
- extern f_status_t f_thread_mutex_attribute_delete(f_thread_mutex_attribute_t * const attribute);
-#endif // _di_f_thread_mutex_attribute_delete_
-
-/**
- * Get the mutex attribute priority ceiling.
- *
- * @param attribute
- * The thread mutex attribute.
- *
- * Must not be NULL.
- * @param ceiling
- * The priority ceiling.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- *
- * @see pthread_mutexattr_getprioceiling()
- */
-#ifndef _di_f_thread_mutex_attribute_priority_ceiling_get_
- extern f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling);
-#endif // _di_f_thread_mutex_attribute_priority_ceiling_get_
-
-/**
- * Set the mutex attribute priority ceiling.
- *
- * @param ceiling
- * The priority ceiling.
- * @param attribute
- * The thread mutex attribute.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- *
- * @see pthread_mutexattr_setprioceiling()
- */
-#ifndef _di_f_thread_mutex_attribute_priority_ceiling_set_
- extern f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute);
-#endif // _di_f_thread_mutex_attribute_priority_ceiling_set_
-
-/**
- * Get the mutex attribute protocol.
- *
- * @param attribute
- * The thread mutex attribute.
- *
- * Must not be NULL.
- * @param protocol
- * The protocol.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_getprotocol()
- */
-#ifndef _di_f_thread_mutex_attribute_protocol_get_
- extern f_status_t f_thread_mutex_attribute_protocol_get(const f_thread_mutex_attribute_t * const attribute, int * const protocol);
-#endif // _di_f_thread_mutex_attribute_protocol_get_
-
-/**
- * Set the mutex attribute protocol.
- *
- * @param protocol
- * The protocol.
- * @param attribute
- * The thread mutex attribute.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- * F_support_not (with error bit) if the protocol is not supported.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_setprotocol()
- */
-#ifndef _di_f_thread_mutex_attribute_protocol_set_
- extern f_status_t f_thread_mutex_attribute_protocol_set(const int protocol, f_thread_mutex_attribute_t * const attribute);
-#endif // _di_f_thread_mutex_attribute_protocol_set_
-
-/**
- * Get the robust mutex attribute.
- *
- * @param attribute
- * The mutex attributes to set the value of.
- *
- * Must not be NULL.
- * @param robust
- * The value to set to robust attribute to.
- * See f_thread_mutex_stalled_d and f_thread_mutex_robust_d.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_setrobust()
- */
-#ifndef _di_f_thread_mutex_attribute_robust_get_
- extern f_status_t f_thread_mutex_attribute_robust_get(f_thread_mutex_attribute_t * const attribute, int * const robust);
-#endif // _di_f_thread_mutex_attribute_robust_get_
-
-/**
- * Set the robust mutex attribute.
- *
- * @param robust
- * The value to set to robust attribute to.
- * See f_thread_mutex_stalled_d and f_thread_mutex_robust_d.
- * @param attribute
- * The mutex attributes to set the value of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_setrobust()
- */
-#ifndef _di_f_thread_mutex_attribute_robust_set_
- extern f_status_t f_thread_mutex_attribute_robust_set(const int robust, f_thread_mutex_attribute_t * const attribute);
-#endif // _di_f_thread_mutex_attribute_robust_set_
-
-/**
- * Get the mutex attribute process shared thread attribute.
- *
- * @param attribute
- * The mutex attribute.
- *
- * Must not be NULL.
- * @param shared
- * The mutex shared attribute value.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_getpshared()
- */
-#ifndef _di_f_thread_mutex_attribute_shared_get_
- extern f_status_t f_thread_mutex_attribute_shared_get(const f_thread_mutex_attribute_t * const attribute, int * const shared);
-#endif // _di_f_thread_mutex_attribute_shared_get_
-
-/**
- * Set the mutex attribute process shared thread attribute.
- *
- * @param shared
- * The mutex shared attribute value.
- * @param attribute
- * The mutex attribute.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_setpshared()
- */
-#ifndef _di_f_thread_mutex_attribute_shared_set_
- extern f_status_t f_thread_mutex_attribute_shared_set(const int shared, f_thread_mutex_attribute_t * const attribute);
-#endif // _di_f_thread_mutex_attribute_shared_set_
-
-/**
- * Get the mutex attribute type.
- *
- * @param attribute
- * The mutex attribute.
- *
- * Must not be NULL.
- * @param type
- * The type.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_gettype()
- */
-#ifndef _di_f_thread_mutex_attribute_type_get_
- extern f_status_t f_thread_mutex_attribute_type_get(const f_thread_mutex_attribute_t * const attribute, int * const type);
-#endif // _di_f_thread_mutex_attribute_type_get_
-
-/**
- * Set the mutex attribute process shared thread attribute.
- *
- * @param type
- * The type.
- * @param attribute
- * The mutex attribute.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutexattr_settype()
- */
-#ifndef _di_f_thread_mutex_attribute_type_set_
- extern f_status_t f_thread_mutex_attribute_type_set(const int type, f_thread_mutex_attribute_t * const attribute);
-#endif // _di_f_thread_mutex_attribute_type_set_
-
-/**
- * Mark a robust mutex as consistent.
- *
- * Use this to re-mark a mutex that is no longer in a consistent state.
- *
- * This should be used to address mutex locks that return F_dead when attempting to acquire a lock.
- *
- * @param mutex
- * The thread mutex.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_robust (with error bit) if mutex is either not robust or it does not protect from an inconsistent state.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_consistent()
- */
-#ifndef _di_f_thread_mutex_consistent_
- extern f_status_t f_thread_mutex_consistent(f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_mutex_consistent_
-
-/**
- * Create a thread mutex.
- *
- * @param attribute
- * (optional) The mutex attributes to set.
- * Set to NULL to not use (in which case the default attributes are used).
- * @param mutex
- * The mutex to create.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the mutex is busy.
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- * F_resource_not (with error bit) if max mutexes is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_init()
- */
-#ifndef _di_f_thread_mutex_create_
- extern f_status_t f_thread_mutex_create(f_thread_mutex_attribute_t * const attribute, f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_mutex_create_
-
-/**
- * Delete a thread mutex.
- *
- * The pthread_mutex_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param mutex
- * The mutex to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the mutex is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_destroy()
- */
-#ifndef _di_f_thread_mutex_delete_
- extern f_status_t f_thread_mutex_delete(f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_mutex_delete_
-
-/**
- * Delete a thread mutex full.
- *
- * The pthread_mutex_destroy() and pthread_mutexattr_destroy() functions have no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param full
- * The full to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the mutex is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_destroy()
- * @see pthread_mutexattr_destroy()
- */
-#ifndef _di_f_thread_mutex_full_delete_
- extern f_status_t f_thread_mutex_full_delete(f_thread_mutex_full_t * const full);
-#endif // _di_f_thread_mutex_full_delete_
-
-/**
- * Get the mutex priority ceiling.
- *
- * @param mutex
- * The thread mutex.
- *
- * Must not be NULL.
- * @param ceiling
- * The priority ceiling.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_getprioceiling()
- */
-#ifndef _di_f_thread_mutex_priority_ceiling_get_
- extern f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t * const mutex, int * const ceiling);
-#endif // _di_f_thread_mutex_priority_ceiling_get_
-
-/**
- * Set the mutex priority ceiling.
- *
- * @param ceiling
- * The priority ceiling.
- * @param mutex
- * The thread mutex.
- *
- * Must not be NULL.
- * @param previous
- * (optional) The previous priority ceiling.
- *
- * Set to NULL to not use.
- *
- * @return
- * F_okay on success.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- * F_recover_not (with error bit) if the state protected by the mutex is not recoverable (for a "robust" mutex).
- * F_resource_not (with error bit) if max mutex locks is reached.
- * F_dead (with error bit) if the owning thread terminated while holding the mutex lock (thread is dead).
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_setprioceiling()
- */
-#ifndef _di_f_thread_mutex_priority_ceiling_set_
- extern f_status_t f_thread_mutex_priority_ceiling_set(const int ceiling, f_thread_mutex_t * const mutex, int * const previous);
-#endif // _di_f_thread_mutex_priority_ceiling_set_
-
-/**
- * Unlock the mutex.
- *
- * @param mutex
- * The thread mutex.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation (possibly because mutex is not owned by current thread).
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_unlock()
- */
-#ifndef _di_f_thread_mutex_unlock_
- extern f_status_t f_thread_mutex_unlock(f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_mutex_unlock_
-
-/**
- * Lock the mutex.
- *
- * This is a blocking function.
- *
- * @param mutex
- * The thread mutex.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_dead (with error bit) if the owning thread terminated while holding the mutex lock (thread is dead).
- * F_deadlock (with error bit) if operation would cause a deadlock.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
- * F_resource_not (with error bit) if max mutex locks is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_lock()
- */
-#ifndef _di_f_thread_mutex_lock_
- extern f_status_t f_thread_mutex_lock(f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_mutex_lock_
-
-/**
- * Lock the mutex, waiting for a set period of time to get the lock if already locked.
- *
- * If the mutex is already locked and the timeout expires, then the lock attempt fails.
- *
- * This is a blocking function (until timeout expires).
- *
- * @param timeout
- * The timeout.
- *
- * Must not be NULL.
- * @param mutex
- * The thread mutex.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_time if the timeout was reached before obtaining the lock.
- *
- * F_dead (with error bit) if the owning thread terminated while holding the mutex lock (thread is dead).
* F_deadlock (with error bit) if operation would cause a deadlock.
+ * F_found_not (with error bit) if no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation.
- * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
- * F_resource_not (with error bit) if max mutex locks is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_mutex_timedlock()
- */
-#ifndef _di_f_thread_mutex_lock_timed_
- extern f_status_t f_thread_mutex_lock_timed(const f_time_spec_t * const timeout, f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_mutex_lock_timed_
-
-/**
- * Try to lock the mutex.
- *
- * If mutex is already locked, return immediately.
- *
- * This is a non-blocking function.
- *
- * @param mutex
- * The thread mutex.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_busy on success, but the mutex is already locked.
- *
- * 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.
- * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
- * F_resource_not (with error bit) if max mutex locks is reached.
+ * F_support_not (with error bit) if the thread is not joinable or is already being joined by another thread.
*
* F_failure (with error bit) on any other error.
*
- * @see pthread_mutex_trylock()
+ * @see pthread_timedjoin_np()
*/
-#ifndef _di_f_thread_mutex_lock_try_
- extern f_status_t f_thread_mutex_lock_try(f_thread_mutex_t * const mutex);
-#endif // _di_f_thread_mutex_lock_try_
+#ifndef _di_f_thread_join_timed_
+ extern f_status_t f_thread_join_timed(const f_thread_id_t id, const f_time_spec_t wait, void ** const result);
+#endif // _di_f_thread_join_timed_
/**
* Set the name of the thread.
#endif // _di_f_thread_name_get_
/**
- * Call the given routine only one time and never again.
- *
- * Subsequent calls will not call the given routine.
- *
- * @param routine
- * The callback.
- * @param once
- * The once variable designating that the given routine will be called only once.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_once()
- */
-#ifndef _di_f_thread_once_
- extern f_status_t f_thread_once(const f_void_call_t routine, f_thread_once_t * const once);
-#endif // _di_f_thread_once_
-
-/**
* Get the thread scheduler parameter.
*
* @param id
#endif // _di_f_thread_scheduler_priority_set_
/**
- * Create a thread semaphore.
- *
- * @param shared
- * If TRUE, then the semaphore is shared between processes (stored as posix shared memory, memory mapped, etc..).
- * IF FALSE, then the semphore is shared between threads of a process (stored as a global variable or in the heap).
- * Not all systems support semaphores shared amongst processes.
- * @param value
- * The value to initially assign the semaphore on creation.
- * @param semaphore
- * The semaphore to create.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_support_not (with error bit) if the system does not support the process shared semaphore (shared == true).
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_init()
- */
-#ifndef _di_f_thread_semaphore_create_
- extern f_status_t f_thread_semaphore_create(const bool shared, const unsigned int value, f_thread_semaphore_t * const semaphore);
-#endif // _di_f_thread_semaphore_create_
-
-/**
- * Delete a thread semaphore.
- *
- * The sem_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param semaphore
- * The semaphore to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the semaphore is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_destroy()
- */
-#ifndef _di_f_thread_semaphore_delete_
- extern f_status_t f_thread_semaphore_delete(f_thread_semaphore_t * const semaphore);
-#endif // _di_f_thread_semaphore_delete_
-
-/**
- * Close a thread (named) semaphore file.
- *
- * A named semaphore should be deleted with f_thread_semephore_file_destroy().
- *
- * @param semaphore
- * The semaphore to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_close()
- */
-#ifndef _di_f_thread_semaphore_file_close_
- extern f_status_t f_thread_semaphore_file_close(f_thread_semaphore_t * const semaphore);
-#endif // _di_f_thread_semaphore_file_close_
-
-/**
- * Delete a thread (named) semaphore.
- *
- * This deletes the semaphore file and all processes holding this semaphore will be forcibly closed.
- *
- * @param name
- * The semaphore name to delete.
- *
- * @return
- * F_okay on success.
- * F_file_found_not the named file was not found.
- *
- * F_access_denied (with error bit) on access denied.
- * F_name_not (with error bit) if file name is too long.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_unlink()
- */
-#ifndef _di_f_thread_semaphore_file_delete_
- extern f_status_t f_thread_semaphore_file_delete(const f_string_static_t name);
-#endif // _di_f_thread_semaphore_file_delete_
-
-/**
- * Open or create a thread (named) semaphore file.
- *
- * @param name
- * The semaphore file name to create.
- * @param flag
- * The file create/open flags.
- * Pass the O_CREATE flag to create the semaphore file.
- * @param mode
- * (optional) The file permissions to assign the semaphore.
- * Ignored if O_CREAT is not used in flag.
- * Ignored if the named semaphore already exists.
- * Not optional when O_CREAT flag is set.
- *
- * Set to NULL to not use.
- * @param value
- * (optional) The value to initially assign the semaphore on creation.
- * Ignored if O_CREAT is not used in flag.
- * Ignored if the named semaphore already exists.
- * Not optional when O_CREAT flag is set.
- * Ignored when mode is NULL.
- * @param semaphore
- * The thread semaphore.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_access_denied (with error bit) on access denied.
- * F_file_descriptor_max (with error bit) if max file descrriptors was reached.
- * F_file_found (with error bit) if the file was found and both the O_CREAT and O_EXCL flags are set.
- * F_file_open_max (with error bit) too many open files.
- * F_file_found_not (with error bit) if the file was not found and the O_CREAT is not set.
- * F_name_not (with error bit) if file name is too long.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_support_not (with error bit) if the system does not support the process shared semaphore (shared == true).
- * F_memory_not (with error bit) if out of memory.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_open()
- */
-#ifndef _di_f_thread_semaphore_file_open_
- extern f_status_t f_thread_semaphore_file_open(const f_string_static_t name, const int flag, mode_t * const mode, unsigned int value, f_thread_semaphore_t ** const semaphore);
-#endif // _di_f_thread_semaphore_file_open_
-
-/**
- * Lock the semaphore.
- *
- * This is a blocking function.
- *
- * This causes the semaphore value to decrement.
- *
- * @param semaphore
- * The thread semaphore.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_interrupt (with error bit) if returned due to an interrupt signal.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_wait()
- */
-#ifndef _di_f_thread_semaphore_lock_
- extern f_status_t f_thread_semaphore_lock(f_thread_semaphore_t * const semaphore);
-#endif // _di_f_thread_semaphore_lock_
-
-/**
- * Lock the semaphore, waiting for a set period of time to get the lock if already locked.
- *
- * If the semaphore is already locked and the timeout expires, then the lock attempt fails.
- *
- * This is a blocking function (until timeout expires).
- *
- * @param timeout
- * The timeout.
- * @param semaphore
- * The thread semaphore.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_time if the timeout was reached before obtaining the lock.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_interrupt (with error bit) if returned due to an interrupt signal.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_timedwait()
- */
-#ifndef _di_f_thread_semaphore_lock_timed_
- extern f_status_t f_thread_semaphore_lock_timed(const f_time_spec_t * const timeout, f_thread_semaphore_t * const semaphore);
-#endif // _di_f_thread_semaphore_lock_timed_
-
-/**
- * Try to lock the semaphore.
- *
- * If semaphore is already locked, return immediately.
- *
- * This is a non-blocking function.
- *
- * @param semaphore
- * The thread semaphore.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_interrupt (with error bit) if returned due to an interrupt signal.
- * F_resource_not (with error bit) if max semaphore locks is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_trywait()
- */
-#ifndef _di_f_thread_semaphore_lock_try_
- extern f_status_t f_thread_semaphore_lock_try(f_thread_semaphore_t * const semaphore);
-#endif // _di_f_thread_semaphore_lock_try_
-
-/**
- * Unlock the semaphore.
- *
- * This causes the semaphore value to increment.
- *
- * @param semaphore
- * The thread semaphore.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_number_overflow (with error bit) if max semaphore value is reached.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_post()
- */
-#ifndef _di_f_thread_semaphore_unlock_
- extern f_status_t f_thread_semaphore_unlock(f_thread_semaphore_t * const semaphore);
-#endif // _di_f_thread_semaphore_unlock_
-
-/**
- * Get the semaphore value.
- *
- * @param semaphore
- * The thread semaphore.
- *
- * Must not be NULL.
- * @param value
- * The semaphore's value.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see sem_getvalue()
- */
-#ifndef _di_f_thread_semaphore_value_get_
- extern f_status_t f_thread_semaphore_value_get(f_thread_semaphore_t * const semaphore, int * const value);
-#endif // _di_f_thread_semaphore_value_get_
-
-/**
* Get or assign the current signal set in use.
*
* Either set or previous may be NULL but not both (at least one is required).
#endif // _di_f_thread_signal_write_
/**
- * Create a thread spin lock.
- *
- * @param shared
- * The shared process setting.
- * @param spin
- * The spin to create.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_memory_not (with error bit) if out of memory.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max spines is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_spin_init()
- */
-#ifndef _di_f_thread_spin_create_
- extern f_status_t f_thread_spin_create(const int shared, f_thread_spin_t * const spin);
-#endif // _di_f_thread_spin_create_
-
-/**
- * Delete a thread spin lock.
- *
- * The pthread_spin_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
- * Therefore there is only this function for both deleting and destroying.
- *
- * @param spin
- * The spin to delete.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if the spin is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_spin_destroy()
- */
-#ifndef _di_f_thread_spin_delete_
- extern f_status_t f_thread_spin_delete(f_thread_spin_t * const spin);
-#endif // _di_f_thread_spin_delete_
-
-/**
- * Lock the spin lock.
- *
- * This is a blocking function.
- *
- * @param spin
- * The thread spin.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_deadlock (with error bit) if operation would cause a deadlock.
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max spin locks is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_spin_lock()
- */
-#ifndef _di_f_thread_spin_lock_
- extern f_status_t f_thread_spin_lock(f_thread_spin_t * const spin);
-#endif // _di_f_thread_spin_lock_
-
-/**
- * Try to lock the spin lock.
- *
- * If spin is already locked, return immediately.
- *
- * This is a non-blocking function.
- *
- * @param spin
- * The thread spin.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- * F_busy on success, but the spin is already locked.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_resource_not (with error bit) if max spin locks is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_spin_trylock()
- */
-#ifndef _di_f_thread_spin_lock_try_
- extern f_status_t f_thread_spin_lock_try(f_thread_spin_t * const spin);
-#endif // _di_f_thread_spin_lock_try_
-
-/**
- * Unlock the spin lock.
- *
- * @param spin
- * The thread spin.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- * F_prohibited (with error bit) if not allowed to perform the operation (possibly because spin is not owned by current thread).
- * F_resource_not (with error bit) if max spin locks is reached.
- *
- * F_failure (with error bit) on any other error.
- *
- * @see pthread_spin_unlock()
- */
-#ifndef _di_f_thread_spin_unlock_
- extern f_status_t f_thread_spin_unlock(f_thread_spin_t * const spin);
-#endif // _di_f_thread_spin_unlock_
-
-/**
* Unlock the read/write lock.
*
* @param lock
#include "../thread.h"
-#include "attribute.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_attributes_delete_callback_
- f_status_t f_thread_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#if defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_get_)
+ f_status_t f_thread_attribute_affinity_get(const f_thread_attribute_t attribute, const size_t affinity_size, cpu_set_t * const affinity_set) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!affinity_set) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_attribute_t * const array = (f_thread_attribute_t *) void_array;
+ return F_status_set_error(F_implement_not);
+ }
+#elif !defined(_di_f_thread_attribute_affinity_get_)
+ f_status_t f_thread_attribute_affinity_get(const f_thread_attribute_t attribute, const size_t affinity_size, cpu_set_t * const affinity_set) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!affinity_set) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getaffinity_np(&attribute, affinity_size, affinity_set);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_get_)
+
+#if defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_set_)
+ f_status_t f_thread_attribute_affinity_set(const size_t affinity_size, const cpu_set_t * const affinity_set, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return F_status_set_error(F_implement_not);
+ }
+#elif !defined(_di_f_thread_attribute_affinity_set_)
+ f_status_t f_thread_attribute_affinity_set(const size_t affinity_size, const cpu_set_t * const affinity_set, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_setaffinity_np(attribute, affinity_size, affinity_set);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_set_)
+
+#ifndef _di_f_thread_attribute_concurrency_get_
+ f_status_t f_thread_attribute_concurrency_get(int * const level) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!level) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ *level = pthread_getconcurrency();
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_concurrency_get_
+
+#ifndef _di_f_thread_attribute_concurrency_set_
+ f_status_t f_thread_attribute_concurrency_set(const int level) {
+
+ const int error = pthread_setconcurrency(level);
+
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_concurrency_set_
+
+#ifndef _di_f_thread_attribute_create_
+ f_status_t f_thread_attribute_create(f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_init(attribute);
+
+ if (error) {
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_create_
+
+#ifndef _di_f_thread_attribute_default_get_
+ f_status_t f_thread_attribute_default_get(f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_getattr_default_np(attribute);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_default_get_
+
+#ifndef _di_f_thread_attribute_default_set_
+ f_status_t f_thread_attribute_default_set(f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_setattr_default_np(attribute);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_default_set_
+
+#ifndef _di_f_thread_attribute_delete_
+ f_status_t f_thread_attribute_delete(f_thread_attribute_t *attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (pthread_attr_destroy(attribute)) return F_status_set_error(F_failure);
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_delete_
+
+#ifndef _di_f_thread_attribute_detach_get_
+ f_status_t f_thread_attribute_detach_get(const f_thread_attribute_t attribute, int * const state) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!state) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getdetachstate(&attribute, state);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_detach_get_
+
+#ifndef _di_f_thread_attribute_detach_set_
+ f_status_t f_thread_attribute_detach_set(const int state, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_setdetachstate(attribute, state);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_detach_set_
+
+#ifndef _di_f_thread_attribute_guard_get_
+ f_status_t f_thread_attribute_guard_get(const f_thread_attribute_t attribute, size_t * const guard) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!guard) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getguardsize(&attribute, guard);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_attr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attributes_delete_callback_
+#endif // _di_f_thread_attribute_guard_get_
-#ifndef _di_f_thread_attributes_destroy_callback_
- f_status_t f_thread_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_attribute_guard_set_
+ f_status_t f_thread_attribute_guard_set(const size_t guard, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_attribute_t * const array = (f_thread_attribute_t *) void_array;
+ const int error = pthread_attr_setguardsize(attribute, guard);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_attr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_guard_set_
+
+#ifndef _di_f_thread_attribute_scheduler_inherit_get_
+ f_status_t f_thread_attribute_scheduler_inherit_get(const f_thread_attribute_t attribute, int * const inherit) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!inherit) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getinheritsched(&attribute, inherit);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_scheduler_inherit_get_
+
+#ifndef _di_f_thread_attribute_scheduler_inherit_set_
+ f_status_t f_thread_attribute_scheduler_inherit_set(const int inherit, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_setinheritsched(attribute, inherit);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_scheduler_inherit_set_
+
+#ifndef _di_f_thread_attribute_scheduler_parameter_get_
+ f_status_t f_thread_attribute_scheduler_parameter_get(const f_thread_attribute_t attribute, struct sched_param * const parameter) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!parameter) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getschedparam(&attribute, parameter);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_scheduler_parameter_get_
+
+#ifndef _di_f_thread_attribute_scheduler_parameter_set_
+ f_status_t f_thread_attribute_scheduler_parameter_set(const struct sched_param parameter, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_setschedparam(attribute, ¶meter);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attributes_destroy_callback_
+#endif // _di_f_thread_attribute_scheduler_parameter_set_
+
+#ifndef _di_f_thread_attribute_scheduler_policy_get_
+ f_status_t f_thread_attribute_scheduler_policy_get(const f_thread_attribute_t attribute, int * const policy) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!policy) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getschedpolicy(&attribute, policy);
-#ifndef _di_f_thread_attributess_delete_callback_
- f_status_t f_thread_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_scheduler_policy_get_
- {
- f_thread_attributes_t * const array = (f_thread_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_attribute_scheduler_policy_set_
+ f_status_t f_thread_attribute_scheduler_policy_set(const int policy, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_attr_setschedpolicy(attribute, policy);
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_attr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attributess_delete_callback_
+#endif // _di_f_thread_attribute_scheduler_policy_set_
-#ifndef _di_f_thread_attributess_destroy_callback_
- f_status_t f_thread_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_attribute_scope_get_
+ f_status_t f_thread_attribute_scope_get(const f_thread_attribute_t attribute, int * const scope) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!scope) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getscope(&attribute, scope);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_scope_get_
+
+#ifndef _di_f_thread_attribute_scope_set_
+ f_status_t f_thread_attribute_scope_set(const int scope, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_setscope(attribute, scope);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOTSUP) return F_status_set_error(F_support_not);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_scope_set_
+
+#ifndef _di_f_thread_attribute_stack_get_
+ f_status_t f_thread_attribute_stack_get(const f_thread_attribute_t attribute, size_t * const stack_size, void ** const stack) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!stack_size) return F_status_set_error(F_parameter);
+ if (!stack) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getstack(&attribute, stack, stack_size);
+
+ if (error) {
+ if (error == EACCES) return F_status_set_error(F_access_denied);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_stack_get_
+
+#ifndef _di_f_thread_attribute_stack_set_
+ f_status_t f_thread_attribute_stack_set(const size_t stack_size, void * const stack, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!stack) return F_status_set_error(F_parameter);
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_setstack(attribute, stack, stack_size);
+
+ if (error) {
+ if (error == EACCES) return F_status_set_error(F_access_denied);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_stack_set_
+
+#ifndef _di_f_thread_attribute_stack_size_get_
+ f_status_t f_thread_attribute_stack_size_get(const f_thread_attribute_t attribute, size_t * const stack_size) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!stack_size) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_attr_getstacksize(&attribute, stack_size);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attribute_stack_size_get_
- {
- f_thread_attributes_t * const array = (f_thread_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_attribute_stack_size_set_
+ f_status_t f_thread_attribute_stack_size_set(const size_t stack_size, f_thread_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_attr_setstacksize(attribute, stack_size);
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_attr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_attributess_destroy_callback_
+#endif // _di_f_thread_attribute_stack_size_set_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_attribute_t_
/**
- * An array of f_thread_attribute_t.
+ * Get the affinity state of the thread attribute.
*
- * Properties:
- * - array: The array of f_thread_attribute_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * @param attribute
+ * The thread attributes to process.
+ * @param affinity_size
+ * The size of the affinity_set.
+ * @param affinity_set
+ * The assigned affinity information.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_getaffinity_np()
*/
-#ifndef _di_f_thread_attributes_t_
- typedef struct {
- f_thread_attribute_t *array;
+#ifndef _di_f_thread_attribute_affinity_get_
+ extern f_status_t f_thread_attribute_affinity_get(const f_thread_attribute_t attribute, const size_t affinity_size, cpu_set_t * const affinity_set);
+#endif // _di_f_thread_attribute_affinity_get_
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_attributes_t;
+/**
+ * Set the affinity state of the thread attribute.
+ *
+ * @param affinity_size
+ * The size of the affinity_set.
+ * @param affinity_set
+ * The affinity information to assign.
+ * @param attribute
+ * The thread attributes to update.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_memory_not (with error bit) if out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_setaffinity_np()
+ */
+#ifndef _di_f_thread_attribute_affinity_set_
+ extern f_status_t f_thread_attribute_affinity_set(const size_t affinity_size, const cpu_set_t *affinity_set, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_affinity_set_
- #define f_thread_attributes_t_initialize { 0, 0, 0 }
+/**
+ * Get the level of concurrency.
+ *
+ * A level of 0 designates the system to automatically choose concurrency level.
+ * Any non-zero level is considered a hint and will be followed at the systems discretion.
+ *
+ * @param level
+ * The concurrency level.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if the new level would cause the system to exceed available resources.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_getconcurrency()
+ */
+#ifndef _di_f_thread_attribute_concurrency_get_
+ extern f_status_t f_thread_attribute_concurrency_get(int * const level);
+#endif // _di_f_thread_attribute_concurrency_get_
- #define macro_f_thread_attributes_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_attributes_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_attributes_t_
+/**
+ * Set the level of concurrency.
+ *
+ * A level of 0 designates the system to automatically choose concurrency level.
+ * Any non-zero level is considered a hint and will be followed at the systems discretion.
+ *
+ * @param level
+ * The concurrency level.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_setconcurrency()
+ */
+#ifndef _di_f_thread_attribute_concurrency_set_
+ extern f_status_t f_thread_attribute_concurrency_set(const int level);
+#endif // _di_f_thread_attribute_concurrency_set_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_attributes_t structure.
+ * Create (initialize) a thread attribute structure.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * @param attribute
+ * The attribute to set.
*
- * This does not do parameter checking.
+ * Must not be NULL.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_memory_not (with error bit) if out of memory.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_init()
+ */
+#ifndef _di_f_thread_attribute_create_
+ extern f_status_t f_thread_attribute_create(f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_create_
+
+/**
+ * Get the default thread attribute.
+ *
+ * @param attribute
+ * The thread attributes to process.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_getattr_default_np()
*/
-#ifndef _di_f_thread_attributes_delete_callback_
- extern f_status_t f_thread_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_attributes_delete_callback_
+#ifndef _di_f_thread_attribute_default_get_
+ extern f_status_t f_thread_attribute_default_get(f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_default_get_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_attributes_t structure.
+ * Set the default thread attribute.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * @param attribute
+ * The thread attributes to update.
*
- * This does not do parameter checking.
+ * Must not be NULL.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @return
+ * F_okay on success.
+ *
+ * F_memory_not (with error bit) if out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_setattr_default_np()
+ */
+#ifndef _di_f_thread_attribute_default_set_
+ extern f_status_t f_thread_attribute_default_set(f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_default_set_
+
+/**
+ * Delete a thread attribute structure.
+ *
+ * On successfully delete, the pointer address is set to 0.
+ *
+ * The pthread_attr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
+ *
+ * @param attribute
+ * The thread attributes to delete.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_destroy()
+ */
+#ifndef _di_f_thread_attribute_delete_
+ extern f_status_t f_thread_attribute_delete(f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_delete_
+
+/**
+ * Get the detached state of the thread attribute.
+ *
+ * @param attribute
+ * The thread attributes to process.
+ * @param state
+ * The currently assigned state.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_getdetachstate()
+ */
+#ifndef _di_f_thread_attribute_detach_get_
+ extern f_status_t f_thread_attribute_detach_get(const f_thread_attribute_t attribute, int * const state);
+#endif // _di_f_thread_attribute_detach_get_
+
+/**
+ * Set the detached state of the thread attribute.
+ *
+ * @param state
+ * The state to assign (such as PTHREAD_CREATE_DETACHED or PTHREAD_CREATE_JOINABLE).
+ * @param attribute
+ * The thread attributes to update.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_attr_setdetachstate()
*/
-#ifndef _di_f_thread_attributes_destroy_callback_
- extern f_status_t f_thread_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_attributes_destroy_callback_
+#ifndef _di_f_thread_attribute_detach_set_
+ extern f_status_t f_thread_attribute_detach_set(const int state, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_detach_set_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_attributess_t structure.
+ * Get the guard size of the thread attribute.
+ *
+ * @param attribute
+ * The thread attributes to process.
+ * @param guard
+ * The currently assigned guard size.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * F_failure (with error bit) on any other error.
*
- * This does not do parameter checking.
+ * @see pthread_attr_getguardsize()
+ */
+#ifndef _di_f_thread_attribute_guard_get_
+ extern f_status_t f_thread_attribute_guard_get(const f_thread_attribute_t attribute, size_t * const guard);
+#endif // _di_f_thread_attribute_guard_get_
+
+/**
+ * Set the guard size of the thread attribute.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param guard
+ * The guard size to assign.
+ * @param attribute
+ * The thread attributes to update.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_attr_setguardsize()
*/
-#ifndef _di_f_thread_attributess_delete_callback_
- extern f_status_t f_thread_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_attributess_delete_callback_
+#ifndef _di_f_thread_attribute_guard_set_
+ extern f_status_t f_thread_attribute_guard_set(const size_t guard, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_guard_set_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_attributess_t structure.
+ * Get the scheduler inherit state of the thread attribute.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * @param attribute
+ * The thread attributes to process.
+ * @param inherit
+ * The currently assigned scheduler inherit state.
*
- * This does not do parameter checking.
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_getinheritsched()
+ */
+#ifndef _di_f_thread_attribute_scheduler_inherit_get_
+ extern f_status_t f_thread_attribute_scheduler_inherit_get(const f_thread_attribute_t attribute, int * const inherit);
+#endif // _di_f_thread_attribute_scheduler_inherit_get_
+
+/**
+ * Set the scheduler inherit state of the thread attribute.
+ *
+ * @param inherit
+ * The inherit state of the scheduler (such as PTHREAD_INHERIT_SCHED or PTHREAD_EXPLICIT_SCHED).
+ * @param attribute
+ * The thread attributes to update.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_setinheritsched()
+ */
+#ifndef _di_f_thread_attribute_scheduler_inherit_set_
+ extern f_status_t f_thread_attribute_scheduler_inherit_set(const int inherit, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_scheduler_inherit_set_
+
+/**
+ * Get the scheduler parameter state of the thread attribute.
+ *
+ * @param attribute
+ * The thread attributes to process.
+ * @param parameter
+ * The currently assigned scheduler parameters.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_getschedparam()
+ */
+#ifndef _di_f_thread_attribute_scheduler_parameter_get_
+ extern f_status_t f_thread_attribute_scheduler_parameter_get(const f_thread_attribute_t attribute, struct sched_param * const parameter);
+#endif // _di_f_thread_attribute_scheduler_parameter_get_
+
+/**
+ * Set the scheduler parameter state of the thread attribute.
+ *
+ * @param parameter
+ * The parameters of the scheduler.
+ * @param attribute
+ * The thread attributes to update.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_setschedparam()
+ */
+#ifndef _di_f_thread_attribute_scheduler_parameter_set_
+ extern f_status_t f_thread_attribute_scheduler_parameter_set(const struct sched_param parameter, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_scheduler_parameter_set_
+
+/**
+ * Get the scheduler policy state of the thread attribute.
+ *
+ * @param attribute
+ * The thread attributes to process.
+ * @param policy
+ * The currently assigned scheduler policy state.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_getschedpolicy()
+ */
+#ifndef _di_f_thread_attribute_scheduler_policy_get_
+ extern f_status_t f_thread_attribute_scheduler_policy_get(const f_thread_attribute_t attribute, int * const policy);
+#endif // _di_f_thread_attribute_scheduler_policy_get_
+
+/**
+ * Set the scheduler policy state of the thread attribute.
+ *
+ * @param policy
+ * The policy state of the scheduler (such as SCHED_FIFO, SCHED_RR, or SCHED_OTHER).
+ * @param attribute
+ * The thread attributes to update.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_setschedpolicy()
+ */
+#ifndef _di_f_thread_attribute_scheduler_policy_set_
+ extern f_status_t f_thread_attribute_scheduler_policy_set(const int policy, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_scheduler_policy_set_
+
+/**
+ * Get the scheduler scope state of the thread attribute.
+ *
+ * @param attribute
+ * The thread attributes to process.
+ * @param scope
+ * The currently assigned scheduler scope state.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_getscope()
+ */
+#ifndef _di_f_thread_attribute_scope_get_
+ extern f_status_t f_thread_attribute_scope_get(const f_thread_attribute_t attribute, int * const scope);
+#endif // _di_f_thread_attribute_scope_get_
+
+/**
+ * Set the scheduler scope state of the thread attribute.
+ *
+ * @param scope
+ * The scope state of the scheduler (such as PTHREAD_SCOPE_SYSTEM or PTHREAD_SCOPE_PROCESS).
+ * @param attribute
+ * The thread attributes to update.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_support_not (with error bit) if the scope is not supported by the current OS (such as Linux not supporting PTHREAD_SCOPE_PROCESS).
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_setscope()
+ */
+#ifndef _di_f_thread_attribute_scope_set_
+ extern f_status_t f_thread_attribute_scope_set(const int scope, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_scope_set_
+
+/**
+ * Get the stack of the thread attribute.
+ *
+ * @param attribute
+ * The thread attributes to process.
+ * @param stack_size
+ * The size of the stack.
+ *
+ * Must not be NULL.
+ * @param stack
+ * The assigned stack.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_access_denied (with error bit) if the caller cannot both read and write to the stack address.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_getstack()
+ */
+#ifndef _di_f_thread_attribute_stack_get_
+ extern f_status_t f_thread_attribute_stack_get(const f_thread_attribute_t attribute, size_t * const stack_size, void ** const stack);
+#endif // _di_f_thread_attribute_stack_get_
+
+/**
+ * Set the stack of the thread attribute.
+ *
+ * @param stack_size
+ * The size of the stack.
+ * @param stack
+ * The stack to assign.
+ *
+ * Must not be NULL.
+ * @param attribute
+ * The thread attributes to update
+ * Must not be NULL..
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_access_denied (with error bit) if the caller cannot both read and write to the stack address.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_setstack()
+ */
+#ifndef _di_f_thread_attribute_stack_set_
+ extern f_status_t f_thread_attribute_stack_set(const size_t stack_size, void * const stack, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_stack_set_
+
+/**
+ * Get the stack size of the thread attribute.
+ *
+ * @param attribute
+ * The thread attributes to process.
+ * @param stack_size
+ * The assigned size of the stack.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_attr_getstacksize()
+ */
+#ifndef _di_f_thread_attribute_stack_size_get_
+ extern f_status_t f_thread_attribute_stack_size_get(const f_thread_attribute_t attribute, size_t * const stack_size);
+#endif // _di_f_thread_attribute_stack_size_get_
+
+/**
+ * Set the stack size of the thread attribute.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param stack_size
+ * The size of the stack.
+ * @param attribute
+ * The thread attributes to update.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_attr_setstacksize()
*/
-#ifndef _di_f_thread_attributess_destroy_callback_
- extern f_status_t f_thread_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_attributess_destroy_callback_
+#ifndef _di_f_thread_attribute_stack_size_set_
+ extern f_status_t f_thread_attribute_stack_size_set(const size_t stack_size, f_thread_attribute_t * const attribute);
+#endif // _di_f_thread_attribute_stack_size_set_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_attributes_delete_callback_
+ f_status_t f_thread_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_attribute_t * const array = (f_thread_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_attr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attributes_delete_callback_
+
+#ifndef _di_f_thread_attributes_destroy_callback_
+ f_status_t f_thread_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_attribute_t * const array = (f_thread_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_attr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_attributes_h
+#define _F_thread_attributes_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of f_thread_attribute_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_attribute_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_attributes_t_
+ typedef struct {
+ f_thread_attribute_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_attributes_t;
+
+ #define f_thread_attributes_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_attributes_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_attributes_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_attributes_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_attributes_delete_callback_
+ extern f_status_t f_thread_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_attributes_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_attributess_destroy_callback_
+ extern f_status_t f_thread_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_attributes_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_attributess_delete_callback_
+ f_status_t f_thread_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_attributes_t * const array = (f_thread_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_attr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attributess_delete_callback_
+
+#ifndef _di_f_thread_attributess_destroy_callback_
+ f_status_t f_thread_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_attributes_t * const array = (f_thread_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_attr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_attributess_h
+#define _F_thread_attributess_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of f_thread_attributes_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_attributes_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_attributess_t_
+ typedef struct {
+ f_thread_attributes_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_attributess_t;
+
+ #define f_thread_attributess_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_attributess_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_attributess_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_attributess_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_attributess_delete_callback_
+ extern f_status_t f_thread_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_attributess_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_attributes_destroy_callback_
+ extern f_status_t f_thread_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_attributess_h
#include "../thread.h"
-#include "barrier.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_barriers_delete_callback_
- f_status_t f_thread_barriers_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_barrier_create_
+ f_status_t f_thread_barrier_create(const unsigned int count, f_thread_barrier_attribute_t * const attribute, f_thread_barrier_t * const barrier) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!barrier) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_barrier_t * const array = (f_thread_barrier_t *) void_array;
- int error = 0;
+ const int error = pthread_barrier_init(barrier, attribute, count);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
- error = pthread_barrier_destroy(&array[i]);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_barriers_delete_callback_
-
-#ifndef _di_f_thread_barriers_destroy_callback_
- f_status_t f_thread_barriers_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_barrier_create_
- {
- f_thread_barrier_t * const array = (f_thread_barrier_t *) void_array;
- int error = 0;
+#ifndef _di_f_thread_barrier_delete_
+ f_status_t f_thread_barrier_delete(f_thread_barrier_t * const barrier) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!barrier) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_barrier_destroy(barrier);
- error = pthread_barrier_destroy(&array[i]);
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_barriers_destroy_callback_
-
-#ifndef _di_f_thread_barrierss_delete_callback_
- f_status_t f_thread_barrierss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_barriers_t * const array = (f_thread_barriers_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+#endif // _di_f_thread_barrier_delete_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+#ifndef _di_f_thread_barrier_wait_
+ f_status_t f_thread_barrier_wait(f_thread_barrier_t * const barrier, int * const result) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!barrier) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_barrier_destroy(&array[i].array[j]);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ if (result) {
+ *result = pthread_barrier_wait(barrier);
}
-
- return F_okay;
- }
-#endif // _di_f_thread_barrierss_delete_callback_
-
-#ifndef _di_f_thread_barrierss_destroy_callback_
- f_status_t f_thread_barrierss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_barriers_t * const array = (f_thread_barriers_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_barrier_destroy(&array[i].array[j]);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ else {
+ pthread_barrier_wait(barrier);
}
return F_okay;
}
-#endif // _di_f_thread_barrierss_destroy_callback_
+#endif // _di_f_thread_barrier_wait_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_barrier_t_
/**
- * An array of f_thread_barrier_t.
+ * Create (initialize) a thread barrier structure.
*
- * Properties:
- * - array: The array of f_thread_barrier_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_barriers_t_
- typedef struct {
- f_thread_barrier_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_barriers_t;
-
- #define f_thread_barriers_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_barriers_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_barriers_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_barriers_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barriers_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param count
+ * The number of threads that must call the barrier wait function before any can successfully return.
+ * @param attribute
+ * (optional) The default attributes to initialize the barrier to.
+ * Set to NULL to not use (in which case the default barrier attributes are used).
+ * @param barrier
+ * The barrier to set.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a barrier is busy.
+ * F_busy (with error bit) if barrier is already in use (a re-initialization attempt).
+ * F_memory_not (with error bit) if out of memory.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if necessary resouces to perform create are unavailable.
*
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * F_failure (with error bit) on any other error.
*
- * @see pthread_barrier_destroy()
+ * @see pthread_barrier_init()
*/
-#ifndef _di_f_thread_barriers_delete_callback_
- extern f_status_t f_thread_barriers_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barriers_delete_callback_
+#ifndef _di_f_thread_barrier_create_
+ extern f_status_t f_thread_barrier_create(const unsigned int count, f_thread_barrier_attribute_t * const attribute, f_thread_barrier_t * const barrier);
+#endif // _di_f_thread_barrier_create_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barriers_t structure.
+ * Delete a thread barrier structure.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * On successfully delete, the pointer address is set to 0.
*
- * This does not do parameter checking.
+ * The pthread_barrier_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param barrier
+ * The thread barriers to delete.
*
* Must not be NULL.
*
* F_busy (with error bit) if a barrier is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * F_failure (with error bit) on any other error.
*
* @see pthread_barrier_destroy()
*/
-#ifndef _di_f_thread_barriers_destroy_callback_
- extern f_status_t f_thread_barriers_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barriers_destroy_callback_
+#ifndef _di_f_thread_barrier_delete_
+ extern f_status_t f_thread_barrier_delete(f_thread_barrier_t * const barrier);
+#endif // _di_f_thread_barrier_delete_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrierss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Wait on a barrier, effectively synchronizing multiple threads with some barrier.
*
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param barrier
+ * The barrier to wait on.
*
* Must not be NULL.
+ * @param result
+ * (optional) the return value, which will be PTHREAD_BARRIER_SERIAL_THREAD for one thread and 0 for others.
*
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a barrier is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_barrier_destroy()
- */
-#ifndef _di_f_thread_barrierss_delete_callback_
- extern f_status_t f_thread_barrierss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrierss_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrierss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
+ * Set to NULL to not use.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a barrier is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- *
- * @see pthread_barrier_destroy()
+ * @see pthread_barrier_wait()
*/
-#ifndef _di_f_thread_barrierss_destroy_callback_
- extern f_status_t f_thread_barrierss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrierss_destroy_callback_
+#ifndef _di_f_thread_barrier_wait_
+ extern f_status_t f_thread_barrier_wait(f_thread_barrier_t * const barrier, int * const result);
+#endif // _di_f_thread_barrier_wait_
#ifdef __cplusplus
} // extern "C"
#include "../thread.h"
-#include "barrier_attribute.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_barrier_attributes_delete_callback_
- f_status_t f_thread_barrier_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_barrier_attribute_create_
+ f_status_t f_thread_barrier_attribute_create(f_thread_barrier_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_barrier_attribute_t * const array = (f_thread_barrier_attribute_t *) void_array;
+ const int error = pthread_barrierattr_init(attribute);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_barrierattr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
+
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_barrier_attributes_delete_callback_
-
-#ifndef _di_f_thread_barrier_attributes_destroy_callback_
- f_status_t f_thread_barrier_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_barrier_attribute_create_
- {
- f_thread_barrier_attribute_t * const array = (f_thread_barrier_attribute_t *) void_array;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_barrierattr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
- }
+#ifndef _di_f_thread_barrier_attribute_delete_
+ f_status_t f_thread_barrier_attribute_delete(f_thread_barrier_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- return F_okay;
+ return pthread_barrierattr_destroy(attribute) ? F_status_set_error(F_failure) : F_okay;
}
-#endif // _di_f_thread_barrier_attributes_destroy_callback_
-
-#ifndef _di_f_thread_barrier_attributess_delete_callback_
- f_status_t f_thread_barrier_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_barrier_attribute_delete_
- {
- f_thread_barrier_attributes_t * const array = (f_thread_barrier_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_barrier_attribute_shared_get_
+ f_status_t f_thread_barrier_attribute_shared_get(const f_thread_barrier_attribute_t * const attribute, int * const shared) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!shared) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_barrierattr_getpshared(attribute, shared);
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_barrierattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_barrier_attributess_delete_callback_
-
-#ifndef _di_f_thread_barrier_attributess_destroy_callback_
- f_status_t f_thread_barrier_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_barrier_attribute_shared_get_
- {
- f_thread_barrier_attributes_t * const array = (f_thread_barrier_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_barrier_attribute_shared_set_
+ f_status_t f_thread_barrier_attribute_shared_set(const int shared, f_thread_barrier_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_barrierattr_setpshared(attribute, shared);
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_barrierattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_barrier_attributess_destroy_callback_
+#endif // _di_f_thread_barrier_attribute_shared_set_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_barrier_attribute_t_
/**
- * An array of f_thread_barrier_attribute_t.
+ * Create (initialize) a thread barrier attribute structure.
*
- * Properties:
- * - array: The array of f_thread_barrier_attribute_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_barrier_attributes_t_
- typedef struct {
- f_thread_barrier_attribute_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_barrier_attributes_t;
-
- #define f_thread_barrier_attributes_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_barrier_attributes_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_barrier_attributes_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_barrier_attributes_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_attributes_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param attribute
+ * The attribute to set.
*
* Must not be NULL.
*
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ * F_memory_not (with error bit) if out of memory.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_barrierattr_init()
*/
-#ifndef _di_f_thread_barrier_attributes_delete_callback_
- extern f_status_t f_thread_barrier_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrier_attributes_delete_callback_
+#ifndef _di_f_thread_barrier_attribute_create_
+ extern f_status_t f_thread_barrier_attribute_create(f_thread_barrier_attribute_t * const attribute);
+#endif // _di_f_thread_barrier_attribute_create_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_attributes_t structure.
+ * Delete a thread barrier attribute structure.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * On successfully delete, the pointer address is set to 0.
*
- * This does not do parameter checking.
+ * The pthread_barrierattr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param attribute
+ * The thread barrier_attributes to delete.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_barrierattr_destroy()
*/
-#ifndef _di_f_thread_barrier_attributes_destroy_callback_
- extern f_status_t f_thread_barrier_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrier_attributes_destroy_callback_
+#ifndef _di_f_thread_barrier_attribute_delete_
+ extern f_status_t f_thread_barrier_attribute_delete(f_thread_barrier_attribute_t * const attribute);
+#endif // _di_f_thread_barrier_attribute_delete_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_attributess_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Get the barrier process shared thread attribute.
*
- * This does not do parameter checking.
+ * @param attribute
+ * The barrier thread attribute.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * Must not be NULL.
+ * @param shared
+ * The process shared attribute value.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_barrierattr_getpshared()
*/
-#ifndef _di_f_thread_barrier_attributess_delete_callback_
- extern f_status_t f_thread_barrier_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrier_attributess_delete_callback_
+#ifndef _di_f_thread_barrier_attribute_shared_get_
+ extern f_status_t f_thread_barrier_attribute_shared_get(const f_thread_barrier_attribute_t * const attribute, int * const shared);
+#endif // _di_f_thread_barrier_attribute_shared_get_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_attributess_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
+ * Set the barrier process shared thread attribute.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param shared
+ * The process shared attribute value.
+ * @param attribute
+ * The barrier thread attribute.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_barrierattr_setpshared()
*/
-#ifndef _di_f_thread_barrier_attributess_destroy_callback_
- extern f_status_t f_thread_barrier_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrier_attributess_destroy_callback_
+#ifndef _di_f_thread_barrier_attribute_shared_set_
+ extern f_status_t f_thread_barrier_attribute_shared_set(const int shared, f_thread_barrier_attribute_t * const attribute);
+#endif // _di_f_thread_barrier_attribute_shared_set_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_barrier_attributes_delete_callback_
+ f_status_t f_thread_barrier_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_attribute_t * const array = (f_thread_barrier_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_barrierattr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrier_attributes_delete_callback_
+
+#ifndef _di_f_thread_barrier_attributes_destroy_callback_
+ f_status_t f_thread_barrier_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_attribute_t * const array = (f_thread_barrier_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_barrierattr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrier_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_barrier_attributes_h
+#define _F_thread_barrier_attributes_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of f_thread_barrier_attribute_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_barrier_attribute_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_barrier_attributes_t_
+ typedef struct {
+ f_thread_barrier_attribute_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_barrier_attributes_t;
+
+ #define f_thread_barrier_attributes_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_barrier_attributes_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_barrier_attributes_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_barrier_attributes_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_barrier_attributes_delete_callback_
+ extern f_status_t f_thread_barrier_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrier_attributes_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_barrier_attributes_destroy_callback_
+ extern f_status_t f_thread_barrier_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrier_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_barrier_attributes_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_barrier_attributess_delete_callback_
+ f_status_t f_thread_barrier_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_attributes_t * const array = (f_thread_barrier_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_barrierattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrier_attributess_delete_callback_
+
+#ifndef _di_f_thread_barrier_attributess_destroy_callback_
+ f_status_t f_thread_barrier_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_attributes_t * const array = (f_thread_barrier_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_barrierattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrier_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_barrier_attributess_h
+#define _F_thread_barrier_attributess_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of f_thread_barrier_attributes_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_barrier_attributes_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_barrier_attributess_t_
+ typedef struct {
+ f_thread_barrier_attributes_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_barrier_attributess_t;
+
+ #define f_thread_barrier_attributess_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_barrier_attributess_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_barrier_attributess_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_barrier_attributess_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_barrier_attributess_delete_callback_
+ extern f_status_t f_thread_barrier_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrier_attributess_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_barrier_attributess_destroy_callback_
+ extern f_status_t f_thread_barrier_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrier_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_barrier_attributess_h
#include "../thread.h"
-#include "barrier_full.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_barrier_fulls_delete_callback_
- f_status_t f_thread_barrier_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_barrier_full_delete_
+ f_status_t f_thread_barrier_full_delete(f_thread_barrier_full_t * const full) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!full) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- f_thread_barrier_full_t * const array = (f_thread_barrier_full_t *) void_array;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- error = pthread_barrier_destroy(&array[i].barrier);
+ {
+ const int error = pthread_barrier_destroy(&full->barrier);
if (error) {
if (error == EBUSY) return F_status_set_error(F_busy);
return F_status_set_error(F_failure);
}
+ }
- if (pthread_barrierattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_fulls_delete_callback_
-
-#ifndef _di_f_thread_barrier_fulls_destroy_callback_
- f_status_t f_thread_barrier_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_barrier_full_t * const array = (f_thread_barrier_full_t *) void_array;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- error = pthread_barrier_destroy(&array[i].barrier);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_barrierattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_fulls_destroy_callback_
-
-#ifndef _di_f_thread_barrier_fullss_delete_callback_
- f_status_t f_thread_barrier_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_barrier_fulls_t * const array = (f_thread_barrier_fulls_t *) void_array;
- f_number_unsigned_t j = 0;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_barrier_destroy(&array[i].array[j].barrier);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_barrierattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_barrier_fullss_delete_callback_
-
-#ifndef _di_f_thread_barrier_fullss_destroy_callback_
- f_status_t f_thread_barrier_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_barrier_fulls_t * const array = (f_thread_barrier_fulls_t *) void_array;
- f_number_unsigned_t j = 0;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_barrier_destroy(&array[i].array[j].barrier);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_barrierattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
+ return pthread_barrierattr_destroy(&full->attribute) ? F_status_set_error(F_failure) : F_okay;
}
-#endif // _di_f_thread_barrier_fullss_destroy_callback_
+#endif // _di_f_thread_barrier_full_delete_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_barrier_full_t_
/**
- * An array of f_thread_barrier_full_t.
+ * Delete a thread barrier full structure.
*
- * Properties:
- * - array: The array of f_thread_barrier_full_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_barrier_fulls_t_
- typedef struct {
- f_thread_barrier_full_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_barrier_fulls_t;
-
- #define f_thread_barrier_fulls_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_barrier_fulls_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_barrier_fulls_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_barrier_fulls_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_fulls_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a barrier is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_resize().
+ * On successfully delete, the pointer address is set to 0.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_barrier_destroy()
- * @see pthread_barrierattr_destroy()
- */
-#ifndef _di_f_thread_barrier_fulls_delete_callback_
- extern f_status_t f_thread_barrier_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrier_fulls_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_fulls_t structure.
+ * The pthread_barrier_destroy() and pthread_barrierattr_destroy() functions have no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param full
+ * The thread barrier_fulls to delete.
*
* Must not be NULL.
*
* F_busy (with error bit) if a barrier is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- *
- * @see pthread_barrier_destroy()
- * @see pthread_barrierattr_destroy()
- */
-#ifndef _di_f_thread_barrier_fulls_destroy_callback_
- extern f_status_t f_thread_barrier_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrier_fulls_destroy_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_fullss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a barrier is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_barrier_destroy()
- * @see pthread_barrierattr_destroy()
- */
-#ifndef _di_f_thread_barrier_fullss_delete_callback_
- extern f_status_t f_thread_barrier_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrier_fullss_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_fullss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a barrier is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * F_failure (with error bit) on any other error.
*
* @see pthread_barrier_destroy()
* @see pthread_barrierattr_destroy()
*/
-#ifndef _di_f_thread_barrier_fullss_destroy_callback_
- extern f_status_t f_thread_barrier_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_barrier_fullss_destroy_callback_
+#ifndef _di_f_thread_barrier_full_delete_
+ extern f_status_t f_thread_barrier_full_delete(f_thread_barrier_full_t * const full);
+#endif // _di_f_thread_barrier_full_delete_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_barrier_fulls_delete_callback_
+ f_status_t f_thread_barrier_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_full_t * const array = (f_thread_barrier_full_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_barrier_destroy(&array[i].barrier);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_barrierattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrier_fulls_delete_callback_
+
+#ifndef _di_f_thread_barrier_fulls_destroy_callback_
+ f_status_t f_thread_barrier_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_full_t * const array = (f_thread_barrier_full_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_barrier_destroy(&array[i].barrier);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_barrierattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrier_fulls_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_barrier_fulls_h
+#define _F_thread_barrier_fulls_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of f_thread_barrier_full_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_barrier_full_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_barrier_fulls_t_
+ typedef struct {
+ f_thread_barrier_full_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_barrier_fulls_t;
+
+ #define f_thread_barrier_fulls_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_barrier_fulls_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_barrier_fulls_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_barrier_fulls_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_fulls_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a barrier is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_barrier_destroy()
+ * @see pthread_barrierattr_destroy()
+ */
+#ifndef _di_f_thread_barrier_fulls_delete_callback_
+ extern f_status_t f_thread_barrier_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrier_fulls_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_fulls_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a barrier is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_barrier_destroy()
+ * @see pthread_barrierattr_destroy()
+ */
+#ifndef _di_f_thread_barrier_fulls_destroy_callback_
+ extern f_status_t f_thread_barrier_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrier_fulls_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_barrier_fulls_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_barrier_fullss_delete_callback_
+ f_status_t f_thread_barrier_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_fulls_t * const array = (f_thread_barrier_fulls_t *) void_array;
+ f_number_unsigned_t j = 0;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_barrier_destroy(&array[i].array[j].barrier);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_barrierattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrier_fullss_delete_callback_
+
+#ifndef _di_f_thread_barrier_fullss_destroy_callback_
+ f_status_t f_thread_barrier_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_fulls_t * const array = (f_thread_barrier_fulls_t *) void_array;
+ f_number_unsigned_t j = 0;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_barrier_destroy(&array[i].array[j].barrier);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_barrierattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrier_fullss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_barrier_fullss_h
+#define _F_thread_barrier_fullss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of f_thread_barrier_fulls_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_barrier_fulls_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_barrier_fullss_t_
+ typedef struct {
+ f_thread_barrier_fulls_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_barrier_fullss_t;
+
+ #define f_thread_barrier_fullss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_barrier_fullss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_barrier_fullss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_barrier_fullss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_fullss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a barrier is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_barrier_destroy()
+ * @see pthread_barrierattr_destroy()
+ */
+#ifndef _di_f_thread_barrier_fullss_delete_callback_
+ extern f_status_t f_thread_barrier_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrier_fullss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_fullss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a barrier is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_barrier_destroy()
+ * @see pthread_barrierattr_destroy()
+ */
+#ifndef _di_f_thread_barrier_fullss_destroy_callback_
+ extern f_status_t f_thread_barrier_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrier_fullss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_barrier_fullss_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_barriers_delete_callback_
+ f_status_t f_thread_barriers_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_t * const array = (f_thread_barrier_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_barrier_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barriers_delete_callback_
+
+#ifndef _di_f_thread_barriers_destroy_callback_
+ f_status_t f_thread_barriers_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barrier_t * const array = (f_thread_barrier_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_barrier_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barriers_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_barriers_h
+#define _F_thread_barriers_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of f_thread_barrier_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_barrier_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_barriers_t_
+ typedef struct {
+ f_thread_barrier_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_barriers_t;
+
+ #define f_thread_barriers_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_barriers_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_barriers_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_barriers_t_
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barriers_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a barrier is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_barrier_destroy()
+ */
+#ifndef _di_f_thread_barriers_delete_callback_
+ extern f_status_t f_thread_barriers_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barriers_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barriers_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a barrier is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_barrier_destroy()
+ */
+#ifndef _di_f_thread_barriers_destroy_callback_
+ extern f_status_t f_thread_barriers_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barriers_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_barriers_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_barrierss_delete_callback_
+ f_status_t f_thread_barrierss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barriers_t * const array = (f_thread_barriers_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_barrier_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrierss_delete_callback_
+
+#ifndef _di_f_thread_barrierss_destroy_callback_
+ f_status_t f_thread_barrierss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_barriers_t * const array = (f_thread_barriers_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_barrier_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_barrierss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_barrierss_h
+#define _F_thread_barrierss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of f_thread_barriers_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_barriers_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_barrierss_t_
+ typedef struct {
+ f_thread_barriers_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_barrierss_t;
+
+ #define f_thread_barrierss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_barrierss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_barrierss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_barrierss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrierss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a barrier is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_barrier_destroy()
+ */
+#ifndef _di_f_thread_barrierss_delete_callback_
+ extern f_status_t f_thread_barrierss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrierss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrierss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a barrier is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_barrier_destroy()
+ */
+#ifndef _di_f_thread_barrierss_destroy_callback_
+ extern f_status_t f_thread_barrierss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_barrierss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_barrierss_h
#include "../thread.h"
-#include "condition.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_conditions_delete_callback_
- f_status_t f_thread_conditions_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_condition_create_
+ f_status_t f_thread_condition_create(const f_thread_condition_attribute_t * const attribute, f_thread_condition_t * const condition) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!condition) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_condition_t * const array = (f_thread_condition_t *) void_array;
- int error = 0;
+ const int error = pthread_cond_init(condition, attribute);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
- error = pthread_cond_destroy(&array[i]);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_conditions_delete_callback_
-
-#ifndef _di_f_thread_conditions_destroy_callback_
- f_status_t f_thread_conditions_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_condition_create_
- {
- f_thread_condition_t * const array = (f_thread_condition_t *) void_array;
- int error = 0;
+#ifndef _di_f_thread_condition_delete_
+ f_status_t f_thread_condition_delete(f_thread_condition_t * const condition) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!condition) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_cond_destroy(condition);
- error = pthread_cond_destroy(&array[i]);
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_conditions_destroy_callback_
+#endif // _di_f_thread_condition_delete_
+
+#ifndef _di_f_thread_condition_signal_
+ f_status_t f_thread_condition_signal(f_thread_condition_t * const condition) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!condition) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_conditionss_delete_callback_
- f_status_t f_thread_conditionss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ const int error = pthread_cond_signal(condition);
- {
- f_thread_conditions_t * const array = (f_thread_conditions_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return F_status_set_error(F_failure);
+ }
- for (j = 0; j < array[i].size; ++j) {
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_signal_
- error = pthread_cond_destroy(&array[i].array[j]);
+#ifndef _di_f_thread_condition_signal_all_
+ f_status_t f_thread_condition_signal_all(f_thread_condition_t * const condition) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!condition) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ const int error = pthread_cond_broadcast(condition);
- return F_status_set_error(F_failure);
- }
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_conditionss_delete_callback_
+#endif // _di_f_thread_condition_signal_all_
+
+#ifndef _di_f_thread_condition_wait_
+ f_status_t f_thread_condition_wait(f_thread_condition_t * const condition, f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!condition) return F_status_set_error(F_parameter);
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_conditionss_destroy_callback_
- f_status_t f_thread_conditionss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ const int error = pthread_cond_wait(condition, mutex);
- {
- f_thread_conditions_t * const array = (f_thread_conditions_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
+ if (error == EOWNERDEAD) return F_status_set_error(F_dead);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return F_status_set_error(F_failure);
+ }
- for (j = 0; j < array[i].size; ++j) {
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_wait_
- error = pthread_cond_destroy(&array[i].array[j]);
+#ifndef _di_f_thread_condition_wait_timed_
+ f_status_t f_thread_condition_wait_timed(const f_time_spec_t * const wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!condition) return F_status_set_error(F_parameter);
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ const int error = pthread_cond_timedwait(condition, mutex, wait);
- return F_status_set_error(F_failure);
- }
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
+ if (error == EOWNERDEAD) return F_status_set_error(F_dead);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+ if (error == ETIMEDOUT) return F_time;
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_conditionss_destroy_callback_
+#endif // _di_f_thread_condition_wait_timed_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_condition_t_
/**
- * An array of thread conditions.
+ * Initialize a condition.
*
- * Properties:
- * - array: The array of f_thread_condition_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * @param attribute
+ * (optional) The attribute to set.
+ * Set to NULL to not use (in which case the default attribute is used).
+ * @param condition
+ * The condition to wait on.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_cond_init()
*/
-#ifndef _di_f_thread_conditions_t_
- typedef struct {
- f_thread_condition_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_conditions_t;
-
- #define f_thread_conditions_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_conditions_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_conditions_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_conditions_t_
+#ifndef _di_f_thread_condition_create_
+ extern f_status_t f_thread_condition_create(const f_thread_condition_attribute_t * const attribute, f_thread_condition_t * const condition);
+#endif // _di_f_thread_condition_create_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_conditions_t structure.
+ * Delete a thread condition.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * The pthread_cond_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param condition
+ * The condition to delete.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a condition is busy.
+ * F_busy (with error bit) if the condition is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * F_failure (with error bit) on any other error.
*
* @see pthread_cond_destroy()
*/
-#ifndef _di_f_thread_conditions_delete_callback_
- extern f_status_t f_thread_conditions_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_conditions_delete_callback_
+#ifndef _di_f_thread_condition_delete_
+ extern f_status_t f_thread_condition_delete(f_thread_condition_t * const condition);
+#endif // _di_f_thread_condition_delete_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_conditions_t structure.
+ * Signal a thread waiting on a condition.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Only a single thread waiting on this condition is signaled.
*
- * This does not do parameter checking.
+ * @param condition
+ * The condition to broadcast the unblock signal to.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @return
+ * F_okay on success.
*
- * Must not be NULL.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_cond_signal()
+ */
+#ifndef _di_f_thread_condition_signal_
+ extern f_status_t f_thread_condition_signal(f_thread_condition_t * const condition);
+#endif // _di_f_thread_condition_signal_
+
+/**
+ * Signal all threads waiting on a condition.
+ *
+ * @param condition
+ * The condition to broadcast the unblock signal to.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a condition is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- *
- * @see pthread_cond_destroy()
+ * @see pthread_cond_broadcast()
*/
-#ifndef _di_f_thread_conditions_destroy_callback_
- extern f_status_t f_thread_conditions_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_conditions_destroy_callback_
+#ifndef _di_f_thread_condition_signal_all_
+ extern f_status_t f_thread_condition_signal_all(f_thread_condition_t * const condition);
+#endif // _di_f_thread_condition_signal_all_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_conditionss_t structure.
+ * Wait until condition is triggered.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * This is a blocking operation.
*
- * This does not do parameter checking.
+ * The caller must lock the mutex before calling this.
+ * The caller should unlock the mutex after calling this.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
+ * @param condition
+ * The condition to wait on.
+ * @param mutex
+ * The mutex to use for waiting on condition.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a condition is busy.
+ * 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.
+ * F_prohibited (with error bit) if not allowed to perform the operation (possibly because mutex is not owned by current thread).
+ * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_cond_destroy()
+ * @see pthread_cond_wait()
*/
-#ifndef _di_f_thread_conditionss_delete_callback_
- extern f_status_t f_thread_conditionss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_conditionss_delete_callback_
+#ifndef _di_f_thread_condition_wait_
+ extern f_status_t f_thread_condition_wait(f_thread_condition_t * const condition, f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_condition_wait_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_conditionss_t structure.
+ * Wait until condition is triggered, blocking until the timeout expires.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * This is a semi-blocking operation.
+ * This blocks until timeout and then no longer block.
*
- * This does not do parameter checking.
+ * The caller must lock the mutex before calling this.
+ * The caller should unlock the mutex after calling this.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param wait
+ * The amount of time to wait for.
+ * The wait time is relative to the clock, so consider calling clock_gettime() or gettimeofday() and then adding the amount of wait time.
+ * @param condition
+ * The condition to wait on.
+ *
+ * Must not be NULL.
+ * @param mutex
+ * The mutex to use for waiting on condition.
*
* Must not be NULL.
*
* @return
* F_okay on success.
+ * F_time on success, and wait timeout was reached before condition was triggered.
*
- * F_busy (with error bit) if a condition is busy.
+ * 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.
+ * F_prohibited (with error bit) if not allowed to perform the operation (possibly because mutex is not owned by current thread).
+ * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- *
- * @see pthread_cond_destroy()
+ * @see pthread_cond_timedwait()
*/
-#ifndef _di_f_thread_conditionss_destroy_callback_
- extern f_status_t f_thread_conditionss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_conditionss_destroy_callback_
+#ifndef _di_f_thread_condition_wait_timed_
+ extern f_status_t f_thread_condition_wait_timed(const f_time_spec_t * const wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_condition_wait_timed_
#ifdef __cplusplus
} // extern "C"
#include "../thread.h"
-#include "condition_attribute.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_condition_attributes_delete_callback_
- f_status_t f_thread_condition_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_condition_attribute_clock_get_
+ f_status_t f_thread_condition_attribute_clock_get(const f_thread_condition_attribute_t * const attribute, clockid_t * const id) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!id) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- f_thread_condition_attribute_t * const array = (f_thread_condition_attribute_t *) void_array;
+ const int error = pthread_condattr_getclock(attribute, id);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_condattr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_condition_attributes_delete_callback_
+#endif // _di_f_thread_condition_attribute_clock_get_
+
+#ifndef _di_f_thread_condition_attribute_clock_set_
+ f_status_t f_thread_condition_attribute_clock_set(const clockid_t id, f_thread_condition_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_condition_attributes_destroy_callback_
- f_status_t f_thread_condition_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ const int error = pthread_condattr_setclock(attribute, id);
- f_thread_condition_attribute_t * const array = (f_thread_condition_attribute_t *) void_array;
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_condattr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_condition_attributes_destroy_callback_
-
-#ifndef _di_f_thread_condition_attributess_delete_callback_
- f_status_t f_thread_condition_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_condition_attribute_clock_set_
- f_thread_condition_attributes_t * const array = (f_thread_condition_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_condition_attribute_create_
+ f_status_t f_thread_condition_attribute_create(f_thread_condition_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_condattr_init(attribute);
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_condattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_condition_attributess_delete_callback_
+#endif // _di_f_thread_condition_attribute_create_
+
+#ifndef _di_f_thread_condition_attribute_delete_
+ f_status_t f_thread_condition_attribute_delete(f_thread_condition_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return pthread_condattr_destroy(attribute) ? F_status_set_error(F_failure) : F_okay;
+ }
+#endif // _di_f_thread_condition_attribute_delete_
-#ifndef _di_f_thread_condition_attributess_destroy_callback_
- f_status_t f_thread_condition_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_condition_attribute_shared_get_
+ f_status_t f_thread_condition_attribute_shared_get(const f_thread_condition_attribute_t * const attribute, int * const shared) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!shared) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_condattr_getpshared(attribute, shared);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_attribute_shared_get_
- f_thread_condition_attributes_t * const array = (f_thread_condition_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_condition_attribute_shared_set_
+ f_status_t f_thread_condition_attribute_shared_set(const int shared, f_thread_condition_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_condattr_setpshared(attribute, shared);
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_condattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_condition_attributess_destroy_callback_
+#endif // _di_f_thread_condition_attribute_shared_set_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_condition_attribute_t_
/**
- * An array of thread condition attributes.
+ * Get the clock selection thread condition attribute.
*
- * Properties:
- * - array: The array of f_thread_condition_attribute_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * @param attribute
+ * The thread condition attribute.
+ *
+ * Must not be NULL.
+ * @param id
+ * The clock ID.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_condattr_getclock()
*/
-#ifndef _di_f_thread_condition_attributes_t_
- typedef struct {
- f_thread_condition_attribute_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_condition_attributes_t;
-
- #define f_thread_condition_attributes_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_condition_attributes_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_condition_attributes_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_condition_attributes_t_
+#ifndef _di_f_thread_condition_attribute_clock_get_
+ extern f_status_t f_thread_condition_attribute_clock_get(const f_thread_condition_attribute_t * const attribute, clockid_t * const id);
+#endif // _di_f_thread_condition_attribute_clock_get_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_attributes_t structure.
+ * Set the clock selection thread condition attribute.
*
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param id
+ * The clock ID.
+ * @param attribute
+ * The thread condition attribute.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_condattr_setclock()
*/
-#ifndef _di_f_thread_condition_attributes_delete_callback_
- extern f_status_t f_thread_condition_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_condition_attributes_delete_callback_
+#ifndef _di_f_thread_condition_attribute_clock_set_
+ extern f_status_t f_thread_condition_attribute_clock_set(const clockid_t id, f_thread_condition_attribute_t * const attribute);
+#endif // _di_f_thread_condition_attribute_clock_set_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_attributes_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
+ * Initialize a attribute.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param attribute
+ * The attribute to set.
+ * This assigns the default to the attribute.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_condattr_init()
*/
-#ifndef _di_f_thread_condition_attributes_destroy_callback_
- extern f_status_t f_thread_condition_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_condition_attributes_destroy_callback_
+#ifndef _di_f_thread_condition_attribute_create_
+ extern f_status_t f_thread_condition_attribute_create(f_thread_condition_attribute_t * const attribute);
+#endif // _di_f_thread_condition_attribute_create_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_attributess_t structure.
+ * Delete a thread condition attribute.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * The pthread_condattr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param attribute
+ * The attribute to delete.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_condattr_destroy()
*/
-#ifndef _di_f_thread_condition_attributess_delete_callback_
- extern f_status_t f_thread_condition_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_condition_attributess_delete_callback_
+#ifndef _di_f_thread_condition_attribute_delete_
+ extern f_status_t f_thread_condition_attribute_delete(f_thread_condition_attribute_t * const attribute);
+#endif // _di_f_thread_condition_attribute_delete_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_attributess_t structure.
+ * Get the process shared thread condition attribute.
+ *
+ * @param attribute
+ * The thread condition attribute.
+ * @param shared
+ * The process shared attribute value.
+ *
+ * @return
+ * F_okay on success.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * F_parameter (with error bit) if a parameter is invalid.
*
- * This does not do parameter checking.
+ * F_failure (with error bit) on any other error.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @see pthread_condattr_getpshared()
+ */
+#ifndef _di_f_thread_condition_attribute_shared_get_
+ extern f_status_t f_thread_condition_attribute_shared_get(const f_thread_condition_attribute_t * const attribute, int * const shared);
+#endif // _di_f_thread_condition_attribute_shared_get_
+
+/**
+ * Set the process shared thread condition attribute.
*
- * Must not be NULL.
+ * @param shared
+ * The process shared attribute value.
+ * @param attribute
+ * The thread condition attribute.
*
* @return
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_condattr_setpshared()
*/
-#ifndef _di_f_thread_condition_attributess_destroy_callback_
- extern f_status_t f_thread_condition_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_condition_attributess_destroy_callback_
+#ifndef _di_f_thread_condition_attribute_shared_set_
+ extern f_status_t f_thread_condition_attribute_shared_set(const int shared, f_thread_condition_attribute_t * const attribute);
+#endif // _di_f_thread_condition_attribute_shared_set_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_condition_attributes_delete_callback_
+ f_status_t f_thread_condition_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_attribute_t * const array = (f_thread_condition_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_condattr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_attributes_delete_callback_
+
+#ifndef _di_f_thread_condition_attributes_destroy_callback_
+ f_status_t f_thread_condition_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_attribute_t * const array = (f_thread_condition_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_condattr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_condition_attributes_h
+#define _F_thread_condition_attributes_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread condition attributes.
+ *
+ * Properties:
+ * - array: The array of f_thread_condition_attribute_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_condition_attributes_t_
+ typedef struct {
+ f_thread_condition_attribute_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_condition_attributes_t;
+
+ #define f_thread_condition_attributes_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_condition_attributes_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_condition_attributes_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_condition_attributes_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_condition_attributes_delete_callback_
+ extern f_status_t f_thread_condition_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_condition_attributes_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_condition_attributes_destroy_callback_
+ extern f_status_t f_thread_condition_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_condition_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_condition_attributes_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_condition_attributess_delete_callback_
+ f_status_t f_thread_condition_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_attributes_t * const array = (f_thread_condition_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_condattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_attributess_delete_callback_
+
+#ifndef _di_f_thread_condition_attributess_destroy_callback_
+ f_status_t f_thread_condition_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_attributes_t * const array = (f_thread_condition_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_condattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_condition_attributess_h
+#define _F_thread_condition_attributess_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread condition attributes.
+ *
+ * Properties:
+ * - array: The array of f_thread_condition_attributes_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_condition_attributess_t_
+ typedef struct {
+ f_thread_condition_attributes_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_condition_attributess_t;
+
+ #define f_thread_condition_attributess_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_condition_attributess_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_condition_attributess_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_condition_attributess_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_condition_attributess_delete_callback_
+ extern f_status_t f_thread_condition_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_condition_attributess_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_condition_attributess_destroy_callback_
+ extern f_status_t f_thread_condition_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_condition_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_condition_attributess_h
#include "../thread.h"
-#include "condition_full.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_condition_fulls_delete_callback_
- f_status_t f_thread_condition_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_condition_full_delete_
+ f_status_t f_thread_condition_full_delete(f_thread_condition_full_t * const full) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!full) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- f_thread_condition_full_t * const array = (f_thread_condition_full_t *) void_array;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- error = pthread_cond_destroy(&array[i].condition);
+ {
+ const int error = pthread_cond_destroy(&full->condition);
if (error) {
if (error == EBUSY) return F_status_set_error(F_busy);
return F_status_set_error(F_failure);
}
+ }
- if (pthread_condattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_fulls_delete_callback_
-
-#ifndef _di_f_thread_condition_fulls_destroy_callback_
- f_status_t f_thread_condition_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_condition_full_t * const array = (f_thread_condition_full_t *) void_array;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- error = pthread_cond_destroy(&array[i].condition);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_condattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_fulls_destroy_callback_
-
-#ifndef _di_f_thread_condition_fullss_delete_callback_
- f_status_t f_thread_condition_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_condition_fulls_t * const array = (f_thread_condition_fulls_t *) void_array;
- f_number_unsigned_t j = 0;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_cond_destroy(&array[i].array[j].condition);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_condattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_condition_fullss_delete_callback_
-
-#ifndef _di_f_thread_condition_fullss_destroy_callback_
- f_status_t f_thread_condition_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_condition_fulls_t * const array = (f_thread_condition_fulls_t *) void_array;
- f_number_unsigned_t j = 0;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_cond_destroy(&array[i].array[j].condition);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_condattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
+ return pthread_condattr_destroy(&full->attribute) ? F_status_set_error(F_failure) : F_okay;
}
-#endif // _di_f_thread_condition_fullss_destroy_callback_
+#endif // _di_f_thread_condition_full_delete_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_condition_full_t_
/**
- * An array of f_thread_condition_full_t.
+ * Delete a thread condition full.
*
- * Properties:
- * - array: The array of f_thread_condition_full_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_condition_fulls_t_
- typedef struct {
- f_thread_condition_full_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_condition_fulls_t;
-
- #define f_thread_condition_fulls_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_condition_fulls_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_condition_fulls_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_condition_fulls_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_fulls_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * The pthread_condattr_destroy() and pthread_condattr_destroy() functions have no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param full
+ * The full to delete.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a condition is busy.
+ * F_busy (with error bit) if the full is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_cond_destroy()
- * @see pthread_condattr_destroy()
- */
-#ifndef _di_f_thread_condition_fulls_delete_callback_
- extern f_status_t f_thread_condition_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_condition_fulls_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_fulls_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a condition is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- *
- * @see pthread_cond_destroy()
- * @see pthread_condattr_destroy()
- */
-#ifndef _di_f_thread_condition_fulls_destroy_callback_
- extern f_status_t f_thread_condition_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_condition_fulls_destroy_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_fullss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a condition is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_cond_destroy()
- * @see pthread_condattr_destroy()
- */
-#ifndef _di_f_thread_condition_fullss_delete_callback_
- extern f_status_t f_thread_condition_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_condition_fullss_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_fullss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a condition is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * F_failure (with error bit) on any other error.
*
* @see pthread_cond_destroy()
* @see pthread_condattr_destroy()
*/
-#ifndef _di_f_thread_condition_fullss_destroy_callback_
- extern f_status_t f_thread_condition_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_condition_fullss_destroy_callback_
+#ifndef _di_f_thread_condition_full_delete_
+ extern f_status_t f_thread_condition_full_delete(f_thread_condition_full_t * const full);
+#endif // _di_f_thread_condition_full_delete_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_condition_fulls_delete_callback_
+ f_status_t f_thread_condition_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_full_t * const array = (f_thread_condition_full_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_cond_destroy(&array[i].condition);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_condattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_fulls_delete_callback_
+
+#ifndef _di_f_thread_condition_fulls_destroy_callback_
+ f_status_t f_thread_condition_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_full_t * const array = (f_thread_condition_full_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_cond_destroy(&array[i].condition);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_condattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_fulls_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_condition_fulls_h
+#define _F_thread_condition_fulls_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of f_thread_condition_full_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_condition_full_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_condition_fulls_t_
+ typedef struct {
+ f_thread_condition_full_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_condition_fulls_t;
+
+ #define f_thread_condition_fulls_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_condition_fulls_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_condition_fulls_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_condition_fulls_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_fulls_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a condition is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_cond_destroy()
+ * @see pthread_condattr_destroy()
+ */
+#ifndef _di_f_thread_condition_fulls_delete_callback_
+ extern f_status_t f_thread_condition_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_condition_fulls_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_fulls_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a condition is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_cond_destroy()
+ * @see pthread_condattr_destroy()
+ */
+#ifndef _di_f_thread_condition_fulls_destroy_callback_
+ extern f_status_t f_thread_condition_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_condition_fulls_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_condition_fulls_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_condition_fullss_delete_callback_
+ f_status_t f_thread_condition_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_fulls_t * const array = (f_thread_condition_fulls_t *) void_array;
+ f_number_unsigned_t j = 0;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_cond_destroy(&array[i].array[j].condition);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_condattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_fullss_delete_callback_
+
+#ifndef _di_f_thread_condition_fullss_destroy_callback_
+ f_status_t f_thread_condition_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_fulls_t * const array = (f_thread_condition_fulls_t *) void_array;
+ f_number_unsigned_t j = 0;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_cond_destroy(&array[i].array[j].condition);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_condattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_condition_fullss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_condition_fullss_h
+#define _F_thread_condition_fullss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of f_thread_condition_fulls_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_condition_fulls_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_condition_fullss_t_
+ typedef struct {
+ f_thread_condition_fulls_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_condition_fullss_t;
+
+ #define f_thread_condition_fullss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_condition_fullss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_condition_fullss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_condition_fullss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_fullss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a condition is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_cond_destroy()
+ * @see pthread_condattr_destroy()
+ */
+#ifndef _di_f_thread_condition_fullss_delete_callback_
+ extern f_status_t f_thread_condition_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_condition_fullss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_fullss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a condition is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_cond_destroy()
+ * @see pthread_condattr_destroy()
+ */
+#ifndef _di_f_thread_condition_fullss_destroy_callback_
+ extern f_status_t f_thread_condition_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_condition_fullss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_condition_fullss_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_conditions_delete_callback_
+ f_status_t f_thread_conditions_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_t * const array = (f_thread_condition_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_cond_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_conditions_delete_callback_
+
+#ifndef _di_f_thread_conditions_destroy_callback_
+ f_status_t f_thread_conditions_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_condition_t * const array = (f_thread_condition_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_cond_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_conditions_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_conditions_h
+#define _F_thread_conditions_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread conditions.
+ *
+ * Properties:
+ * - array: The array of f_thread_condition_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_conditions_t_
+ typedef struct {
+ f_thread_condition_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_conditions_t;
+
+ #define f_thread_conditions_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_conditions_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_conditions_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_conditions_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_conditions_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a condition is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_cond_destroy()
+ */
+#ifndef _di_f_thread_conditions_delete_callback_
+ extern f_status_t f_thread_conditions_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_conditions_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_conditions_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a condition is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_cond_destroy()
+ */
+#ifndef _di_f_thread_conditions_destroy_callback_
+ extern f_status_t f_thread_conditions_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_conditions_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_conditions_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_conditionss_delete_callback_
+ f_status_t f_thread_conditionss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_conditions_t * const array = (f_thread_conditions_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_cond_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_conditionss_delete_callback_
+
+#ifndef _di_f_thread_conditionss_destroy_callback_
+ f_status_t f_thread_conditionss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_conditions_t * const array = (f_thread_conditions_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_cond_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_conditionss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_conditionss_h
+#define _F_thread_conditionss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread conditions.
+ *
+ * Properties:
+ * - array: The array of f_thread_conditions_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_conditionss_t_
+ typedef struct {
+ f_thread_conditions_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_conditionss_t;
+
+ #define f_thread_conditionss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_conditionss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_conditionss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_conditionss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_conditionss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a condition is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_cond_destroy()
+ */
+#ifndef _di_f_thread_conditionss_delete_callback_
+ extern f_status_t f_thread_conditionss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_conditionss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_conditionss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a condition is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_cond_destroy()
+ */
+#ifndef _di_f_thread_conditionss_destroy_callback_
+ extern f_status_t f_thread_conditionss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_conditionss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_conditionss_h
#include "../thread.h"
-#include "id.h"
#ifdef __cplusplus
extern "C" {
#define macro_f_thread_id_t_clear(id) id = 0;
#endif // _di_f_thread_id_t_
-/**
- * An array of thread IDs.
- *
- * Properties:
- * - array: The array of f_thread_id_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_ids_t_
- typedef struct {
- f_thread_id_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_ids_t;
-
- #define f_thread_ids_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_ids_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_ids_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_ids_t_
-
#ifdef __cplusplus
} // extern "C"
#endif
--- /dev/null
+#include "../thread.h"
+#include "id.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_ids_delete_callback_
+ f_status_t f_thread_ids_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_id_t * const array = (f_thread_id_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ array[i] = 0;
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_ids_delete_callback_
+
+#ifndef _di_f_thread_ids_destroy_callback_
+ f_status_t f_thread_ids_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_id_t * const array = (f_thread_id_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ array[i] = 0;
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_ids_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_ids_h
+#define _F_thread_ids_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread IDs.
+ *
+ * Properties:
+ * - array: The array of f_thread_id_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_ids_t_
+ typedef struct {
+ f_thread_id_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_ids_t;
+
+ #define f_thread_ids_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_ids_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_ids_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_ids_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_ids_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_ids_delete_callback_
+ extern f_status_t f_thread_ids_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_ids_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_ids_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_ids_destroy_callback_
+ extern f_status_t f_thread_ids_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_ids_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_ids_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_idss_delete_callback_
+ f_status_t f_thread_idss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_ids_t * const array = (f_thread_ids_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ array[i].array[j] = 0;
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_id_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_idss_delete_callback_
+
+#ifndef _di_f_thread_idss_destroy_callback_
+ f_status_t f_thread_idss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_ids_t * const array = (f_thread_ids_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ array[i].array[j] = 0;
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_id_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_idss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_idss_h
+#define _F_thread_idss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread IDs.
+ *
+ * Properties:
+ * - array: The array of f_thread_ids_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_idss_t_
+ typedef struct {
+ f_thread_ids_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_idss_t;
+
+ #define f_thread_idss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_idss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_idss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_idss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_idss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_idss_delete_callback_
+ extern f_status_t f_thread_idss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_idss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_idss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_idss_destroy_callback_
+ extern f_status_t f_thread_idss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_idss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_idss_h
#include "../thread.h"
-#include "key.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_keys_delete_callback_
- f_status_t f_thread_keys_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_key_create_
+ f_status_t f_thread_key_create(void (*routine) (void *), f_thread_key_t * const key) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!routine) return F_status_set_error(F_parameter);
+ if (!key) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_key_t * const array = (f_thread_key_t *) void_array;
+ const int error = pthread_key_create(key, routine);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
- if (pthread_key_delete(array[i])) return F_status_set_error(F_failure);
-
- array[i] = 0;
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_keys_delete_callback_
-
-#ifndef _di_f_thread_keys_destroy_callback_
- f_status_t f_thread_keys_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_key_create_
- {
- f_thread_key_t * const array = (f_thread_key_t *) void_array;
+#ifndef _di_f_thread_key_delete_
+ f_status_t f_thread_key_delete(f_thread_key_t * const key) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!key) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_key_delete(*key)) return F_status_set_error(F_failure);
- if (pthread_key_delete(array[i])) return F_status_set_error(F_failure);
-
- array[i] = 0;
- } // for
- }
+ *key = 0;
return F_okay;
}
-#endif // _di_f_thread_keys_destroy_callback_
-
-#ifndef _di_f_thread_keyss_delete_callback_
- f_status_t f_thread_keyss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_keys_t * const array = (f_thread_keys_t *) void_array;
- f_number_unsigned_t j = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+#endif // _di_f_thread_key_delete_
- for (j = 0; j < array[i].size; ++j) {
+#ifndef _di_f_thread_key_get_
+ f_status_t f_thread_key_get(const f_thread_key_t key, void ** const value) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!value) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (pthread_key_delete(array[i].array[j])) return F_status_set_error(F_failure);
-
- array[i].array[j] = 0;
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_key_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
- }
+ *value = pthread_getspecific(key);
return F_okay;
}
-#endif // _di_f_thread_keyss_delete_callback_
-
-#ifndef _di_f_thread_keyss_destroy_callback_
- f_status_t f_thread_keyss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_keys_t * const array = (f_thread_keys_t *) void_array;
- f_number_unsigned_t j = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+#endif // _di_f_thread_key_get_
- for (j = 0; j < array[i].size; ++j) {
+#ifndef _di_f_thread_key_set_
+ f_status_t f_thread_key_set(const f_thread_key_t key, const void * const value) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!value) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (pthread_key_delete(array[i].array[j])) return F_status_set_error(F_failure);
+ const int error = pthread_setspecific(key, value);
- array[i].array[j] = 0;
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_key_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_keyss_destroy_callback_
+#endif // _di_f_thread_key_set_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_key_t_
/**
- * An array of thread keys.
+ * Create a thread key.
*
- * Properties:
- * - array: The array of f_thread_key_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_keys_t_
- typedef struct {
- f_thread_key_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_keys_t;
-
- #define f_thread_keys_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_keys_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_keys_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_keys_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_keys_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
+ * @param routine
+ * The function to execute for deallocation/deleting.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * Must not be NULL.
+ * @param key
+ * The thread key.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
+ * F_memory_not (with error bit) if out of memory.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to set the scheduling policy and parameters specified in attribute.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_key_create()
*/
-#ifndef _di_f_thread_keys_delete_callback_
- extern f_status_t f_thread_keys_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_keys_delete_callback_
+#ifndef _di_f_thread_key_create_
+ extern f_status_t f_thread_key_create(void (*routine) (void *), f_thread_key_t * const key);
+#endif // _di_f_thread_key_create_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_keys_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Delete a thread key.
*
- * This does not do parameter checking.
+ * The pthread_key_delete() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param key
+ * The key to delete.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_key_delete()
*/
-#ifndef _di_f_thread_keys_destroy_callback_
- extern f_status_t f_thread_keys_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_keys_destroy_callback_
+#ifndef _di_f_thread_key_delete_
+ extern f_status_t f_thread_key_delete(f_thread_key_t * const key);
+#endif // _di_f_thread_key_delete_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_keyss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
+ * Get the value of a thread key.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param key
+ * The thread key.
+ * @param value
+ * The assigned thread key value.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_getspecific()
*/
-#ifndef _di_f_thread_keyss_delete_callback_
- extern f_status_t f_thread_keyss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_keyss_delete_callback_
+#ifndef _di_f_thread_key_get_
+ extern f_status_t f_thread_key_get(const f_thread_key_t key, void ** const value);
+#endif // _di_f_thread_key_get_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_keyss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
+ * Get the value of a thread key.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param key
+ * The thread key.
+ * @param value
+ * The thread key value to assign.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_setspecific()
*/
-#ifndef _di_f_thread_keyss_destroy_callback_
- extern f_status_t f_thread_keyss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_keyss_destroy_callback_
+#ifndef _di_f_thread_key_set_
+ extern f_status_t f_thread_key_set(const f_thread_key_t key, const void * const value);
+#endif // _di_f_thread_key_set_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_keys_delete_callback_
+ f_status_t f_thread_keys_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_key_t * const array = (f_thread_key_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ if (pthread_key_delete(array[i])) return F_status_set_error(F_failure);
+
+ array[i] = 0;
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_keys_delete_callback_
+
+#ifndef _di_f_thread_keys_destroy_callback_
+ f_status_t f_thread_keys_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_key_t * const array = (f_thread_key_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ if (pthread_key_delete(array[i])) return F_status_set_error(F_failure);
+
+ array[i] = 0;
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_keys_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_keys_h
+#define _F_thread_keys_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread keys.
+ *
+ * Properties:
+ * - array: The array of f_thread_key_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_keys_t_
+ typedef struct {
+ f_thread_key_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_keys_t;
+
+ #define f_thread_keys_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_keys_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_keys_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_keys_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_keys_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_keys_delete_callback_
+ extern f_status_t f_thread_keys_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_keys_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_keys_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_keys_destroy_callback_
+ extern f_status_t f_thread_keys_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_keys_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_keys_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_keyss_delete_callback_
+ f_status_t f_thread_keyss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_keys_t * const array = (f_thread_keys_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ if (pthread_key_delete(array[i].array[j])) return F_status_set_error(F_failure);
+
+ array[i].array[j] = 0;
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_key_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_keyss_delete_callback_
+
+#ifndef _di_f_thread_keyss_destroy_callback_
+ f_status_t f_thread_keyss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_keys_t * const array = (f_thread_keys_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ if (pthread_key_delete(array[i].array[j])) return F_status_set_error(F_failure);
+
+ array[i].array[j] = 0;
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_key_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_keyss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_keyss_h
+#define _F_thread_keyss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread keys.
+ *
+ * Properties:
+ * - array: The array of f_thread_keys_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_keyss_t_
+ typedef struct {
+ f_thread_keys_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_keyss_t;
+
+ #define f_thread_keyss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_keyss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_keyss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_keyss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_keyss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_keyss_delete_callback_
+ extern f_status_t f_thread_keyss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_keyss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_keyss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_keyss_destroy_callback_
+ extern f_status_t f_thread_keyss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_keyss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_keyss_h
#include "../thread.h"
-#include "lock.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_locks_delete_callback_
- f_status_t f_thread_locks_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_lock_create_
+ f_status_t f_thread_lock_create(const f_thread_lock_attribute_t * const attribute, f_thread_lock_t * const lock) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!lock) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_lock_t * const array = (f_thread_lock_t *) void_array;
- int error = 0;
+ const int error = pthread_rwlock_init(lock, attribute);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
- error = pthread_rwlock_destroy(&array[i]);
+ return F_status_set_error(F_failure);
+ }
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_create_
+
+#ifndef _di_f_thread_lock_delete_
+ f_status_t f_thread_lock_delete(f_thread_lock_t * const lock) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!lock) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ {
+ const int error = pthread_rwlock_destroy(lock);
- return F_status_set_error(F_failure);
- }
- } // for
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
}
return F_okay;
}
-#endif // _di_f_thread_locks_delete_callback_
+#endif // _di_f_thread_lock_delete_
-#ifndef _di_f_thread_locks_destroy_callback_
- f_status_t f_thread_locks_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_lock_read_
+ f_status_t f_thread_lock_read(f_thread_lock_t * const lock) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!lock) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_lock_t * const array = (f_thread_lock_t *) void_array;
- int error = 0;
+ const int error = pthread_rwlock_rdlock(lock);
+
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return F_status_set_error(F_failure);
+ }
- error = pthread_rwlock_destroy(&array[i]);
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_read_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+#ifndef _di_f_thread_lock_read_timed_
+ f_status_t f_thread_lock_read_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!timeout) return F_status_set_error(F_parameter);
+ if (!lock) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- return F_status_set_error(F_failure);
- }
- } // for
+ const int error = pthread_rwlock_timedrdlock(lock, timeout);
+
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ETIMEDOUT) return F_time;
+
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_locks_destroy_callback_
+#endif // _di_f_thread_lock_read_timed_
-#ifndef _di_f_thread_lockss_delete_callback_
- f_status_t f_thread_lockss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_lock_read_try_
+ f_status_t f_thread_lock_read_try(f_thread_lock_t * const lock) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!lock) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_locks_t * const array = (f_thread_locks_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+ const int error = pthread_rwlock_tryrdlock(lock);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_busy;
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- for (j = 0; j < array[i].size; ++j) {
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_read_try_
- error = pthread_rwlock_destroy(&array[i].array[j]);
+#ifndef _di_f_thread_lock_write_
+ f_status_t f_thread_lock_write(f_thread_lock_t * const lock) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!lock) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ const int error = pthread_rwlock_wrlock(lock);
- return F_status_set_error(F_failure);
- }
- } // for
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_lockss_delete_callback_
+#endif // _di_f_thread_lock_write_
-#ifndef _di_f_thread_lockss_destroy_callback_
- f_status_t f_thread_lockss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_lock_write_timed_
+ f_status_t f_thread_lock_write_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!timeout) return F_status_set_error(F_parameter);
+ if (!lock) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_locks_t * const array = (f_thread_locks_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+ const int error = pthread_rwlock_timedwrlock(lock, timeout);
+
+ if (error) {
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ETIMEDOUT) return F_time;
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return F_status_set_error(F_failure);
+ }
- for (j = 0; j < array[i].size; ++j) {
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_write_timed_
- error = pthread_rwlock_destroy(&array[i].array[j]);
+#ifndef _di_f_thread_lock_write_try_
+ f_status_t f_thread_lock_write_try(f_thread_lock_t * const lock) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!lock) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ const int error = pthread_rwlock_trywrlock(lock);
- return F_status_set_error(F_failure);
- }
- } // for
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_busy;
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_lockss_destroy_callback_
+#endif // _di_f_thread_lock_write_try_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_lock_t_
/**
- * An array of thread locks.
+ * Create a thread read/write lock.
*
- * Properties:
- * - array: The array of f_thread_lock_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * @param attribute
+ * The lock attribute.
+ *
+ * Must not be NULL.
+ * @param lock
+ * The lock to create.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_memory_not (with error bit) if out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max lockes is reached.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_rwlock_init()
*/
-#ifndef _di_f_thread_locks_t_
- typedef struct {
- f_thread_lock_t *array;
+#ifndef _di_f_thread_lock_create_
+ extern f_status_t f_thread_lock_create(const f_thread_lock_attribute_t * const attribute, f_thread_lock_t * const lock);
+#endif // _di_f_thread_lock_create_
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_locks_t;
-
- #define f_thread_locks_t_initialize { 0, 0, 0 }
+/**
+ * Delete a thread read/write lock.
+ *
+ * The pthread_rwlock_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
+ *
+ * @param lock
+ * The lock to delete.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if the lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_rwlock_destroy()
+ */
+#ifndef _di_f_thread_lock_delete_
+ extern f_status_t f_thread_lock_delete(f_thread_lock_t * const lock);
+#endif // _di_f_thread_lock_delete_
- #define macro_f_thread_locks_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_locks_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_locks_t_
+/**
+ * Lock the read part of a read/write lock.
+ *
+ * This is a blocking function.
+ *
+ * @param lock
+ * The thread lock.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_deadlock (with error bit) if operation would cause a deadlock.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max number of read locks allowed is reached.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_rwlock_rdlock()
+ */
+#ifndef _di_f_thread_lock_read_
+ extern f_status_t f_thread_lock_read(f_thread_lock_t * const lock);
+#endif // _di_f_thread_lock_read_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_locks_t structure.
+ * Lock the read part of a read/write lock, waiting for a set period of time to get the lock if already locked.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * If the read part of the read/write lock is already locked and the timeout expires, then the lock attempt fails.
*
- * This does not do parameter checking.
+ * This is a blocking function (until timeout expires).
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param timeout
+ * The timeout.
+ *
+ * Must not be NULL.
+ * @param lock
+ * The read/write lock.
*
* Must not be NULL.
*
* @return
* F_okay on success.
+ * F_time if the timeout was reached before obtaining the lock.
*
- * F_busy (with error bit) if a lock is busy.
+ * F_deadlock (with error bit) if operation would cause a deadlock.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max number of read locks allowed is reached.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_rwlock_timedrdlock()
*/
-#ifndef _di_f_thread_locks_delete_callback_
- extern f_status_t f_thread_locks_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_locks_delete_callback_
+#ifndef _di_f_thread_lock_read_timed_
+ extern f_status_t f_thread_lock_read_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock);
+#endif // _di_f_thread_lock_read_timed_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_locks_t structure.
+ * Try to lock the read part of a read/write lock.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * If lock is already locked, return immediately.
*
- * This does not do parameter checking.
+ * This is a non-blocking function.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param lock
+ * The thread lock.
*
* Must not be NULL.
*
* @return
* F_okay on success.
+ * F_busy on success, but the lock is already locked.
*
- * F_busy (with error bit) if a lock is busy.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max number of read locks allowed is reached.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_rwlock_tryrdlock()
*/
-#ifndef _di_f_thread_locks_destroy_callback_
- extern f_status_t f_thread_locks_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_locks_destroy_callback_
+#ifndef _di_f_thread_lock_read_try_
+ extern f_status_t f_thread_lock_read_try(f_thread_lock_t * const lock);
+#endif // _di_f_thread_lock_read_try_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lockss_t structure.
+ * Lock the write part of a read/write lock.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * This is a blocking function.
*
- * This does not do parameter checking.
+ * @param lock
+ * The thread lock.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_deadlock (with error bit) if operation would cause a deadlock.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max locks is reached.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_rwlock_wrlock()
+ */
+#ifndef _di_f_thread_lock_write_
+ extern f_status_t f_thread_lock_write(f_thread_lock_t * const lock);
+#endif // _di_f_thread_lock_write_
+
+/**
+ * Lock the write part of a read/write lock, waiting for a set period of time to get the lock if already locked.
+ *
+ * If the write part of the read/write lock is already locked and the timeout expires, then the lock attempt fails.
+ *
+ * This is a blocking function (until timeout expires).
+ *
+ * @param timeout
+ * The timeout.
+ *
+ * Must not be NULL.
+ * @param lock
+ * The read/write lock.
*
* Must not be NULL.
*
* @return
* F_okay on success.
+ * F_time if the timeout was reached before obtaining the lock.
*
- * F_busy (with error bit) if a lock is busy.
+ * F_deadlock (with error bit) if operation would cause a deadlock.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_rwlock_timedwrlock()
*/
-#ifndef _di_f_thread_lockss_delete_callback_
- extern f_status_t f_thread_lockss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lockss_delete_callback_
+#ifndef _di_f_thread_lock_write_timed_
+ extern f_status_t f_thread_lock_write_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock);
+#endif // _di_f_thread_lock_write_timed_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lockss_t structure.
+ * Try to lock the read part of a read/write lock.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * If lock is already locked, return immediately.
*
- * This does not do parameter checking.
+ * This is a non-blocking function.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param lock
+ * The thread lock.
*
* Must not be NULL.
*
* @return
* F_okay on success.
+ * F_busy on success, but the lock is already locked.
*
- * F_busy (with error bit) if a lock is busy.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max locks is reached.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_rwlock_trywrlock()
*/
-#ifndef _di_f_thread_lockss_destroy_callback_
- extern f_status_t f_thread_lockss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lockss_destroy_callback_
+#ifndef _di_f_thread_lock_write_try_
+ extern f_status_t f_thread_lock_write_try(f_thread_lock_t * const lock);
+#endif // _di_f_thread_lock_write_try_
#ifdef __cplusplus
} // extern "C"
#include "../thread.h"
-#include "lock_attribute.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_lock_attributes_delete_callback_
- f_status_t f_thread_lock_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_lock_attribute_create_
+ f_status_t f_thread_lock_attribute_create(f_thread_lock_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- f_thread_lock_attribute_t * const array = (f_thread_lock_attribute_t *) void_array;
+ const int error = pthread_rwlockattr_init(attribute);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_rwlockattr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
- return F_okay;
- }
-#endif // _di_f_thread_lock_attributes_delete_callback_
-
-#ifndef _di_f_thread_lock_attributes_destroy_callback_
- f_status_t f_thread_lock_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_lock_attribute_t * const array = (f_thread_lock_attribute_t *) void_array;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_rwlockattr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_lock_attributes_destroy_callback_
-
-#ifndef _di_f_thread_lock_attributess_delete_callback_
- f_status_t f_thread_lock_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_lock_attribute_create_
- f_thread_lock_attributes_t * const array = (f_thread_lock_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_lock_attribute_delete_
+ f_status_t f_thread_lock_attribute_delete(f_thread_lock_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return pthread_rwlockattr_destroy(attribute) ? F_status_set_error(F_failure) : F_okay;
+ }
+#endif // _di_f_thread_lock_attribute_delete_
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_rwlockattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+#ifndef _di_f_thread_lock_attribute_shared_get_
+ f_status_t f_thread_lock_attribute_shared_get(const f_thread_lock_attribute_t * const attribute, int * const shared) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!shared) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ if (pthread_rwlockattr_getpshared(attribute, shared)) {
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_lock_attributess_delete_callback_
-
-#ifndef _di_f_thread_lock_attributess_destroy_callback_
- f_status_t f_thread_lock_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_lock_attribute_shared_get_
- f_thread_lock_attributes_t * const array = (f_thread_lock_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_lock_attribute_shared_set_
+ f_status_t f_thread_lock_attribute_shared_set(const int shared, f_thread_lock_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_rwlockattr_setpshared(attribute, shared);
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_rwlockattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_lock_attributess_destroy_callback_
+#endif // _di_f_thread_lock_attribute_shared_set_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_lock_attribute_t_
/**
- * An array of read/write lock attributees.
+ * Create a thread lock attribute.
*
- * Properties:
- * - array: The array of f_thread_lock_attribute_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_lock_attributes_t_
- typedef struct {
- f_thread_lock_attribute_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_lock_attributes_t;
-
- #define f_thread_lock_attributes_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_lock_attributes_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_lock_attributes_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_lock_attributes_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_attributes_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param attribute
+ * The lock attributes to create.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
+ * F_busy (with error bit) if the lock is busy.
+ * F_memory_not (with error bit) if out of memory.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ * F_resource_not (with error bit) if max lockes is reached.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_rwlockattr_init()
*/
-#ifndef _di_f_thread_lock_attributes_delete_callback_
- extern f_status_t f_thread_lock_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lock_attributes_delete_callback_
+#ifndef _di_f_thread_lock_attribute_create_
+ extern f_status_t f_thread_lock_attribute_create(f_thread_lock_attribute_t * const attribute);
+#endif // _di_f_thread_lock_attribute_create_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_attributes_t structure.
+ * Delete a thread lock attribute.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * The pthread_rwlockattr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param attribute
+ * The attribute to delete.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_rwlockattr_destroy()
*/
-#ifndef _di_f_thread_lock_attributes_destroy_callback_
- extern f_status_t f_thread_lock_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lock_attributes_destroy_callback_
+#ifndef _di_f_thread_lock_attribute_delete_
+ extern f_status_t f_thread_lock_attribute_delete(f_thread_lock_attribute_t * const attribute);
+#endif // _di_f_thread_lock_attribute_delete_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_attributess_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Get the lock attribute process shared thread attribute.
*
- * This does not do parameter checking.
+ * @param attribute
+ * The lock attribute.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * Must not be NULL.
+ * @param shared
+ * The lock shared attribute value.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_rwlockattr_getpshared()
*/
-#ifndef _di_f_thread_lock_attributess_delete_callback_
- extern f_status_t f_thread_lock_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lock_attributess_delete_callback_
+#ifndef _di_f_thread_lock_attribute_shared_get_
+ extern f_status_t f_thread_lock_attribute_shared_get(const f_thread_lock_attribute_t * const attribute, int * const shared);
+#endif // _di_f_thread_lock_attribute_shared_get_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_attributess_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
+ * Set the lock attribute process shared thread attribute.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param shared
+ * The lock shared attribute value.
+ * @param attribute
+ * The lock attribute.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_rwlockattr_setpshared()
*/
-#ifndef _di_f_thread_lock_attributess_destroy_callback_
- extern f_status_t f_thread_lock_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lock_attributess_destroy_callback_
+#ifndef _di_f_thread_lock_attribute_shared_set_
+ extern f_status_t f_thread_lock_attribute_shared_set(const int shared, f_thread_lock_attribute_t * const attribute);
+#endif // _di_f_thread_lock_attribute_shared_set_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_lock_attributes_delete_callback_
+ f_status_t f_thread_lock_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_attribute_t * const array = (f_thread_lock_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_rwlockattr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_attributes_delete_callback_
+
+#ifndef _di_f_thread_lock_attributes_destroy_callback_
+ f_status_t f_thread_lock_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_attribute_t * const array = (f_thread_lock_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_rwlockattr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_lock_attributes_h
+#define _F_thread_lock_attributes_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of read/write lock attributes.
+ *
+ * Properties:
+ * - array: The array of f_thread_lock_attribute_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_lock_attributes_t_
+ typedef struct {
+ f_thread_lock_attribute_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_lock_attributes_t;
+
+ #define f_thread_lock_attributes_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_lock_attributes_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_lock_attributes_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_lock_attributes_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_lock_attributes_delete_callback_
+ extern f_status_t f_thread_lock_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lock_attributes_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_lock_attributes_destroy_callback_
+ extern f_status_t f_thread_lock_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lock_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_lock_attributes_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_lock_attributess_delete_callback_
+ f_status_t f_thread_lock_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_attributes_t * const array = (f_thread_lock_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_rwlockattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_attributess_delete_callback_
+
+#ifndef _di_f_thread_lock_attributess_destroy_callback_
+ f_status_t f_thread_lock_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_attributes_t * const array = (f_thread_lock_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_rwlockattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_lock_attributess_h
+#define _F_thread_lock_attributess_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of read/write lock attributes.
+ *
+ * Properties:
+ * - array: The array of f_thread_lock_attributes_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_lock_attributess_t_
+ typedef struct {
+ f_thread_lock_attributes_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_lock_attributess_t;
+
+ #define f_thread_lock_attributess_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_lock_attributess_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_lock_attributess_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_lock_attributess_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_lock_attributess_delete_callback_
+ extern f_status_t f_thread_lock_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lock_attributess_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_lock_attributess_destroy_callback_
+ extern f_status_t f_thread_lock_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lock_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_lock_attributess_h
#include "../thread.h"
-#include "lock_full.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_lock_fulls_delete_callback_
- f_status_t f_thread_lock_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_lock_full_delete_
+ f_status_t f_thread_lock_full_delete(f_thread_lock_full_t * const full) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!full) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- f_thread_lock_full_t * const array = (f_thread_lock_full_t *) void_array;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- error = pthread_rwlock_destroy(&array[i].lock);
+ {
+ const int error = pthread_rwlock_destroy(&full->lock);
if (error) {
if (error == EBUSY) return F_status_set_error(F_busy);
return F_status_set_error(F_failure);
}
+ }
- if (pthread_rwlockattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_fulls_delete_callback_
-
-#ifndef _di_f_thread_lock_fulls_destroy_callback_
- f_status_t f_thread_lock_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_lock_full_t * const array = (f_thread_lock_full_t *) void_array;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- error = pthread_rwlock_destroy(&array[i].lock);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_rwlockattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_fulls_destroy_callback_
-
-#ifndef _di_f_thread_lock_fullss_delete_callback_
- f_status_t f_thread_lock_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_lock_fulls_t * const array = (f_thread_lock_fulls_t *) void_array;
- f_number_unsigned_t j = 0;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_rwlock_destroy(&array[i].array[j].lock);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_rwlockattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_lock_fullss_delete_callback_
-
-#ifndef _di_f_thread_lock_fullss_destroy_callback_
- f_status_t f_thread_lock_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_lock_fulls_t * const array = (f_thread_lock_fulls_t *) void_array;
- f_number_unsigned_t j = 0;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_rwlock_destroy(&array[i].array[j].lock);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_rwlockattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
+ return pthread_rwlockattr_destroy(&full->attribute) ? F_status_set_error(F_failure) : F_okay;
}
-#endif // _di_f_thread_lock_fullss_destroy_callback_
+#endif // _di_f_thread_lock_full_delete_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_lock_full_t_
/**
- * An array of f_thread_lock_full_t.
+ * Delete a thread lock full.
*
- * Properties:
- * - array: The array of f_thread_lock_full_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_lock_fulls_t_
- typedef struct {
- f_thread_lock_full_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_lock_fulls_t;
-
- #define f_thread_lock_fulls_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_lock_fulls_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_lock_fulls_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_lock_fulls_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_fulls_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a lock is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_rwlock_destroy()
- * @see pthread_rwlockattr_destroy()
- */
-#ifndef _di_f_thread_lock_fulls_delete_callback_
- extern f_status_t f_thread_lock_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lock_fulls_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_fulls_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a lock is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- *
- * @see pthread_rwlock_destroy()
- * @see pthread_rwlockattr_destroy()
- */
-#ifndef _di_f_thread_lock_fulls_destroy_callback_
- extern f_status_t f_thread_lock_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lock_fulls_destroy_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_fullss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * The pthread_rwlock_destroy() and pthread_rwlockattr_destroy() functions have no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param full
+ * The full to delete.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a lock is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_rwlock_destroy()
- * @see pthread_rwlockattr_destroy()
- */
-#ifndef _di_f_thread_lock_fullss_delete_callback_
- extern f_status_t f_thread_lock_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lock_fullss_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_fullss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a lock is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * F_failure (with error bit) on any other error.
*
- * @see pthread_rwlock_destroy()
* @see pthread_rwlockattr_destroy()
*/
-#ifndef _di_f_thread_lock_fullss_destroy_callback_
- extern f_status_t f_thread_lock_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_lock_fullss_destroy_callback_
+#ifndef _di_f_thread_lock_full_delete_
+ extern f_status_t f_thread_lock_full_delete(f_thread_lock_full_t * const full);
+#endif // _di_f_thread_lock_full_delete_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+#include "lock_full.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_lock_fulls_delete_callback_
+ f_status_t f_thread_lock_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_full_t * const array = (f_thread_lock_full_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_rwlock_destroy(&array[i].lock);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_rwlockattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_fulls_delete_callback_
+
+#ifndef _di_f_thread_lock_fulls_destroy_callback_
+ f_status_t f_thread_lock_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_full_t * const array = (f_thread_lock_full_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_rwlock_destroy(&array[i].lock);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_rwlockattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_fulls_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_lock_fulls_h
+#define _F_thread_lock_fulls_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of f_thread_lock_full_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_lock_full_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_lock_fulls_t_
+ typedef struct {
+ f_thread_lock_full_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_lock_fulls_t;
+
+ #define f_thread_lock_fulls_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_lock_fulls_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_lock_fulls_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_lock_fulls_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_fulls_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_rwlock_destroy()
+ * @see pthread_rwlockattr_destroy()
+ */
+#ifndef _di_f_thread_lock_fulls_delete_callback_
+ extern f_status_t f_thread_lock_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lock_fulls_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_fulls_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_rwlock_destroy()
+ * @see pthread_rwlockattr_destroy()
+ */
+#ifndef _di_f_thread_lock_fulls_destroy_callback_
+ extern f_status_t f_thread_lock_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lock_fulls_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_lock_fulls_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_lock_fullss_delete_callback_
+ f_status_t f_thread_lock_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_fulls_t * const array = (f_thread_lock_fulls_t *) void_array;
+ f_number_unsigned_t j = 0;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_rwlock_destroy(&array[i].array[j].lock);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_rwlockattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_fullss_delete_callback_
+
+#ifndef _di_f_thread_lock_fullss_destroy_callback_
+ f_status_t f_thread_lock_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_fulls_t * const array = (f_thread_lock_fulls_t *) void_array;
+ f_number_unsigned_t j = 0;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_rwlock_destroy(&array[i].array[j].lock);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_rwlockattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lock_fullss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_lock_fullss_h
+#define _F_thread_lock_fullss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of f_thread_lock_fulls_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_lock_fulls_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_lock_fullss_t_
+ typedef struct {
+ f_thread_lock_fulls_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_lock_fullss_t;
+
+ #define f_thread_lock_fullss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_lock_fullss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_lock_fullss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_lock_fullss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_fullss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_rwlock_destroy()
+ * @see pthread_rwlockattr_destroy()
+ */
+#ifndef _di_f_thread_lock_fullss_delete_callback_
+ extern f_status_t f_thread_lock_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lock_fullss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_fullss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_rwlock_destroy()
+ * @see pthread_rwlockattr_destroy()
+ */
+#ifndef _di_f_thread_lock_fullss_destroy_callback_
+ extern f_status_t f_thread_lock_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lock_fullss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_lock_fullss_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_locks_delete_callback_
+ f_status_t f_thread_locks_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_t * const array = (f_thread_lock_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_rwlock_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_locks_delete_callback_
+
+#ifndef _di_f_thread_locks_destroy_callback_
+ f_status_t f_thread_locks_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_lock_t * const array = (f_thread_lock_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_rwlock_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_locks_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_locks_h
+#define _F_thread_locks_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread locks.
+ *
+ * Properties:
+ * - array: The array of f_thread_lock_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_locks_t_
+ typedef struct {
+ f_thread_lock_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_locks_t;
+
+ #define f_thread_locks_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_locks_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_locks_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_locks_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_locks_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_locks_delete_callback_
+ extern f_status_t f_thread_locks_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_locks_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_locks_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_locks_destroy_callback_
+ extern f_status_t f_thread_locks_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_locks_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_locks_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_lockss_delete_callback_
+ f_status_t f_thread_lockss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_locks_t * const array = (f_thread_locks_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_rwlock_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lockss_delete_callback_
+
+#ifndef _di_f_thread_lockss_destroy_callback_
+ f_status_t f_thread_lockss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_locks_t * const array = (f_thread_locks_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_rwlock_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_lockss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_lockss_h
+#define _F_thread_lockss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread locks.
+ *
+ * Properties:
+ * - array: The array of f_thread_locks_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_lockss_t_
+ typedef struct {
+ f_thread_locks_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_lockss_t;
+
+ #define f_thread_lockss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_lockss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_lockss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_lockss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lockss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_lockss_delete_callback_
+ extern f_status_t f_thread_lockss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lockss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lockss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a lock is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_lockss_destroy_callback_
+ extern f_status_t f_thread_lockss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_lockss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_lockss_h
#include "../thread.h"
-#include "mutex.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_mutexs_delete_callback_
- f_status_t f_thread_mutexs_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_mutex_consistent_
+ f_status_t f_thread_mutex_consistent(f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_mutex_t * const array = (f_thread_mutex_t *) void_array;
- int error = 0;
+ const int error = pthread_mutex_consistent(mutex);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_robust_not);
- error = pthread_mutex_destroy(&array[i]);
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_consistent_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+#ifndef _di_f_thread_mutex_create_
+ f_status_t f_thread_mutex_create(f_thread_mutex_attribute_t * const attribute, f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- return F_status_set_error(F_failure);
- }
- } // for
+ const int error = pthread_mutex_init(mutex, attribute);
+
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_mutexs_delete_callback_
+#endif // _di_f_thread_mutex_create_
+
+#ifndef _di_f_thread_mutex_delete_
+ f_status_t f_thread_mutex_delete(f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_mutexs_destroy_callback_
- f_status_t f_thread_mutexs_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ const int error = pthread_mutex_destroy(mutex);
- {
- f_thread_mutex_t * const array = (f_thread_mutex_t *) void_array;
- int error = 0;
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_delete_
- error = pthread_mutex_destroy(&array[i]);
+#ifndef _di_f_thread_mutex_lock_
+ f_status_t f_thread_mutex_lock(f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ const int error = pthread_mutex_lock(mutex);
- return F_status_set_error(F_failure);
- }
- } // for
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
+ if (error == EOWNERDEAD) return F_status_set_error(F_dead);
+
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_mutexs_destroy_callback_
+#endif // _di_f_thread_mutex_lock_
+
+#ifndef _di_f_thread_mutex_lock_timed_
+ f_status_t f_thread_mutex_lock_timed(const f_time_spec_t * const timeout, f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!timeout) return F_status_set_error(F_parameter);
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_mutex_timedlock(mutex, timeout);
+
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
+ if (error == EOWNERDEAD) return F_status_set_error(F_dead);
+ if (error == ETIMEDOUT) return F_time;
+
+ return F_status_set_error(F_failure);
+ }
-#ifndef _di_f_thread_mutexss_delete_callback_
- f_status_t f_thread_mutexss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_lock_timed_
- {
- f_thread_mutexs_t * const array = (f_thread_mutexs_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_mutex_lock_try_
+ f_status_t f_thread_mutex_lock_try(f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_mutex_trylock(mutex);
- for (j = 0; j < array[i].size; ++j) {
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_busy;
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
+ if (error == EOWNERDEAD) return F_status_set_error(F_dead);
- error = pthread_mutex_destroy(&array[i].array[j]);
+ return F_status_set_error(F_failure);
+ }
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_lock_try_
+
+#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_get_)
+ f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t * const mutex, int * const ceiling) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ if (!ceiling) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return F_status_set_error(F_implement_not);
+ }
+#elif !defined(_di_f_thread_mutex_priority_ceiling_get_)
+ f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t * const mutex, int * const ceiling) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ if (!ceiling) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- return F_status_set_error(F_failure);
- }
- } // for
+ const int error = pthread_mutex_getprioceiling(mutex, ceiling);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_mutexss_delete_callback_
-
-#ifndef _di_f_thread_mutexss_destroy_callback_
- f_status_t f_thread_mutexss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_get_)
- {
- f_thread_mutexs_t * const array = (f_thread_mutexs_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_set_)
+ f_status_t f_thread_mutex_priority_ceiling_set(const int ceiling, f_thread_mutex_t * const mutex, int * const previous) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return F_status_set_error(F_implement_not);
+ }
+#elif !defined(_di_f_thread_mutex_priority_ceiling_set_)
+ f_status_t f_thread_mutex_priority_ceiling_set(const int ceiling, f_thread_mutex_t * const mutex, int * const previous) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_mutex_setprioceiling(mutex, ceiling, previous);
+
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOTRECOVERABLE) return F_status_set_error(F_recover_not);
+ if (error == EOWNERDEAD) return F_status_set_error(F_dead);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+
+ return F_status_set_error(F_failure);
+ }
- for (j = 0; j < array[i].size; ++j) {
+ return F_okay;
+ }
+#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_set_)
- error = pthread_mutex_destroy(&array[i].array[j]);
+#ifndef _di_f_thread_mutex_unlock_
+ f_status_t f_thread_mutex_unlock(f_thread_mutex_t * const mutex) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!mutex) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ const int error = pthread_mutex_unlock(mutex);
- return F_status_set_error(F_failure);
- }
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_mutexss_destroy_callback_
+#endif // _di_f_thread_mutex_unlock_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_mutex_t_
/**
- * An array of thread mutexes.
+ * Mark a robust mutex as consistent.
*
- * Properties:
- * - array: The array of f_thread_mutex_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * Use this to re-mark a mutex that is no longer in a consistent state.
+ *
+ * This should be used to address mutex locks that return F_dead when attempting to acquire a lock.
+ *
+ * @param mutex
+ * The thread mutex.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_robust (with error bit) if mutex is either not robust or it does not protect from an inconsistent state.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutex_consistent()
*/
-#ifndef _di_f_thread_mutexs_t_
- typedef struct {
- f_thread_mutex_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_mutexs_t;
-
- #define f_thread_mutexs_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_mutexs_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_mutexs_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_mutexs_t_
+#ifndef _di_f_thread_mutex_consistent_
+ extern f_status_t f_thread_mutex_consistent(f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_mutex_consistent_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutexs_t structure.
+ * Create a thread mutex.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * @param attribute
+ * (optional) The mutex attributes to set.
+ * Set to NULL to not use (in which case the default attributes are used).
+ * @param mutex
+ * The mutex to create.
*
- * This does not do parameter checking.
+ * Must not be NULL.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if the mutex is busy.
+ * F_memory_not (with error bit) if out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ * F_resource_not (with error bit) if max mutexes is reached.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutex_init()
+ */
+#ifndef _di_f_thread_mutex_create_
+ extern f_status_t f_thread_mutex_create(f_thread_mutex_attribute_t * const attribute, f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_mutex_create_
+
+/**
+ * Delete a thread mutex.
+ *
+ * The pthread_mutex_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
+ *
+ * @param mutex
+ * The mutex to delete.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a mutex is busy.
+ * F_busy (with error bit) if the mutex is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * F_failure (with error bit) on any other error.
*
* @see pthread_mutex_destroy()
*/
-#ifndef _di_f_thread_mutexs_delete_callback_
- extern f_status_t f_thread_mutexs_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutexs_delete_callback_
+#ifndef _di_f_thread_mutex_delete_
+ extern f_status_t f_thread_mutex_delete(f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_mutex_delete_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutexs_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Get the mutex priority ceiling.
*
- * This does not do parameter checking.
+ * @param mutex
+ * The thread mutex.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * Must not be NULL.
+ * @param ceiling
+ * The priority ceiling.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a mutex is busy.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
*
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * F_failure (with error bit) on any other error.
*
- * @see pthread_mutex_destroy()
+ * @see pthread_mutex_getprioceiling()
*/
-#ifndef _di_f_thread_mutexs_destroy_callback_
- extern f_status_t f_thread_mutexs_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutexs_destroy_callback_
+#ifndef _di_f_thread_mutex_priority_ceiling_get_
+ extern f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t * const mutex, int * const ceiling);
+#endif // _di_f_thread_mutex_priority_ceiling_get_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutexss_t structure.
+ * Set the mutex priority ceiling.
+ *
+ * @param ceiling
+ * The priority ceiling.
+ * @param mutex
+ * The thread mutex.
+ *
+ * Must not be NULL.
+ * @param previous
+ * (optional) The previous priority ceiling.
+ *
+ * Set to NULL to not use.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_deadlock (with error bit) if operation would cause a deadlock.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ * F_recover_not (with error bit) if the state protected by the mutex is not recoverable (for a "robust" mutex).
+ * F_resource_not (with error bit) if max mutex locks is reached.
+ * F_dead (with error bit) if the owning thread terminated while holding the mutex lock (thread is dead).
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * F_failure (with error bit) on any other error.
*
- * This does not do parameter checking.
+ * @see pthread_mutex_setprioceiling()
+ */
+#ifndef _di_f_thread_mutex_priority_ceiling_set_
+ extern f_status_t f_thread_mutex_priority_ceiling_set(const int ceiling, f_thread_mutex_t * const mutex, int * const previous);
+#endif // _di_f_thread_mutex_priority_ceiling_set_
+
+/**
+ * Unlock the mutex.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param mutex
+ * The thread mutex.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a mutex is busy.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation (possibly because mutex is not owned by current thread).
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_mutex_unlock()
+ */
+#ifndef _di_f_thread_mutex_unlock_
+ extern f_status_t f_thread_mutex_unlock(f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_mutex_unlock_
+
+/**
+ * Lock the mutex.
*
- * @see pthread_mutex_destroy()
+ * This is a blocking function.
+ *
+ * @param mutex
+ * The thread mutex.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_dead (with error bit) if the owning thread terminated while holding the mutex lock (thread is dead).
+ * F_deadlock (with error bit) if operation would cause a deadlock.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
+ * F_resource_not (with error bit) if max mutex locks is reached.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutex_lock()
*/
-#ifndef _di_f_thread_mutexss_delete_callback_
- extern f_status_t f_thread_mutexss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutexss_delete_callback_
+#ifndef _di_f_thread_mutex_lock_
+ extern f_status_t f_thread_mutex_lock(f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_mutex_lock_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutexss_t structure.
+ * Lock the mutex, waiting for a set period of time to get the lock if already locked.
+ *
+ * If the mutex is already locked and the timeout expires, then the lock attempt fails.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * This is a blocking function (until timeout expires).
*
- * This does not do parameter checking.
+ * @param timeout
+ * The timeout.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * Must not be NULL.
+ * @param mutex
+ * The thread mutex.
*
* Must not be NULL.
*
* @return
* F_okay on success.
+ * F_time if the timeout was reached before obtaining the lock.
*
- * F_busy (with error bit) if a mutex is busy.
+ * F_dead (with error bit) if the owning thread terminated while holding the mutex lock (thread is dead).
+ * F_deadlock (with error bit) if operation would cause a deadlock.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
+ * F_resource_not (with error bit) if max mutex locks is reached.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_mutex_timedlock()
+ */
+#ifndef _di_f_thread_mutex_lock_timed_
+ extern f_status_t f_thread_mutex_lock_timed(const f_time_spec_t * const timeout, f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_mutex_lock_timed_
+
+/**
+ * Try to lock the mutex.
*
- * @see pthread_mutex_destroy()
+ * If mutex is already locked, return immediately.
+ *
+ * This is a non-blocking function.
+ *
+ * @param mutex
+ * The thread mutex.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ * F_busy on success, but the mutex is already locked.
+ *
+ * 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.
+ * F_recover_not (with error bit) if the state protected by the mutex is not recoverable.
+ * F_resource_not (with error bit) if max mutex locks is reached.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutex_trylock()
*/
-#ifndef _di_f_thread_mutexss_destroy_callback_
- extern f_status_t f_thread_mutexss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutexss_destroy_callback_
+#ifndef _di_f_thread_mutex_lock_try_
+ extern f_status_t f_thread_mutex_lock_try(f_thread_mutex_t * const mutex);
+#endif // _di_f_thread_mutex_lock_try_
#ifdef __cplusplus
} // extern "C"
#include "../thread.h"
-#include "mutex_attribute.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_mutex_attributes_delete_callback_
- f_status_t f_thread_mutex_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_mutex_attribute_create_
+ f_status_t f_thread_mutex_attribute_create(f_thread_mutex_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- f_thread_mutex_attribute_t * const array = (f_thread_mutex_attribute_t *) void_array;
+ const int error = pthread_mutexattr_init(attribute);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_mutexattr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attribute_create_
+
+#ifndef _di_f_thread_mutex_attribute_delete_
+ f_status_t f_thread_mutex_attribute_delete(f_thread_mutex_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return pthread_mutexattr_destroy(attribute) ? F_status_set_error(F_failure) : F_okay;
+ }
+#endif // _di_f_thread_mutex_attribute_delete_
+
+#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_)
+ f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!ceiling) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return F_status_set_error(F_implement_not);
+ }
+#elif !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_)
+ f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!ceiling) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_mutexattr_getprioceiling(attribute, ceiling);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_mutex_attributes_delete_callback_
+#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_)
-#ifndef _di_f_thread_mutex_attributes_destroy_callback_
- f_status_t f_thread_mutex_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_)
+ f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- f_thread_mutex_attribute_t * const array = (f_thread_mutex_attribute_t *) void_array;
+ return F_status_set_error(F_implement_not);
+ }
+#elif !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_)
+ f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_mutexattr_setprioceiling(attribute, ceiling);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_mutexattr_destroy(&array[i])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_mutex_attributes_destroy_callback_
+#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_)
+
+#ifndef _di_f_thread_mutex_attribute_protocol_get_
+ f_status_t f_thread_mutex_attribute_protocol_get(const f_thread_mutex_attribute_t * const attribute, int * const protocol) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!protocol) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_mutex_attributess_delete_callback_
- f_status_t f_thread_mutex_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ const int error = pthread_mutexattr_getprotocol(attribute, protocol);
- f_thread_mutex_attributes_t * const array = (f_thread_mutex_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attribute_protocol_get_
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_mutexattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+#ifndef _di_f_thread_mutex_attribute_protocol_set_
+ f_status_t f_thread_mutex_attribute_protocol_set(const int protocol, f_thread_mutex_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ const int error = pthread_mutexattr_setprotocol(attribute, protocol);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
+ if (error == ENOTSUP) return F_status_set_error(F_support_not);
+
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_mutex_attributess_delete_callback_
+#endif // _di_f_thread_mutex_attribute_protocol_set_
+
+#ifndef _di_f_thread_mutex_attribute_robust_get_
+ f_status_t f_thread_mutex_attribute_robust_get(f_thread_mutex_attribute_t * const attribute, int * const robust) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!robust) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_mutex_attributess_destroy_callback_
- f_status_t f_thread_mutex_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ const int error = pthread_mutexattr_getrobust(attribute, robust);
+
+ if (error) {
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attribute_robust_get_
+
+#ifndef _di_f_thread_mutex_attribute_robust_set_
+ f_status_t f_thread_mutex_attribute_robust_set(const int robust, f_thread_mutex_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_mutexattr_setrobust(attribute, robust);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attribute_robust_set_
+
+#ifndef _di_f_thread_mutex_attribute_shared_get_
+ f_status_t f_thread_mutex_attribute_shared_get(const f_thread_mutex_attribute_t * const attribute, int * const shared) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!shared) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (pthread_mutexattr_getpshared(attribute, shared)) {
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attribute_shared_get_
+
+#ifndef _di_f_thread_mutex_attribute_shared_set_
+ f_status_t f_thread_mutex_attribute_shared_set(const int shared, f_thread_mutex_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_mutexattr_setpshared(attribute, shared);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attribute_shared_set_
+
+#ifndef _di_f_thread_mutex_attribute_type_get_
+ f_status_t f_thread_mutex_attribute_type_get(const f_thread_mutex_attribute_t * const attribute, int * const type) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ if (!type) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (pthread_mutexattr_gettype(attribute, type)) {
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attribute_type_get_
- f_thread_mutex_attributes_t * const array = (f_thread_mutex_attributes_t *) void_array;
- f_number_unsigned_t j = 0;
+#ifndef _di_f_thread_mutex_attribute_type_set_
+ f_status_t f_thread_mutex_attribute_type_set(const int type, f_thread_mutex_attribute_t * const attribute) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!attribute) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_mutexattr_settype(attribute, type);
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_mutexattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
- } // for
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
+ }
return F_okay;
}
-#endif // _di_f_thread_mutex_attributess_destroy_callback_
+#endif // _di_f_thread_mutex_attribute_type_set_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_mutex_attribute_t_
/**
- * An array of thread mutex_attributees.
+ * Create a thread mutex attribute.
*
- * Properties:
- * - array: The array of f_thread_mutex_attribute_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * @param attribute
+ * The mutex attributes to create.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if the mutex is busy.
+ * F_memory_not (with error bit) if out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ * F_resource_not (with error bit) if max mutexes is reached.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutexattr_init()
*/
-#ifndef _di_f_thread_mutex_attributes_t_
- typedef struct {
- f_thread_mutex_attribute_t *array;
+#ifndef _di_f_thread_mutex_attribute_create_
+ extern f_status_t f_thread_mutex_attribute_create(f_thread_mutex_attribute_t * const attribute);
+#endif // _di_f_thread_mutex_attribute_create_
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_mutex_attributes_t;
+/**
+ * Delete a thread mutex attribute.
+ *
+ * The pthread_mutexattr_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
+ *
+ * @param attribute
+ * The attribute to delete.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutexattr_destroy()
+ */
+#ifndef _di_f_thread_mutex_attribute_delete_
+ extern f_status_t f_thread_mutex_attribute_delete(f_thread_mutex_attribute_t * const attribute);
+#endif // _di_f_thread_mutex_attribute_delete_
- #define f_thread_mutex_attributes_t_initialize { 0, 0, 0 }
+/**
+ * Get the mutex attribute priority ceiling.
+ *
+ * @param attribute
+ * The thread mutex attribute.
+ *
+ * Must not be NULL.
+ * @param ceiling
+ * The priority ceiling.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ *
+ * @see pthread_mutexattr_getprioceiling()
+ */
+#ifndef _di_f_thread_mutex_attribute_priority_ceiling_get_
+ extern f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling);
+#endif // _di_f_thread_mutex_attribute_priority_ceiling_get_
- #define macro_f_thread_mutex_attributes_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_mutex_attributes_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_mutex_attributes_t_
+/**
+ * Set the mutex attribute priority ceiling.
+ *
+ * @param ceiling
+ * The priority ceiling.
+ * @param attribute
+ * The thread mutex attribute.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ *
+ * @see pthread_mutexattr_setprioceiling()
+ */
+#ifndef _di_f_thread_mutex_attribute_priority_ceiling_set_
+ extern f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute);
+#endif // _di_f_thread_mutex_attribute_priority_ceiling_set_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_attributes_t structure.
+ * Get the mutex attribute protocol.
+ *
+ * @param attribute
+ * The thread mutex attribute.
+ *
+ * Must not be NULL.
+ * @param protocol
+ * The protocol.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Must not be NULL.
*
- * This does not do parameter checking.
+ * @return
+ * F_okay on success.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutexattr_getprotocol()
+ */
+#ifndef _di_f_thread_mutex_attribute_protocol_get_
+ extern f_status_t f_thread_mutex_attribute_protocol_get(const f_thread_mutex_attribute_t * const attribute, int * const protocol);
+#endif // _di_f_thread_mutex_attribute_protocol_get_
+
+/**
+ * Set the mutex attribute protocol.
+ *
+ * @param protocol
+ * The protocol.
+ * @param attribute
+ * The thread mutex attribute.
*
* Must not be NULL.
*
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation.
+ * F_support_not (with error bit) if the protocol is not supported.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_mutexattr_setprotocol()
*/
-#ifndef _di_f_thread_mutex_attributes_delete_callback_
- extern f_status_t f_thread_mutex_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutex_attributes_delete_callback_
+#ifndef _di_f_thread_mutex_attribute_protocol_set_
+ extern f_status_t f_thread_mutex_attribute_protocol_set(const int protocol, f_thread_mutex_attribute_t * const attribute);
+#endif // _di_f_thread_mutex_attribute_protocol_set_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_attributes_t structure.
+ * Get the robust mutex attribute.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * @param attribute
+ * The mutex attributes to set the value of.
*
- * This does not do parameter checking.
+ * Must not be NULL.
+ * @param robust
+ * The value to set to robust attribute to.
+ * See f_thread_mutex_stalled_d and f_thread_mutex_robust_d.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutexattr_setrobust()
+ */
+#ifndef _di_f_thread_mutex_attribute_robust_get_
+ extern f_status_t f_thread_mutex_attribute_robust_get(f_thread_mutex_attribute_t * const attribute, int * const robust);
+#endif // _di_f_thread_mutex_attribute_robust_get_
+
+/**
+ * Set the robust mutex attribute.
+ *
+ * @param robust
+ * The value to set to robust attribute to.
+ * See f_thread_mutex_stalled_d and f_thread_mutex_robust_d.
+ * @param attribute
+ * The mutex attributes to set the value of.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_mutexattr_setrobust()
*/
-#ifndef _di_f_thread_mutex_attributes_destroy_callback_
- extern f_status_t f_thread_mutex_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutex_attributes_destroy_callback_
+#ifndef _di_f_thread_mutex_attribute_robust_set_
+ extern f_status_t f_thread_mutex_attribute_robust_set(const int robust, f_thread_mutex_attribute_t * const attribute);
+#endif // _di_f_thread_mutex_attribute_robust_set_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_attributess_t structure.
+ * Get the mutex attribute process shared thread attribute.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * @param attribute
+ * The mutex attribute.
*
- * This does not do parameter checking.
+ * Must not be NULL.
+ * @param shared
+ * The mutex shared attribute value.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutexattr_getpshared()
+ */
+#ifndef _di_f_thread_mutex_attribute_shared_get_
+ extern f_status_t f_thread_mutex_attribute_shared_get(const f_thread_mutex_attribute_t * const attribute, int * const shared);
+#endif // _di_f_thread_mutex_attribute_shared_get_
+
+/**
+ * Set the mutex attribute process shared thread attribute.
+ *
+ * @param shared
+ * The mutex shared attribute value.
+ * @param attribute
+ * The mutex attribute.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_mutexattr_setpshared()
*/
-#ifndef _di_f_thread_mutex_attributess_delete_callback_
- extern f_status_t f_thread_mutex_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutex_attributess_delete_callback_
+#ifndef _di_f_thread_mutex_attribute_shared_set_
+ extern f_status_t f_thread_mutex_attribute_shared_set(const int shared, f_thread_mutex_attribute_t * const attribute);
+#endif // _di_f_thread_mutex_attribute_shared_set_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_attributess_t structure.
+ * Get the mutex attribute type.
+ *
+ * @param attribute
+ * The mutex attribute.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Must not be NULL.
+ * @param type
+ * The type.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
*
- * This does not do parameter checking.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_mutexattr_gettype()
+ */
+#ifndef _di_f_thread_mutex_attribute_type_get_
+ extern f_status_t f_thread_mutex_attribute_type_get(const f_thread_mutex_attribute_t * const attribute, int * const type);
+#endif // _di_f_thread_mutex_attribute_type_get_
+
+/**
+ * Set the mutex attribute process shared thread attribute.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param type
+ * The type.
+ * @param attribute
+ * The mutex attribute.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_mutexattr_settype()
*/
-#ifndef _di_f_thread_mutex_attributess_destroy_callback_
- extern f_status_t f_thread_mutex_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutex_attributess_destroy_callback_
+#ifndef _di_f_thread_mutex_attribute_type_set_
+ extern f_status_t f_thread_mutex_attribute_type_set(const int type, f_thread_mutex_attribute_t * const attribute);
+#endif // _di_f_thread_mutex_attribute_type_set_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_mutex_attributes_delete_callback_
+ f_status_t f_thread_mutex_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_attribute_t * const array = (f_thread_mutex_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_mutexattr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attributes_delete_callback_
+
+#ifndef _di_f_thread_mutex_attributes_destroy_callback_
+ f_status_t f_thread_mutex_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_attribute_t * const array = (f_thread_mutex_attribute_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_mutexattr_destroy(&array[i])) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_mutex_attributes_h
+#define _F_thread_mutex_attributes_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread mutex attributes.
+ *
+ * Properties:
+ * - array: The array of f_thread_mutex_attribute_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_mutex_attributes_t_
+ typedef struct {
+ f_thread_mutex_attribute_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_mutex_attributes_t;
+
+ #define f_thread_mutex_attributes_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_mutex_attributes_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_mutex_attributes_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_mutex_attributes_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_mutex_attributes_delete_callback_
+ extern f_status_t f_thread_mutex_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutex_attributes_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_attributes_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_mutex_attributes_destroy_callback_
+ extern f_status_t f_thread_mutex_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutex_attributes_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_mutex_attributes_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_mutex_attributess_delete_callback_
+ f_status_t f_thread_mutex_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_attributes_t * const array = (f_thread_mutex_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_mutexattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attributess_delete_callback_
+
+#ifndef _di_f_thread_mutex_attributess_destroy_callback_
+ f_status_t f_thread_mutex_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_attributes_t * const array = (f_thread_mutex_attributes_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_mutexattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_mutex_attributess_h
+#define _F_thread_mutex_attributess_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of and array of thread mutex attributes.
+ *
+ * Properties:
+ * - array: The array of f_thread_mutex_attributes_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_mutex_attributess_t_
+ typedef struct {
+ f_thread_mutex_attributes_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_mutex_attributess_t;
+
+ #define f_thread_mutex_attributess_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_mutex_attributess_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_mutex_attributess_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_mutex_attributess_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_mutex_attributess_delete_callback_
+ extern f_status_t f_thread_mutex_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutex_attributess_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_attributess_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_mutex_attributess_destroy_callback_
+ extern f_status_t f_thread_mutex_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutex_attributess_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_mutex_attributess_h
#include "../thread.h"
-#include "mutex_full.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_mutex_fulls_delete_callback_
- f_status_t f_thread_mutex_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_mutex_full_delete_
+ f_status_t f_thread_mutex_full_delete(f_thread_mutex_full_t * const full) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!full) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- f_thread_mutex_full_t * const array = (f_thread_mutex_full_t *) void_array;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- error = pthread_mutex_destroy(&array[i].mutex);
+ {
+ const int error = pthread_mutex_destroy(&full->mutex);
if (error) {
if (error == EBUSY) return F_status_set_error(F_busy);
return F_status_set_error(F_failure);
}
+ }
- if (pthread_mutexattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_fulls_delete_callback_
-
-#ifndef _di_f_thread_mutex_fulls_destroy_callback_
- f_status_t f_thread_mutex_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_mutex_full_t * const array = (f_thread_mutex_full_t *) void_array;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- error = pthread_mutex_destroy(&array[i].mutex);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_mutexattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_fulls_destroy_callback_
-
-#ifndef _di_f_thread_mutex_fullss_delete_callback_
- f_status_t f_thread_mutex_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_mutex_fulls_t * const array = (f_thread_mutex_fulls_t *) void_array;
- f_number_unsigned_t j = 0;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_mutex_destroy(&array[i].array[j].mutex);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_mutexattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
- }
-#endif // _di_f_thread_mutex_fullss_delete_callback_
-
-#ifndef _di_f_thread_mutex_fullss_destroy_callback_
- f_status_t f_thread_mutex_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- f_thread_mutex_fulls_t * const array = (f_thread_mutex_fulls_t *) void_array;
- f_number_unsigned_t j = 0;
- int error = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
-
- error = pthread_mutex_destroy(&array[i].array[j].mutex);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
-
- if (pthread_mutexattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
+ return pthread_mutexattr_destroy(&full->attribute) ? F_status_set_error(F_failure) : F_okay;
}
-#endif // _di_f_thread_mutex_fullss_destroy_callback_
+#endif // _di_f_thread_mutex_full_delete_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_mutex_full_t_
/**
- * An array of f_thread_mutex_full_t.
+ * Delete a thread mutex full.
*
- * Properties:
- * - array: The array of f_thread_mutex_full_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_mutex_fulls_t_
- typedef struct {
- f_thread_mutex_full_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_mutex_fulls_t;
-
- #define f_thread_mutex_fulls_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_mutex_fulls_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_mutex_fulls_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_mutex_fulls_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_fulls_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * The pthread_mutex_destroy() and pthread_mutexattr_destroy() functions have no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param full
+ * The full to delete.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
- * F_busy (with error bit) if a mutex is busy.
+ * F_busy (with error bit) if the mutex is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_mutex_destroy()
- * @see pthread_mutexattr_destroy()
- */
-#ifndef _di_f_thread_mutex_fulls_delete_callback_
- extern f_status_t f_thread_mutex_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutex_fulls_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_fulls_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a mutex is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- *
- * @see pthread_mutex_destroy()
- * @see pthread_mutexattr_destroy()
- */
-#ifndef _di_f_thread_mutex_fulls_destroy_callback_
- extern f_status_t f_thread_mutex_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutex_fulls_destroy_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_fullss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a mutex is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- *
- * @see pthread_mutex_destroy()
- * @see pthread_mutexattr_destroy()
- */
-#ifndef _di_f_thread_mutex_fullss_delete_callback_
- extern f_status_t f_thread_mutex_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutex_fullss_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_fullss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_busy (with error bit) if a mutex is busy.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * F_failure (with error bit) on any other error.
*
* @see pthread_mutex_destroy()
* @see pthread_mutexattr_destroy()
*/
-#ifndef _di_f_thread_mutex_fullss_destroy_callback_
- extern f_status_t f_thread_mutex_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_mutex_fullss_destroy_callback_
+#ifndef _di_f_thread_mutex_full_delete_
+ extern f_status_t f_thread_mutex_full_delete(f_thread_mutex_full_t * const full);
+#endif // _di_f_thread_mutex_full_delete_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_mutex_fulls_delete_callback_
+ f_status_t f_thread_mutex_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_full_t * const array = (f_thread_mutex_full_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_mutex_destroy(&array[i].mutex);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_mutexattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_fulls_delete_callback_
+
+#ifndef _di_f_thread_mutex_fulls_destroy_callback_
+ f_status_t f_thread_mutex_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_full_t * const array = (f_thread_mutex_full_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_mutex_destroy(&array[i].mutex);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_mutexattr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_fulls_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_mutex_fulls_h
+#define _F_thread_mutex_fulls_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of f_thread_mutex_full_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_mutex_full_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_mutex_fulls_t_
+ typedef struct {
+ f_thread_mutex_full_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_mutex_fulls_t;
+
+ #define f_thread_mutex_fulls_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_mutex_fulls_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_mutex_fulls_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_mutex_fulls_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_fulls_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a mutex is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_mutex_destroy()
+ * @see pthread_mutexattr_destroy()
+ */
+#ifndef _di_f_thread_mutex_fulls_delete_callback_
+ extern f_status_t f_thread_mutex_fulls_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutex_fulls_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_fulls_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a mutex is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_mutex_destroy()
+ * @see pthread_mutexattr_destroy()
+ */
+#ifndef _di_f_thread_mutex_fulls_destroy_callback_
+ extern f_status_t f_thread_mutex_fulls_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutex_fulls_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_mutex_fulls_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_mutex_fullss_delete_callback_
+ f_status_t f_thread_mutex_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_fulls_t * const array = (f_thread_mutex_fulls_t *) void_array;
+ f_number_unsigned_t j = 0;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_mutex_destroy(&array[i].array[j].mutex);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_mutexattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_fullss_delete_callback_
+
+#ifndef _di_f_thread_mutex_fullss_destroy_callback_
+ f_status_t f_thread_mutex_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_fulls_t * const array = (f_thread_mutex_fulls_t *) void_array;
+ f_number_unsigned_t j = 0;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_mutex_destroy(&array[i].array[j].mutex);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (pthread_mutexattr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_full_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutex_fullss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_mutex_fullss_h
+#define _F_thread_mutex_fullss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of f_thread_mutex_fulls_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_mutex_fulls_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_mutex_fullss_t_
+ typedef struct {
+ f_thread_mutex_fulls_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_mutex_fullss_t;
+
+ #define f_thread_mutex_fullss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_mutex_fullss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_mutex_fullss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_mutex_fullss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_fullss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a mutex is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_mutex_destroy()
+ * @see pthread_mutexattr_destroy()
+ */
+#ifndef _di_f_thread_mutex_fullss_delete_callback_
+ extern f_status_t f_thread_mutex_fullss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutex_fullss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_fullss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a mutex is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_mutex_destroy()
+ * @see pthread_mutexattr_destroy()
+ */
+#ifndef _di_f_thread_mutex_fullss_destroy_callback_
+ extern f_status_t f_thread_mutex_fullss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutex_fullss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_mutex_fullss_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_mutexs_delete_callback_
+ f_status_t f_thread_mutexs_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_t * const array = (f_thread_mutex_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_mutex_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutexs_delete_callback_
+
+#ifndef _di_f_thread_mutexs_destroy_callback_
+ f_status_t f_thread_mutexs_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutex_t * const array = (f_thread_mutex_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_mutex_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutexs_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_mutexs_h
+#define _F_thread_mutexs_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread mutexes.
+ *
+ * Properties:
+ * - array: The array of f_thread_mutex_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_mutexs_t_
+ typedef struct {
+ f_thread_mutex_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_mutexs_t;
+
+ #define f_thread_mutexs_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_mutexs_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_mutexs_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_mutexs_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutexs_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a mutex is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_mutex_destroy()
+ */
+#ifndef _di_f_thread_mutexs_delete_callback_
+ extern f_status_t f_thread_mutexs_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutexs_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutexs_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a mutex is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_mutex_destroy()
+ */
+#ifndef _di_f_thread_mutexs_destroy_callback_
+ extern f_status_t f_thread_mutexs_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutexs_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_mutexs_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_mutexss_delete_callback_
+ f_status_t f_thread_mutexss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutexs_t * const array = (f_thread_mutexs_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_mutex_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutexss_delete_callback_
+
+#ifndef _di_f_thread_mutexss_destroy_callback_
+ f_status_t f_thread_mutexss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_mutexs_t * const array = (f_thread_mutexs_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_mutex_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_mutexss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_mutexss_h
+#define _F_thread_mutexss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread mutexes.
+ *
+ * Properties:
+ * - array: The array of f_thread_mutexs_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_mutexss_t_
+ typedef struct {
+ f_thread_mutexs_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_mutexss_t;
+
+ #define f_thread_mutexss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_mutexss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_mutexss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_mutexss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutexss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a mutex is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ *
+ * @see pthread_mutex_destroy()
+ */
+#ifndef _di_f_thread_mutexss_delete_callback_
+ extern f_status_t f_thread_mutexss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutexss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutexss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if a mutex is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ *
+ * @see pthread_mutex_destroy()
+ */
+#ifndef _di_f_thread_mutexss_destroy_callback_
+ extern f_status_t f_thread_mutexss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_mutexss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_mutexss_h
#include "../thread.h"
-#include "once.h"
#ifdef __cplusplus
extern "C" {
#endif
+#ifndef _di_f_thread_once_
+ f_status_t f_thread_once(const f_void_call_t routine, f_thread_once_t * const once) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!routine) return F_status_set_error(F_parameter);
+ if (!once) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const int error = pthread_once(once, routine);
+
+ if (error) {
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_once_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_f_thread_once_t_
/**
- * An array of thread onces.
+ * Call the given routine only one time and never again.
*
- * Properties:
- * - array: The array of f_thread_once_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * Subsequent calls will not call the given routine.
+ *
+ * @param routine
+ * The callback.
+ * @param once
+ * The once variable designating that the given routine will be called only once.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_once()
*/
-#ifndef _di_f_thread_onces_t_
- typedef struct {
- f_thread_once_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_onces_t;
-
- #define f_thread_onces_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_onces_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_onces_t_initialize_2(array, length) { array, length, length }
-
- #define macro_f_thread_onces_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_onces_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_onces_t_
-
+#ifndef _di_f_thread_once_
+ extern f_status_t f_thread_once(const f_void_call_t routine, f_thread_once_t * const once);
+#endif // _di_f_thread_once_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_once_h
+#define _F_thread_once_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread onces.
+ *
+ * Properties:
+ * - array: The array of f_thread_once_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_onces_t_
+ typedef struct {
+ f_thread_once_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_onces_t;
+
+ #define f_thread_onces_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_onces_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_onces_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_onces_t_
+
+// @todo add delete & destroy callbacks.
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_once_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_once_h
+#define _F_thread_once_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread onces.
+ *
+ * Properties:
+ * - array: The array of f_thread_onces_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_oncess_t_
+ typedef struct {
+ f_thread_onces_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_oncess_t;
+
+ #define f_thread_oncess_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_oncess_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_oncess_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_oncess_t_
+
+// @todo add delete & destroy callbacks.
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_once_h
#include "../thread.h"
-#include "semaphore.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_semaphores_delete_callback_
- f_status_t f_thread_semaphores_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_semaphore_create_
+ f_status_t f_thread_semaphore_create(const bool shared, const unsigned int value, f_thread_semaphore_t * const semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_semaphore_t * const array = (f_thread_semaphore_t *) void_array;
+ if (sem_init(semaphore, shared, value) == -1) {
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+ if (errno == ENOSYS) return F_status_set_error(F_support_not);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (sem_destroy(&array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_semaphores_delete_callback_
+#endif // _di_f_thread_semaphore_create_
-#ifndef _di_f_thread_semaphores_destroy_callback_
- f_status_t f_thread_semaphores_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_semaphore_delete_
+ f_status_t f_thread_semaphore_delete(f_thread_semaphore_t * const semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_semaphore_t * const array = (f_thread_semaphore_t *) void_array;
+ if (sem_destroy(semaphore) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (sem_destroy(&array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
- } // for
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphore_delete_
+
+#ifndef _di_f_thread_semaphore_file_close_
+ f_status_t f_thread_semaphore_file_close(f_thread_semaphore_t * const semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (sem_close(semaphore) == -1) {
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphore_file_close_
+
+#ifndef _di_f_thread_semaphore_file_delete_
+ f_status_t f_thread_semaphore_file_delete(const f_string_static_t name) {
+
+ if (sem_unlink(name.string) == -1) {
+ if (errno == EACCES) return F_status_set_error(F_access_denied);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+ if (errno == ENAMETOOLONG) return F_status_set_error(F_name_not);
+ if (errno == ENOENT) return F_file_found_not;
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphore_file_delete_
+
+#ifndef _di_f_thread_semaphore_file_open_
+ f_status_t f_thread_semaphore_file_open(const f_string_static_t name, const int flag, mode_t * const mode, unsigned int value, f_thread_semaphore_t ** const semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ if ((flag & O_CREAT) && !mode) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if ((flag & O_CREAT) || mode) {
+ *semaphore = sem_open(name.string, flag, mode, value);
+ }
+ else {
+ *semaphore = sem_open(name.string, flag);
+ }
+
+ if (*semaphore == SEM_FAILED) {
+ if (errno == EACCES) return F_status_set_error(F_access_denied);
+ if (errno == EEXIST) return F_status_set_error(F_file_found);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+ if (errno == EMFILE) return F_status_set_error(F_file_descriptor_max);
+ if (errno == ENAMETOOLONG) return F_status_set_error(F_name_not);
+ if (errno == ENFILE) return F_status_set_error(F_file_open_max);
+ if (errno == ENOENT) return F_status_set_error(F_file_found_not);
+ if (errno == ENOMEM) return F_status_set_error(F_memory_not);
+
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_semaphores_destroy_callback_
+#endif // _di_f_thread_semaphore_file_open_
+
+#ifndef _di_f_thread_semaphore_lock_
+ f_status_t f_thread_semaphore_lock(f_thread_semaphore_t * const semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_semaphoress_delete_callback_
- f_status_t f_thread_semaphoress_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ if (sem_wait(semaphore) == -1) {
+ if (errno == EINTR) return F_status_set_error(F_interrupt);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
- {
- f_thread_semaphores_t * const array = (f_thread_semaphores_t *) void_array;
- f_number_unsigned_t j = 0;
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphore_lock_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+#ifndef _di_f_thread_semaphore_lock_timed_
+ f_status_t f_thread_semaphore_lock_timed(const f_time_spec_t * const timeout, f_thread_semaphore_t * const semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!timeout) return F_status_set_error(F_parameter);
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (j = 0; j < array[i].size; ++j) {
- if (sem_destroy(&array[i].array[j]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
- } // for
+ if (sem_timedwait(semaphore, timeout) == -1) {
+ if (errno == EINTR) return F_status_set_error(F_interrupt);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+ if (errno == ETIMEDOUT) return F_time;
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_semaphore_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_semaphoress_delete_callback_
+#endif // _di_f_thread_semaphore_lock_timed_
+
+#ifndef _di_f_thread_semaphore_lock_try_
+ f_status_t f_thread_semaphore_lock_try(f_thread_semaphore_t * const semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_semaphoress_destroy_callback_
- f_status_t f_thread_semaphoress_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ if (sem_trywait(semaphore) == -1) {
+ if (errno == EAGAIN) return F_status_set_error(F_resource_not);
+ if (errno == EINTR) return F_status_set_error(F_interrupt);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
- {
- f_thread_semaphores_t * const array = (f_thread_semaphores_t *) void_array;
- f_number_unsigned_t j = 0;
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphore_lock_try_
+
+#ifndef _di_f_thread_semaphore_unlock_
+ f_status_t f_thread_semaphore_unlock(f_thread_semaphore_t * const semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (sem_post(semaphore) == -1) {
+ if (errno == EOVERFLOW) return F_status_set_error(F_number_overflow);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphore_unlock_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+#ifndef _di_f_thread_semaphore_value_get_
+ f_status_t f_thread_semaphore_value_get(f_thread_semaphore_t * const semaphore, int * const value) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ if (!value) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (j = 0; j < array[i].size; ++j) {
- if (sem_destroy(&array[i].array[j]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
- } // for
+ if (sem_getvalue(semaphore, value) == -1) {
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_semaphore_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_semaphoress_destroy_callback_
+#endif // _di_f_thread_semaphore_value_get_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_semaphore_t_
/**
- * An array of thread semaphorees.
+ * Create a thread semaphore.
*
- * Properties:
- * - array: The array of f_thread_semaphore_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * @param shared
+ * If TRUE, then the semaphore is shared between processes (stored as posix shared memory, memory mapped, etc..).
+ * IF FALSE, then the semphore is shared between threads of a process (stored as a global variable or in the heap).
+ * Not all systems support semaphores shared amongst processes.
+ * @param value
+ * The value to initially assign the semaphore on creation.
+ * @param semaphore
+ * The semaphore to create.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_support_not (with error bit) if the system does not support the process shared semaphore (shared == true).
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see sem_init()
+ */
+#ifndef _di_f_thread_semaphore_create_
+ extern f_status_t f_thread_semaphore_create(const bool shared, const unsigned int value, f_thread_semaphore_t * const semaphore);
+#endif // _di_f_thread_semaphore_create_
+
+/**
+ * Delete a thread semaphore.
+ *
+ * The sem_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
+ *
+ * @param semaphore
+ * The semaphore to delete.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_busy (with error bit) if the semaphore is busy.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see sem_destroy()
*/
-#ifndef _di_f_thread_semaphores_t_
- typedef struct {
- f_thread_semaphore_t *array;
+#ifndef _di_f_thread_semaphore_delete_
+ extern f_status_t f_thread_semaphore_delete(f_thread_semaphore_t * const semaphore);
+#endif // _di_f_thread_semaphore_delete_
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_semaphores_t;
+/**
+ * Close a thread (named) semaphore file.
+ *
+ * A named semaphore should be deleted with f_thread_semephore_file_destroy().
+ *
+ * @param semaphore
+ * The semaphore to delete.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see sem_close()
+ */
+#ifndef _di_f_thread_semaphore_file_close_
+ extern f_status_t f_thread_semaphore_file_close(f_thread_semaphore_t * const semaphore);
+#endif // _di_f_thread_semaphore_file_close_
- #define f_thread_semaphores_t_initialize { 0, 0, 0 }
+/**
+ * Delete a thread (named) semaphore.
+ *
+ * This deletes the semaphore file and all processes holding this semaphore will be forcibly closed.
+ *
+ * @param name
+ * The semaphore name to delete.
+ *
+ * @return
+ * F_okay on success.
+ * F_file_found_not the named file was not found.
+ *
+ * F_access_denied (with error bit) on access denied.
+ * F_name_not (with error bit) if file name is too long.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see sem_unlink()
+ */
+#ifndef _di_f_thread_semaphore_file_delete_
+ extern f_status_t f_thread_semaphore_file_delete(const f_string_static_t name);
+#endif // _di_f_thread_semaphore_file_delete_
- #define macro_f_thread_semaphores_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_semaphores_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_semaphores_t_
+/**
+ * Open or create a thread (named) semaphore file.
+ *
+ * @param name
+ * The semaphore file name to create.
+ * @param flag
+ * The file create/open flags.
+ * Pass the O_CREATE flag to create the semaphore file.
+ * @param mode
+ * (optional) The file permissions to assign the semaphore.
+ * Ignored if O_CREAT is not used in flag.
+ * Ignored if the named semaphore already exists.
+ * Not optional when O_CREAT flag is set.
+ *
+ * Set to NULL to not use.
+ * @param value
+ * (optional) The value to initially assign the semaphore on creation.
+ * Ignored if O_CREAT is not used in flag.
+ * Ignored if the named semaphore already exists.
+ * Not optional when O_CREAT flag is set.
+ * Ignored when mode is NULL.
+ * @param semaphore
+ * The thread semaphore.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_access_denied (with error bit) on access denied.
+ * F_file_descriptor_max (with error bit) if max file descrriptors was reached.
+ * F_file_found (with error bit) if the file was found and both the O_CREAT and O_EXCL flags are set.
+ * F_file_open_max (with error bit) too many open files.
+ * F_file_found_not (with error bit) if the file was not found and the O_CREAT is not set.
+ * F_name_not (with error bit) if file name is too long.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_support_not (with error bit) if the system does not support the process shared semaphore (shared == true).
+ * F_memory_not (with error bit) if out of memory.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see sem_open()
+ */
+#ifndef _di_f_thread_semaphore_file_open_
+ extern f_status_t f_thread_semaphore_file_open(const f_string_static_t name, const int flag, mode_t * const mode, unsigned int value, f_thread_semaphore_t ** const semaphore);
+#endif // _di_f_thread_semaphore_file_open_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_semaphores_t structure.
+ * Lock the semaphore.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * This is a blocking function.
*
- * This does not do parameter checking.
+ * This causes the semaphore value to decrement.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param semaphore
+ * The thread semaphore.
*
* Must not be NULL.
*
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ * F_interrupt (with error bit) if returned due to an interrupt signal.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see sem_wait()
*/
-#ifndef _di_f_thread_semaphores_delete_callback_
- extern f_status_t f_thread_semaphores_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_semaphores_delete_callback_
+#ifndef _di_f_thread_semaphore_lock_
+ extern f_status_t f_thread_semaphore_lock(f_thread_semaphore_t * const semaphore);
+#endif // _di_f_thread_semaphore_lock_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_semaphores_t structure.
+ * Lock the semaphore, waiting for a set period of time to get the lock if already locked.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * If the semaphore is already locked and the timeout expires, then the lock attempt fails.
*
- * This does not do parameter checking.
+ * This is a blocking function (until timeout expires).
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param timeout
+ * The timeout.
+ * @param semaphore
+ * The thread semaphore.
*
* Must not be NULL.
*
* @return
* F_okay on success.
+ * F_time if the timeout was reached before obtaining the lock.
*
* F_parameter (with error bit) if a parameter is invalid.
+ * F_interrupt (with error bit) if returned due to an interrupt signal.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see sem_timedwait()
*/
-#ifndef _di_f_thread_semaphores_destroy_callback_
- extern f_status_t f_thread_semaphores_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_semaphores_destroy_callback_
+#ifndef _di_f_thread_semaphore_lock_timed_
+ extern f_status_t f_thread_semaphore_lock_timed(const f_time_spec_t * const timeout, f_thread_semaphore_t * const semaphore);
+#endif // _di_f_thread_semaphore_lock_timed_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_semaphoress_t structure.
+ * Try to lock the semaphore.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * If semaphore is already locked, return immediately.
*
- * This does not do parameter checking.
+ * This is a non-blocking function.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param semaphore
+ * The thread semaphore.
*
* Must not be NULL.
*
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ * F_interrupt (with error bit) if returned due to an interrupt signal.
+ * F_resource_not (with error bit) if max semaphore locks is reached.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see sem_trywait()
*/
-#ifndef _di_f_thread_semaphoress_delete_callback_
- extern f_status_t f_thread_semaphoress_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_semaphoress_delete_callback_
+#ifndef _di_f_thread_semaphore_lock_try_
+ extern f_status_t f_thread_semaphore_lock_try(f_thread_semaphore_t * const semaphore);
+#endif // _di_f_thread_semaphore_lock_try_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_semaphoress_t structure.
+ * Unlock the semaphore.
+ *
+ * This causes the semaphore value to increment.
+ *
+ * @param semaphore
+ * The thread semaphore.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * F_number_overflow (with error bit) if max semaphore value is reached.
+ * F_parameter (with error bit) if a parameter is invalid.
*
- * This does not do parameter checking.
+ * F_failure (with error bit) on any other error.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @see sem_post()
+ */
+#ifndef _di_f_thread_semaphore_unlock_
+ extern f_status_t f_thread_semaphore_unlock(f_thread_semaphore_t * const semaphore);
+#endif // _di_f_thread_semaphore_unlock_
+
+/**
+ * Get the semaphore value.
+ *
+ * @param semaphore
+ * The thread semaphore.
+ *
+ * Must not be NULL.
+ * @param value
+ * The semaphore's value.
*
* Must not be NULL.
*
*
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see sem_getvalue()
*/
-#ifndef _di_f_thread_semaphoress_destroy_callback_
- extern f_status_t f_thread_semaphoress_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_semaphoress_destroy_callback_
+#ifndef _di_f_thread_semaphore_value_get_
+ extern f_status_t f_thread_semaphore_value_get(f_thread_semaphore_t * const semaphore, int * const value);
+#endif // _di_f_thread_semaphore_value_get_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_semaphores_delete_callback_
+ f_status_t f_thread_semaphores_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_semaphore_t * const array = (f_thread_semaphore_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (sem_destroy(&array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphores_delete_callback_
+
+#ifndef _di_f_thread_semaphores_destroy_callback_
+ f_status_t f_thread_semaphores_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_semaphore_t * const array = (f_thread_semaphore_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (sem_destroy(&array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphores_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_semaphores_h
+#define _F_thread_semaphores_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread semaphores.
+ *
+ * Properties:
+ * - array: The array of f_thread_semaphore_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_semaphores_t_
+ typedef struct {
+ f_thread_semaphore_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_semaphores_t;
+
+ #define f_thread_semaphores_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_semaphores_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_semaphores_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_semaphores_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_semaphores_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_semaphores_delete_callback_
+ extern f_status_t f_thread_semaphores_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_semaphores_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_semaphores_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_semaphores_destroy_callback_
+ extern f_status_t f_thread_semaphores_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_semaphores_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_semaphores_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_semaphoress_delete_callback_
+ f_status_t f_thread_semaphoress_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_semaphores_t * const array = (f_thread_semaphores_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (sem_destroy(&array[i].array[j]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_semaphore_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphoress_delete_callback_
+
+#ifndef _di_f_thread_semaphoress_destroy_callback_
+ f_status_t f_thread_semaphoress_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_semaphores_t * const array = (f_thread_semaphores_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (sem_destroy(&array[i].array[j]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_semaphore_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_semaphoress_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_semaphoress_h
+#define _F_thread_semaphoress_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread semaphores.
+ *
+ * Properties:
+ * - array: The array of f_thread_semaphores_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_semaphoress_t_
+ typedef struct {
+ f_thread_semaphores_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_semaphoress_t;
+
+ #define f_thread_semaphoress_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_semaphoress_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_semaphoress_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_semaphoress_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_semaphoress_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_semaphoress_delete_callback_
+ extern f_status_t f_thread_semaphoress_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_semaphoress_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_semaphoress_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_semaphoress_destroy_callback_
+ extern f_status_t f_thread_semaphoress_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_semaphoress_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_semaphoress_h
#include "../thread.h"
-#include "set.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_sets_delete_callback_
- f_status_t f_thread_sets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_set_t * const array = (f_thread_set_t *) void_array;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_attr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_sets_delete_callback_
-
-#ifndef _di_f_thread_sets_destroy_callback_
- f_status_t f_thread_sets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_set_t * const array = (f_thread_set_t *) void_array;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
- if (pthread_attr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
- } // for
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_sets_destroy_callback_
-
-#ifndef _di_f_thread_setss_delete_callback_
- f_status_t f_thread_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_sets_t * const array = (f_thread_sets_t *) void_array;
- f_number_unsigned_t j = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_attr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_set_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_setss_delete_callback_
-
-#ifndef _di_f_thread_setss_destroy_callback_
- f_status_t f_thread_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_sets_t * const array = (f_thread_sets_t *) void_array;
- f_number_unsigned_t j = 0;
-
- for (f_number_unsigned_t i = start; i < stop; ++i) {
-
- for (j = 0; j < array[i].size; ++j) {
- if (pthread_attr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_set_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
- }
-
- return F_okay;
- }
-#endif // _di_f_thread_setss_destroy_callback_
-
#ifdef __cplusplus
} // extern "C"
#endif
result = 0;
#endif // _di_f_thread_set_t_
-/**
- * An array of f_thread_set_t.
- *
- * Properties:
- * - array: The array of f_thread_set_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_thread_sets_t_
- typedef struct {
- f_thread_set_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_sets_t;
-
- #define f_thread_sets_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_sets_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_sets_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_sets_t_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_sets_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- */
-#ifndef _di_f_thread_sets_delete_callback_
- extern f_status_t f_thread_sets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_sets_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_sets_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- */
-#ifndef _di_f_thread_sets_destroy_callback_
- extern f_status_t f_thread_sets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_sets_destroy_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_setss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- */
-#ifndef _di_f_thread_setss_delete_callback_
- extern f_status_t f_thread_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_setss_delete_callback_
-
-/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_setss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
- *
- * Must not be NULL.
- *
- * @return
- * F_okay on success.
- *
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_memory_array_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
- */
-#ifndef _di_f_thread_setss_destroy_callback_
- extern f_status_t f_thread_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_setss_destroy_callback_
-
#ifdef __cplusplus
} // extern "C"
#endif
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_sets_delete_callback_
+ f_status_t f_thread_sets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_set_t * const array = (f_thread_set_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_attr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_sets_delete_callback_
+
+#ifndef _di_f_thread_sets_destroy_callback_
+ f_status_t f_thread_sets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_set_t * const array = (f_thread_set_t *) void_array;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (pthread_attr_destroy(&array[i].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_sets_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_sets_h
+#define _F_thread_sets_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of f_thread_set_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_set_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_sets_t_
+ typedef struct {
+ f_thread_set_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_sets_t;
+
+ #define f_thread_sets_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_sets_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_sets_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_sets_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_sets_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_sets_delete_callback_
+ extern f_status_t f_thread_sets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_sets_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_sets_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_sets_destroy_callback_
+ extern f_status_t f_thread_sets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_sets_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_sets_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_setss_delete_callback_
+ f_status_t f_thread_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_sets_t * const array = (f_thread_sets_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_attr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_set_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_setss_delete_callback_
+
+#ifndef _di_f_thread_setss_destroy_callback_
+ f_status_t f_thread_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_sets_t * const array = (f_thread_sets_t *) void_array;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+ if (pthread_attr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure);
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_set_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_setss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_setss_h
+#define _F_thread_setss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of f_thread_sets_t.
+ *
+ * Properties:
+ * - array: The array of f_thread_sets_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_setss_t_
+ typedef struct {
+ f_thread_sets_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_setss_t;
+
+ #define f_thread_setss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_setss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_setss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_setss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_setss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_setss_delete_callback_
+ extern f_status_t f_thread_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_setss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_setss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_setss_destroy_callback_
+ extern f_status_t f_thread_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_setss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_setss_h
#include "../thread.h"
-#include "spin.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_thread_spins_delete_callback_
- f_status_t f_thread_spins_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#ifndef _di_f_thread_spin_create_
+ f_status_t f_thread_spin_create(const int shared, f_thread_spin_t * const spin) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!spin) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- {
- f_thread_spin_t * const array = (f_thread_spin_t *) void_array;
- int error = 0;
+ const int error = pthread_spin_init(spin, shared);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == ENOMEM) return F_status_set_error(F_memory_not);
- error = pthread_spin_destroy(&array[i]);
-
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_spins_delete_callback_
-
-#ifndef _di_f_thread_spins_destroy_callback_
- f_status_t f_thread_spins_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+#endif // _di_f_thread_spin_create_
- {
- f_thread_spin_t * const array = (f_thread_spin_t *) void_array;
- int error = 0;
+#ifndef _di_f_thread_spin_delete_
+ f_status_t f_thread_spin_delete(f_thread_spin_t * const spin) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!spin) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ const int error = pthread_spin_destroy(spin);
- error = pthread_spin_destroy(&array[i]);
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_spins_destroy_callback_
-
-#ifndef _di_f_thread_spinss_delete_callback_
- f_status_t f_thread_spinss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
-
- {
- f_thread_spins_t * const array = (f_thread_spins_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+#endif // _di_f_thread_spin_delete_
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+#ifndef _di_f_thread_spin_lock_
+ f_status_t f_thread_spin_lock(f_thread_spin_t * const spin) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!spin) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- for (j = 0; j < array[i].size; ++j) {
+ const int error = pthread_spin_lock(spin);
- error = pthread_spin_destroy(&array[i].array[j]);
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EDEADLK) return F_status_set_error(F_deadlock);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
-
- return F_status_set_error(F_failure);
- }
- } // for
-
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_spin_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_spinss_delete_callback_
+#endif // _di_f_thread_spin_lock_
+
+#ifndef _di_f_thread_spin_lock_try_
+ f_status_t f_thread_spin_lock_try(f_thread_spin_t * const spin) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!spin) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
-#ifndef _di_f_thread_spinss_destroy_callback_
- f_status_t f_thread_spinss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+ const int error = pthread_spin_trylock(spin);
- {
- f_thread_spins_t * const array = (f_thread_spins_t *) void_array;
- int error = 0;
- f_number_unsigned_t j = 0;
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_busy;
+ if (error == EINVAL) return F_status_set_error(F_parameter);
- for (f_number_unsigned_t i = start; i < stop; ++i) {
+ return F_status_set_error(F_failure);
+ }
- for (j = 0; j < array[i].size; ++j) {
+ return F_okay;
+ }
+#endif // _di_f_thread_spin_lock_try_
- error = pthread_spin_destroy(&array[i].array[j]);
+#ifndef _di_f_thread_spin_unlock_
+ f_status_t f_thread_spin_unlock(f_thread_spin_t * const spin) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!spin) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
- if (error) {
- if (error == EBUSY) return F_status_set_error(F_busy);
- if (error == EINVAL) return F_status_set_error(F_parameter);
+ const int error = pthread_spin_unlock(spin);
- return F_status_set_error(F_failure);
- }
- } // for
+ if (error) {
+ if (error == EAGAIN) return F_status_set_error(F_resource_not);
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+ if (error == EPERM) return F_status_set_error(F_prohibited);
- if (array[i].size && array[i].array) {
- const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_spin_t), (void **) &array[i].array, &array[i].used, &array[i].size);
- if (F_status_is_error(status)) return status;
- }
- } // for
+ return F_status_set_error(F_failure);
}
return F_okay;
}
-#endif // _di_f_thread_spinss_destroy_callback_
+#endif // _di_f_thread_spin_unlock_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_thread_spin_t_
/**
- * An array of thread spins.
+ * Create a thread spin lock.
*
- * Properties:
- * - array: The array of f_thread_spin_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
+ * @param shared
+ * The shared process setting.
+ * @param spin
+ * The spin to create.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_memory_not (with error bit) if out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max spines is reached.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * @see pthread_spin_init()
*/
-#ifndef _di_f_thread_spins_t_
- typedef struct {
- f_thread_spin_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_thread_spins_t;
-
- #define f_thread_spins_t_initialize { 0, 0, 0 }
-
- #define macro_f_thread_spins_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_thread_spins_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_thread_spins_t_
+#ifndef _di_f_thread_spin_create_
+ extern f_status_t f_thread_spin_create(const int shared, f_thread_spin_t * const spin);
+#endif // _di_f_thread_spin_create_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_spins_t structure.
+ * Delete a thread spin lock.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * The pthread_spin_destroy() function has no distinction like the *_destroy() and the *_delete() used by the FLL project.
+ * Therefore there is only this function for both deleting and destroying.
*
- * This does not do parameter checking.
- *
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param spin
+ * The spin to delete.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
+ * F_busy (with error bit) if the spin is busy.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_spin_destroy()
*/
-#ifndef _di_f_thread_spins_delete_callback_
- extern f_status_t f_thread_spins_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_spins_delete_callback_
+#ifndef _di_f_thread_spin_delete_
+ extern f_status_t f_thread_spin_delete(f_thread_spin_t * const spin);
+#endif // _di_f_thread_spin_delete_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_spins_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
+ * Lock the spin lock.
*
- * This does not do parameter checking.
+ * This is a blocking function.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param spin
+ * The thread spin.
*
* Must not be NULL.
*
* @return
* F_okay on success.
*
+ * F_deadlock (with error bit) if operation would cause a deadlock.
* F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max spin locks is reached.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_spin_lock()
*/
-#ifndef _di_f_thread_spins_destroy_callback_
- extern f_status_t f_thread_spins_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_spins_destroy_callback_
+#ifndef _di_f_thread_spin_lock_
+ extern f_status_t f_thread_spin_lock(f_thread_spin_t * const spin);
+#endif // _di_f_thread_spin_lock_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_spinss_t structure.
+ * Try to lock the spin lock.
*
- * This is only called when shrinking the array and generally should perform deallocations.
+ * If spin is already locked, return immediately.
*
- * This does not do parameter checking.
+ * This is a non-blocking function.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param spin
+ * The thread spin.
*
* Must not be NULL.
*
* @return
* F_okay on success.
+ * F_busy on success, but the spin is already locked.
*
* F_parameter (with error bit) if a parameter is invalid.
+ * F_resource_not (with error bit) if max spin locks is reached.
*
- * Errors (with error bit) from: f_memory_array_resize().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
+ * @see pthread_spin_trylock()
*/
-#ifndef _di_f_thread_spinss_delete_callback_
- extern f_status_t f_thread_spinss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_spinss_delete_callback_
+#ifndef _di_f_thread_spin_lock_try_
+ extern f_status_t f_thread_spin_lock_try(f_thread_spin_t * const spin);
+#endif // _di_f_thread_spin_lock_try_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_spinss_t structure.
- *
- * This is only called when shrinking the array and generally should perform deallocations.
- *
- * This does not do parameter checking.
+ * Unlock the spin lock.
*
- * @param start
- * The inclusive start position in the array to start deleting.
- * @param stop
- * The exclusive stop position in the array to stop deleting.
- * @param array
- * The array structure to delete all values of.
+ * @param spin
+ * The thread spin.
*
* Must not be NULL.
*
* F_okay on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ * F_prohibited (with error bit) if not allowed to perform the operation (possibly because spin is not owned by current thread).
+ * F_resource_not (with error bit) if max spin locks is reached.
*
- * Errors (with error bit) from: f_memory_array_adjust().
+ * F_failure (with error bit) on any other error.
*
- * @see f_memory_array_adjust()
- * @see f_memory_arrays_adjust()
+ * @see pthread_spin_unlock()
*/
-#ifndef _di_f_thread_spinss_destroy_callback_
- extern f_status_t f_thread_spinss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
-#endif // _di_f_thread_spinss_destroy_callback_
+#ifndef _di_f_thread_spin_unlock_
+ extern f_status_t f_thread_spin_unlock(f_thread_spin_t * const spin);
+#endif // _di_f_thread_spin_unlock_
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_spins_delete_callback_
+ f_status_t f_thread_spins_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_spin_t * const array = (f_thread_spin_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_spin_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_spins_delete_callback_
+
+#ifndef _di_f_thread_spins_destroy_callback_
+ f_status_t f_thread_spins_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_spin_t * const array = (f_thread_spin_t *) void_array;
+ int error = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ error = pthread_spin_destroy(&array[i]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_spins_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_spins_h
+#define _F_thread_spins_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of thread spins.
+ *
+ * Properties:
+ * - array: The array of f_thread_spin_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_spins_t_
+ typedef struct {
+ f_thread_spin_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_spins_t;
+
+ #define f_thread_spins_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_spins_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_spins_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_spins_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_spins_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_spins_delete_callback_
+ extern f_status_t f_thread_spins_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_spins_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_spins_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_spins_destroy_callback_
+ extern f_status_t f_thread_spins_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_spins_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_spins_h
--- /dev/null
+#include "../thread.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_thread_spinss_delete_callback_
+ f_status_t f_thread_spinss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_spins_t * const array = (f_thread_spins_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_spin_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_spin_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_spinss_delete_callback_
+
+#ifndef _di_f_thread_spinss_destroy_callback_
+ f_status_t f_thread_spinss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ f_thread_spins_t * const array = (f_thread_spins_t *) void_array;
+ int error = 0;
+ f_number_unsigned_t j = 0;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ for (j = 0; j < array[i].size; ++j) {
+
+ error = pthread_spin_destroy(&array[i].array[j]);
+
+ if (error) {
+ if (error == EBUSY) return F_status_set_error(F_busy);
+ if (error == EINVAL) return F_status_set_error(F_parameter);
+
+ return F_status_set_error(F_failure);
+ }
+ } // for
+
+ if (array[i].size && array[i].array) {
+ const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_spin_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+
+ return F_okay;
+ }
+#endif // _di_f_thread_spinss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by POSIX thread related functionality.
+ *
+ * This is auto-included by thread.h and should not need to be explicitly included.
+ */
+#ifndef _F_thread_spinss_h
+#define _F_thread_spinss_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * An array of an array of thread spins.
+ *
+ * Properties:
+ * - array: The array of f_thread_spins_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_thread_spinss_t_
+ typedef struct {
+ f_thread_spins_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_thread_spinss_t;
+
+ #define f_thread_spinss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_thread_spinss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_thread_spinss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_thread_spinss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_spinss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_resize().
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_f_thread_spinss_delete_callback_
+ extern f_status_t f_thread_spinss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_spinss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_spinss_t structure.
+ *
+ * This is only called when shrinking the array and generally should perform deallocations.
+ *
+ * This does not do parameter checking.
+ *
+ * @param start
+ * The inclusive start position in the array to start deleting.
+ * @param stop
+ * The exclusive stop position in the array to stop deleting.
+ * @param array
+ * The array structure to delete all values of.
+ *
+ * Must not be NULL.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_array_adjust().
+ *
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
+ */
+#ifndef _di_f_thread_spinss_destroy_callback_
+ extern f_status_t f_thread_spinss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_thread_spinss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_thread_spinss_h
build_libraries_static -l:libc.a
build_libraries_static-individual -l:libf_memory.a -l:libf_string.a
-build_sources_library thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/barrier_full.c thread/condition.c thread/condition_attribute.c thread/condition_full.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/lock_full.c thread/mutex.c thread/mutex_attribute.c thread/mutex_full.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c
-
-build_sources_headers thread.h thread/attribute.h thread/barrier.h thread/barrier_attribute.h thread/barrier_full.h thread/condition.h thread/condition_attribute.h thread/condition_full.h thread/id.h thread/key.h thread/lock.h thread/lock_attribute.h thread/lock_full.h thread/mutex.h thread/mutex_attribute.h thread/mutex_full.h thread/once.h thread/semaphore.h thread/set.h thread/spin.h
+build_sources_library thread.c
+build_sources_library thread/attribute.c thread/attributes.c thread/attributess.c
+build_sources_library thread/barrier.c thread/barriers.c thread/barrierss.c thread/barrier_attribute.c thread/barrier_attributes.c thread/barrier_attributess.c thread/barrier_full.c thread/barrier_fulls.c thread/barrier_fullss.c
+build_sources_library thread/condition.c thread/conditions.c thread/conditionss.c thread/condition_attribute.c thread/condition_attributes.c thread/condition_attributess.c thread/condition_full.c thread/condition_fulls.c thread/condition_fullss.c
+build_sources_library thread/id.c thread/ids.c thread/idss.c
+build_sources_library thread/key.c thread/keys.c thread/keyss.c
+build_sources_library thread/lock.c thread/locks.c thread/lockss.c thread/lock_attribute.c thread/lock_attributes.c thread/lock_attributess.c thread/lock_full.c thread/lock_fulls.c thread/lock_fullss.c
+build_sources_library thread/mutex.c thread/mutexs.c thread/mutexss.c thread/mutex_attribute.c thread/mutex_attributes.c thread/mutex_attributess.c thread/mutex_full.c thread/mutex_fulls.c thread/mutex_fullss.c
+build_sources_library thread/once.c thread/onces.c thread/oncess.c
+build_sources_library thread/semaphore.c thread/semaphores.c thread/semaphoress.c
+build_sources_library thread/set.c thread/sets.c thread/setss.c
+build_sources_library thread/spin.c thread/spins.c thread/spinss.c
+
+build_sources_headers thread.h
+build_sources_headers thread/attribute.h thread/attributes.h thread/attributess.h
+build_sources_headers thread/barrier.h thread/barriers.h thread/barrierss.h thread/barrier_attribute.h thread/barrier_attributes.h thread/barrier_attributess.h thread/barrier_full.h thread/barrier_fulls.h thread/barrier_fullss.h
+build_sources_headers thread/condition.h thread/conditions.h thread/conditionss.h thread/condition_attribute.h thread/condition_attributes.h thread/condition_attributess.h thread/condition_full.h thread/condition_fulls.h thread/condition_fullss.h
+build_sources_headers thread/id.h thread/ids.h thread/idss.h
+build_sources_headers thread/key.h thread/keys.h thread/keyss.h
+build_sources_headers thread/lock.h thread/locks.h thread/lockss.h thread/lock_attribute.h thread/lock_attributes.h thread/lock_attributess.h thread/lock_full.h thread/lock_fulls.h thread/lock_fullss.h
+build_sources_headers thread/mutex.h thread/mutexs.h thread/mutexss.h thread/mutex_attribute.h thread/mutex_attributes.h thread/mutex_attributess.h thread/mutex_full.h thread/mutex_fulls.h thread/mutex_fullss.h
+build_sources_headers thread/once.h thread/onces.h thread/oncess.h
+build_sources_headers thread/semaphore.h thread/semaphores.h thread/semaphoress.h
+build_sources_headers thread/set.h thread/sets.h thread/setss.h
+build_sources_headers thread/spin.h thread/spins.h thread/spinss.h
build_script yes
build_shared yes
build_libraries -pthread -lc
build_libraries-individual -lf_memory -lf_string
-build_sources_library thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/barrier_full.c thread/condition.c thread/condition_attribute.c thread/condition_full.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/lock_full.c thread/mutex.c thread/mutex_attribute.c thread/mutex_full.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c
+build_sources_library thread.c
+build_sources_library thread/attribute.c thread/attributes.c thread/attributess.c
+build_sources_library thread/barrier.c thread/barriers.c thread/barrierss.c thread/barrier_attribute.c thread/barrier_attributes.c thread/barrier_attributess.c thread/barrier_full.c thread/barrier_fulls.c thread/barrier_fullss.c
+build_sources_library thread/condition.c thread/conditions.c thread/conditionss.c thread/condition_attribute.c thread/condition_attributes.c thread/condition_attributess.c thread/condition_full.c thread/condition_fulls.c thread/condition_fullss.c
+build_sources_library thread/id.c thread/ids.c thread/idss.c
+build_sources_library thread/key.c thread/keys.c thread/keyss.c
+build_sources_library thread/lock.c thread/locks.c thread/lockss.c thread/lock_attribute.c thread/lock_attributes.c thread/lock_attributess.c thread/lock_full.c thread/lock_fulls.c thread/lock_fullss.c
+build_sources_library thread/mutex.c thread/mutexs.c thread/mutexss.c thread/mutex_attribute.c thread/mutex_attributes.c thread/mutex_attributess.c thread/mutex_full.c thread/mutex_fulls.c thread/mutex_fullss.c
+build_sources_library thread/once.c thread/onces.c thread/oncess.c
+build_sources_library thread/semaphore.c thread/semaphores.c thread/semaphoress.c
+build_sources_library thread/set.c thread/sets.c thread/setss.c
+build_sources_library thread/spin.c thread/spins.c thread/spinss.c
+
build_sources_library ../../tests/unit/c/mock-thread.c
-build_sources_headers thread.h thread/attribute.h thread/barrier.h thread/barrier_attribute.h thread/barrier_full.h thread/condition.h thread/condition_attribute.h thread/condition_full.h thread/id.h thread/key.h thread/lock.h thread/lock_attribute.h thread/lock_full.h thread/mutex.h thread/mutex_attribute.h thread/mutex_full.h thread/once.h thread/semaphore.h thread/set.h thread/spin.h
+build_sources_headers thread.h
+build_sources_headers thread/attribute.h thread/attributes.h thread/attributess.h
+build_sources_headers thread/barrier.h thread/barriers.h thread/barrierss.h thread/barrier_attribute.h thread/barrier_attributes.h thread/barrier_attributess.h thread/barrier_full.h thread/barrier_fulls.h thread/barrier_fullss.h
+build_sources_headers thread/condition.h thread/conditions.h thread/conditionss.h thread/condition_attribute.h thread/condition_attributes.h thread/condition_attributess.h thread/condition_full.h thread/condition_fulls.h thread/condition_fullss.h
+build_sources_headers thread/id.h thread/ids.h thread/idss.h
+build_sources_headers thread/key.h thread/keys.h thread/keyss.h
+build_sources_headers thread/lock.h thread/locks.h thread/lockss.h thread/lock_attribute.h thread/lock_attributes.h thread/lock_attributess.h thread/lock_full.h thread/lock_fulls.h thread/lock_fullss.h
+build_sources_headers thread/mutex.h thread/mutexs.h thread/mutexss.h thread/mutex_attribute.h thread/mutex_attributes.h thread/mutex_attributess.h thread/mutex_full.h thread/mutex_fulls.h thread/mutex_fullss.h
+build_sources_headers thread/once.h thread/onces.h thread/oncess.h
+build_sources_headers thread/semaphore.h thread/semaphores.h thread/semaphoress.h
+build_sources_headers thread/set.h thread/sets.h thread/setss.h
+build_sources_headers thread/spin.h thread/spins.h thread/spinss.h
build_script yes
build_shared yes
build_sources_program test-thread-attribute_stack_get.c test-thread-attribute_stack_set.c
build_sources_program test-thread-attribute_stack_size_get.c test-thread-attribute_stack_size_set.c
build_sources_program test-thread-attributes_destroy_callback.c test-thread-attributes_delete_callback.c
+build_sources_program test-thread-attributess_destroy_callback.c test-thread-attributess_delete_callback.c
build_sources_program test-thread-barrier_attribute_create.c test-thread-barrier_attribute_delete.c
build_sources_program test-thread-barrier_attribute_shared_get.c test-thread-barrier_attribute_shared_set.c
build_sources_program test-thread-barrier_attributes_destroy_callback.c test-thread-barrier_attributes_delete_callback.c
+build_sources_program test-thread-barrier_attributess_destroy_callback.c test-thread-barrier_attributess_delete_callback.c
build_sources_program test-thread-barrier_create.c test-thread-barrier_delete.c
build_sources_program test-thread-barrier_full_delete.c
build_sources_program test-thread-barrier_fulls_destroy_callback.c test-thread-barrier_fulls_delete_callback.c
+build_sources_program test-thread-barrier_fullss_destroy_callback.c test-thread-barrier_fullss_delete_callback.c
build_sources_program test-thread-barriers_destroy_callback.c test-thread-barriers_delete_callback.c
+build_sources_program test-thread-barrierss_destroy_callback.c test-thread-barrierss_delete_callback.c
build_sources_program test-thread-barrier_wait.c
build_sources_program test-thread-caller.c
build_sources_program test-thread-cancel.c
build_sources_program test-thread-condition_attribute_create.c test-thread-condition_attribute_delete.c
build_sources_program test-thread-condition_attribute_shared_get.c test-thread-condition_attribute_shared_set.c
build_sources_program test-thread-condition_attributes_destroy_callback.c test-thread-condition_attributes_delete_callback.c
+build_sources_program test-thread-condition_attributess_destroy_callback.c test-thread-condition_attributess_delete_callback.c
build_sources_program test-thread-condition_create.c test-thread-condition_delete.c
build_sources_program test-thread-condition_full_delete.c
build_sources_program test-thread-condition_fulls_destroy_callback.c test-thread-condition_fulls_delete_callback.c
+build_sources_program test-thread-condition_fullss_destroy_callback.c test-thread-condition_fullss_delete_callback.c
build_sources_program test-thread-condition_signal.c test-thread-condition_signal_all.c
build_sources_program test-thread-condition_wait.c test-thread-condition_wait_timed.c
build_sources_program test-thread-conditions_destroy_callback.c test-thread-conditions_delete_callback.c
+build_sources_program test-thread-conditionss_destroy_callback.c test-thread-conditionss_delete_callback.c
build_sources_program test-thread-create.c
build_sources_program test-thread-detach.c
build_sources_program test-thread-exit.c
build_sources_program test-thread-key_create.c test-thread-key_delete.c
build_sources_program test-thread-key_get.c test-thread-key_set.c
build_sources_program test-thread-keys_destroy_callback.c test-thread-keys_delete_callback.c
+build_sources_program test-thread-keyss_destroy_callback.c test-thread-keyss_delete_callback.c
build_sources_program test-thread-lock_attribute_create.c test-thread-lock_attribute_delete.c
build_sources_program test-thread-lock_attribute_shared_get.c test-thread-lock_attribute_shared_set.c
build_sources_program test-thread-lock_attributes_destroy_callback.c test-thread-lock_attributes_delete_callback.c
+build_sources_program test-thread-lock_attributess_destroy_callback.c test-thread-lock_attributess_delete_callback.c
build_sources_program test-thread-lock_create.c test-thread-lock_delete.c
build_sources_program test-thread-lock_full_delete.c
build_sources_program test-thread-lock_fulls_destroy_callback.c test-thread-lock_fulls_delete_callback.c
+build_sources_program test-thread-lock_fullss_destroy_callback.c test-thread-lock_fullss_delete_callback.c
build_sources_program test-thread-lock_read.c test-thread-lock_read_timed.c test-thread-lock_read_try.c
build_sources_program test-thread-lock_write.c test-thread-lock_write_timed.c test-thread-lock_write_try.c
build_sources_program test-thread-locks_destroy_callback.c test-thread-locks_delete_callback.c
+build_sources_program test-thread-lockss_destroy_callback.c test-thread-lockss_delete_callback.c
build_sources_program test-thread-mutex_attribute_create.c test-thread-mutex_attribute_delete.c
build_sources_program test-thread-mutex_attribute_priority_ceiling_get.c test-thread-mutex_attribute_priority_ceiling_set.c
build_sources_program test-thread-mutex_attribute_robust_get.c test-thread-mutex_attribute_robust_set.c
build_sources_program test-thread-mutex_create.c test-thread-mutex_delete.c
build_sources_program test-thread-mutex_lock.c test-thread-mutex_lock_timed.c test-thread-mutex_lock_try.c
build_sources_program test-thread-mutex_attributes_destroy_callback.c test-thread-mutex_attributes_delete_callback.c
+build_sources_program test-thread-mutex_attributess_destroy_callback.c test-thread-mutex_attributess_delete_callback.c
build_sources_program test-thread-mutex_full_delete.c
build_sources_program test-thread-mutex_fulls_destroy_callback.c test-thread-mutex_fulls_delete_callback.c
+build_sources_program test-thread-mutex_fullss_destroy_callback.c test-thread-mutex_fullss_delete_callback.c
build_sources_program test-thread-mutex_priority_ceiling_get.c test-thread-mutex_priority_ceiling_set.c
build_sources_program test-thread-mutexs_destroy_callback.c test-thread-mutexs_delete_callback.c
+build_sources_program test-thread-mutexss_destroy_callback.c test-thread-mutexss_delete_callback.c
build_sources_program test-thread-name_get.c test-thread-name_set.c
build_sources_program test-thread-once.c
build_sources_program test-thread-scheduler_parameter_get.c test-thread-scheduler_parameter_set.c
build_sources_program test-thread-semaphore_unlock.c
build_sources_program test-thread-semaphore_value_get.c
build_sources_program test-thread-semaphores_destroy_callback.c test-thread-semaphores_delete_callback.c
+build_sources_program test-thread-semaphoress_destroy_callback.c test-thread-semaphoress_delete_callback.c
build_sources_program test-thread-sets_destroy_callback.c test-thread-sets_delete_callback.c
+build_sources_program test-thread-setss_destroy_callback.c test-thread-setss_delete_callback.c
build_sources_program test-thread-signal_mask.c test-thread-signal_queue.c test-thread-signal_write.c
build_sources_program test-thread-spin_create.c test-thread-spin_delete.c
build_sources_program test-thread-spin_lock.c test-thread-spin_lock_try.c test-thread-spin_unlock.c
build_sources_program test-thread-spins_destroy_callback.c test-thread-spins_delete_callback.c
+build_sources_program test-thread-spinss_destroy_callback.c test-thread-spinss_delete_callback.c
build_sources_program test-thread.c
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attributess_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attributess_delete_callback__fails(void **state) {
+
+ f_thread_attribute_t data = f_thread_attribute_t_initialize;
+ f_thread_attribute_t data_array[] = { data };
+ f_thread_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_attributes_t datas_array[] = { datas };
+ f_thread_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_attributess_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_attributess_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_attributess_delete_callback__works(void **state) {
+
+ f_thread_attribute_t data = f_thread_attribute_t_initialize;
+ f_thread_attribute_t data_array[] = { data };
+ f_thread_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_attributes_t datas_array[] = { datas };
+ f_thread_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_attributess_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_attributess_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__attributess_delete_callback
+#define _TEST__F_thread__attributess_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_attributess_delete_callback_()
+ */
+extern void test__f_thread_attributess_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_attributess_delete_callback_()
+ */
+extern void test__f_thread_attributess_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__attributess_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attributess_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attributess_destroy_callback__fails(void **state) {
+
+ f_thread_attribute_t data = f_thread_attribute_t_initialize;
+ f_thread_attribute_t data_array[] = { data };
+ f_thread_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_attributes_t datas_array[] = { datas };
+ f_thread_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_attributess_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_attributess_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_attributess_destroy_callback__works(void **state) {
+
+ f_thread_attribute_t data = f_thread_attribute_t_initialize;
+ f_thread_attribute_t data_array[] = { data };
+ f_thread_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_attributes_t datas_array[] = { datas };
+ f_thread_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_attributess_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_attributess_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__attributess_destroy_callback
+#define _TEST__F_thread__attributess_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_attributess_destroy_callback_()
+ */
+extern void test__f_thread_attributess_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_attributess_destroy_callback_()
+ */
+extern void test__f_thread_attributess_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__attributess_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_attributess_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_attributess_delete_callback__fails(void **state) {
+
+ f_thread_barrier_attribute_t data = f_thread_barrier_attribute_t_initialize;
+ f_thread_barrier_attribute_t data_array[] = { data };
+ f_thread_barrier_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barrier_attributes_t datas_array[] = { datas };
+ f_thread_barrier_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrier_attributess_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_barrierattr_destroy, true);
+ will_return(__wrap_pthread_barrierattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_attributess_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_barrier_attributess_delete_callback__works(void **state) {
+
+ f_thread_barrier_attribute_t data = f_thread_barrier_attribute_t_initialize;
+ f_thread_barrier_attribute_t data_array[] = { data };
+ f_thread_barrier_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barrier_attributes_t datas_array[] = { datas };
+ f_thread_barrier_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrier_attributess_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_barrierattr_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_barrier_attributess_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__barrier_attributess_delete_callback
+#define _TEST__F_thread__barrier_attributess_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_barrier_attributess_delete_callback_()
+ */
+extern void test__f_thread_barrier_attributess_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_barrier_attributess_delete_callback_()
+ */
+extern void test__f_thread_barrier_attributess_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__barrier_attributess_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_attributess_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_attributess_destroy_callback__fails(void **state) {
+
+ f_thread_barrier_attribute_t data = f_thread_barrier_attribute_t_initialize;
+ f_thread_barrier_attribute_t data_array[] = { data };
+ f_thread_barrier_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barrier_attributes_t datas_array[] = { datas };
+ f_thread_barrier_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrier_attributess_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_barrierattr_destroy, true);
+ will_return(__wrap_pthread_barrierattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_attributess_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_barrier_attributess_destroy_callback__works(void **state) {
+
+ f_thread_barrier_attribute_t data = f_thread_barrier_attribute_t_initialize;
+ f_thread_barrier_attribute_t data_array[] = { data };
+ f_thread_barrier_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barrier_attributes_t datas_array[] = { datas };
+ f_thread_barrier_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrier_attributess_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_barrierattr_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_barrier_attributess_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__barrier_attributess_destroy_callback
+#define _TEST__F_thread__barrier_attributess_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_barrier_attributess_destroy_callback_()
+ */
+extern void test__f_thread_barrier_attributess_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_barrier_attributess_destroy_callback_()
+ */
+extern void test__f_thread_barrier_attributess_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__barrier_attributess_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_fullss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_fullss_delete_callback__fails(void **state) {
+
+ f_thread_barrier_full_t data = f_thread_barrier_full_t_initialize;
+ f_thread_barrier_full_t data_array[] = { data };
+ f_thread_barrier_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barrier_fulls_t datas_array[] = { datas };
+ f_thread_barrier_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrier_fullss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_busy,
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_barrier_destroy, true);
+ will_return(__wrap_pthread_barrier_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_fullss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+
+ {
+ const uint8_t i = 2;
+
+ will_return(__wrap_pthread_barrier_destroy, false);
+ will_return(__wrap_pthread_barrierattr_destroy, true);
+ will_return(__wrap_pthread_barrierattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_fullss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_barrier_fullss_delete_callback__works(void **state) {
+
+ f_thread_barrier_full_t data = f_thread_barrier_full_t_initialize;
+ f_thread_barrier_full_t data_array[] = { data };
+ f_thread_barrier_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barrier_fulls_t datas_array[] = { datas };
+ f_thread_barrier_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrier_fullss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_barrier_destroy, false);
+ will_return(__wrap_pthread_barrierattr_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_barrier_fullss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__barrier_fullss_delete_callback
+#define _TEST__F_thread__barrier_fullss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_barrier_fullss_delete_callback_()
+ */
+extern void test__f_thread_barrier_fullss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_barrier_fullss_delete_callback_()
+ */
+extern void test__f_thread_barrier_fullss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__barrier_fullss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_fullss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_fullss_destroy_callback__fails(void **state) {
+
+ f_thread_barrier_full_t data = f_thread_barrier_full_t_initialize;
+ f_thread_barrier_full_t data_array[] = { data };
+ f_thread_barrier_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barrier_fulls_t datas_array[] = { datas };
+ f_thread_barrier_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrier_fullss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_busy,
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_barrier_destroy, true);
+ will_return(__wrap_pthread_barrier_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_fullss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+
+ {
+ const uint8_t i = 2;
+
+ will_return(__wrap_pthread_barrier_destroy, false);
+ will_return(__wrap_pthread_barrierattr_destroy, true);
+ will_return(__wrap_pthread_barrierattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_fullss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_barrier_fullss_destroy_callback__works(void **state) {
+
+ f_thread_barrier_full_t data = f_thread_barrier_full_t_initialize;
+ f_thread_barrier_full_t data_array[] = { data };
+ f_thread_barrier_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barrier_fulls_t datas_array[] = { datas };
+ f_thread_barrier_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrier_fullss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_barrier_destroy, false);
+ will_return(__wrap_pthread_barrierattr_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_barrier_fullss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__barrier_fullss_destroy_callback
+#define _TEST__F_thread__barrier_fullss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_barrier_fullss_destroy_callback_()
+ */
+extern void test__f_thread_barrier_fullss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_barrier_fullss_destroy_callback_()
+ */
+extern void test__f_thread_barrier_fullss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__barrier_fullss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrierss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrierss_delete_callback__fails(void **state) {
+
+ f_thread_barrier_t data = f_thread_barrier_t_initialize;
+ f_thread_barrier_t data_array[] = { data };
+ f_thread_barriers_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barriers_t datas_array[] = { datas };
+ f_thread_barrierss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrierss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_barrier_destroy, true);
+ will_return(__wrap_pthread_barrier_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrierss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_barrierss_delete_callback__works(void **state) {
+
+ f_thread_barrier_t data = f_thread_barrier_t_initialize;
+ f_thread_barrier_t data_array[] = { data };
+ f_thread_barriers_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barriers_t datas_array[] = { datas };
+ f_thread_barrierss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrierss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_barrier_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_barrierss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__barrierss_delete_callback
+#define _TEST__F_thread__barrierss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_barrierss_delete_callback_()
+ */
+extern void test__f_thread_barrierss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_barrierss_delete_callback_()
+ */
+extern void test__f_thread_barrierss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__barrierss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrierss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrierss_destroy_callback__fails(void **state) {
+
+ f_thread_barrier_t data = f_thread_barrier_t_initialize;
+ f_thread_barrier_t data_array[] = { data };
+ f_thread_barriers_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barriers_t datas_array[] = { datas };
+ f_thread_barrierss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrierss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_barrier_destroy, true);
+ will_return(__wrap_pthread_barrier_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrierss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_barrierss_destroy_callback__works(void **state) {
+
+ f_thread_barrier_t data = f_thread_barrier_t_initialize;
+ f_thread_barrier_t data_array[] = { data };
+ f_thread_barriers_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_barriers_t datas_array[] = { datas };
+ f_thread_barrierss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_barrierss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_barrier_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_barrierss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__barrierss_destroy_callback
+#define _TEST__F_thread__barrierss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_barrierss_destroy_callback_()
+ */
+extern void test__f_thread_barrierss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_barrierss_destroy_callback_()
+ */
+extern void test__f_thread_barrierss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__barrierss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-condition_attributess_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_condition_attributess_delete_callback__fails(void **state) {
+
+ f_thread_condition_attribute_t data = f_thread_condition_attribute_t_initialize;
+ f_thread_condition_attribute_t data_array[] = { data };
+ f_thread_condition_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_condition_attributes_t datas_array[] = { datas };
+ f_thread_condition_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_condition_attributess_t datass_array[] = { datass };
+
+ int errnos[] = {
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 1; ++i) {
+
+ will_return(__wrap_pthread_condattr_destroy, true);
+ will_return(__wrap_pthread_condattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_condition_attributess_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_condition_attributess_delete_callback__works(void **state) {
+
+ f_thread_condition_attribute_t data = f_thread_condition_attribute_t_initialize;
+ f_thread_condition_attribute_t data_array[] = { data };
+ f_thread_condition_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_condition_attributes_t datas_array[] = { datas };
+ f_thread_condition_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_condition_attributess_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_condattr_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_condition_attributess_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__condition_attributess_delete_callback
+#define _TEST__F_thread__condition_attributess_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_condition_attributess_delete_callback_()
+ */
+extern void test__f_thread_condition_attributess_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_condition_attributess_delete_callback_()
+ */
+extern void test__f_thread_condition_attributess_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__condition_attributess_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-condition_attributess_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_condition_attributess_destroy_callback__fails(void **state) {
+
+ f_thread_condition_attribute_t data = f_thread_condition_attribute_t_initialize;
+ f_thread_condition_attribute_t data_array[] = { data };
+ f_thread_condition_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_condition_attributes_t datas_array[] = { datas };
+ f_thread_condition_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_condition_attributess_t datass_array[] = { datass };
+
+ int errnos[] = {
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 1; ++i) {
+
+ will_return(__wrap_pthread_condattr_destroy, true);
+ will_return(__wrap_pthread_condattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_condition_attributess_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_condition_attributess_destroy_callback__works(void **state) {
+
+ f_thread_condition_attribute_t data = f_thread_condition_attribute_t_initialize;
+ f_thread_condition_attribute_t data_array[] = { data };
+ f_thread_condition_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_condition_attributes_t datas_array[] = { datas };
+ f_thread_condition_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_condition_attributess_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_condattr_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_condition_attributess_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__condition_attributess_destroy_callback
+#define _TEST__F_thread__condition_attributess_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_condition_attributess_destroy_callback_()
+ */
+extern void test__f_thread_condition_attributess_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_condition_attributess_destroy_callback_()
+ */
+extern void test__f_thread_condition_attributess_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__condition_attributess_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-condition_fullss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_condition_fullss_delete_callback__fails(void **state) {
+
+ f_thread_condition_full_t data = f_thread_condition_full_t_initialize;
+ f_thread_condition_full_t data_array[] = { data };
+ f_thread_condition_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_condition_fulls_t datas_array[] = { datas };
+ f_thread_condition_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_condition_fullss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_cond_destroy, true);
+ will_return(__wrap_pthread_cond_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_condition_fullss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+
+ {
+ const uint8_t i = 2;
+
+ will_return(__wrap_pthread_cond_destroy, false);
+ will_return(__wrap_pthread_condattr_destroy, true);
+ will_return(__wrap_pthread_condattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_condition_fullss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_condition_fullss_delete_callback__works(void **state) {
+
+ f_thread_condition_full_t data = f_thread_condition_full_t_initialize;
+ f_thread_condition_full_t data_array[] = { data };
+ f_thread_condition_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_condition_fulls_t datas_array[] = { datas };
+ f_thread_condition_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_condition_fullss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_cond_destroy, false);
+ will_return(__wrap_pthread_condattr_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_condition_fullss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__condition_fullss_delete_callback
+#define _TEST__F_thread__condition_fullss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_condition_fullss_delete_callback()
+ */
+extern void test__f_thread_condition_fullss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_condition_fullss_delete_callback()
+ */
+extern void test__f_thread_condition_fullss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__condition_fullss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-condition_fullss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_condition_fullss_destroy_callback__fails(void **state) {
+
+ f_thread_condition_full_t data = f_thread_condition_full_t_initialize;
+ f_thread_condition_full_t data_array[] = { data };
+ f_thread_condition_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_condition_fulls_t datas_array[] = { datas };
+ f_thread_condition_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_condition_fullss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_cond_destroy, true);
+ will_return(__wrap_pthread_cond_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_condition_fullss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+
+ {
+ const uint8_t i = 2;
+
+ will_return(__wrap_pthread_cond_destroy, false);
+ will_return(__wrap_pthread_condattr_destroy, true);
+ will_return(__wrap_pthread_condattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_condition_fullss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_condition_fullss_destroy_callback__works(void **state) {
+
+ f_thread_condition_full_t data = f_thread_condition_full_t_initialize;
+ f_thread_condition_full_t data_array[] = { data };
+ f_thread_condition_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_condition_fulls_t datas_array[] = { datas };
+ f_thread_condition_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_condition_fullss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_cond_destroy, false);
+ will_return(__wrap_pthread_condattr_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_condition_fullss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__condition_fullss_destroy_callback
+#define _TEST__F_thread__condition_fullss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_condition_fullss_destroy_callback()
+ */
+extern void test__f_thread_condition_fullss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_condition_fullss_destroy_callback()
+ */
+extern void test__f_thread_condition_fullss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__condition_fullss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-conditionss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_conditionss_delete_callback__fails(void **state) {
+
+ f_thread_condition_t data = f_thread_condition_t_initialize;
+ f_thread_condition_t data_array[] = { data };
+ f_thread_conditions_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_conditions_t datas_array[] = { datas };
+ f_thread_conditionss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_conditionss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_cond_destroy, true);
+ will_return(__wrap_pthread_cond_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_conditionss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_conditionss_delete_callback__works(void **state) {
+
+ f_thread_condition_t data = f_thread_condition_t_initialize;
+ f_thread_condition_t data_array[] = { data };
+ f_thread_conditions_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_conditions_t datas_array[] = { datas };
+ f_thread_conditionss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_conditionss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_cond_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_conditionss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__conditionss_delete_callback
+#define _TEST__F_thread__conditionss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_conditionss_delete_callback_()
+ */
+extern void test__f_thread_conditionss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_conditionss_delete_callback_()
+ */
+extern void test__f_thread_conditionss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__conditionss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-conditionss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_conditionss_destroy_callback__fails(void **state) {
+
+ f_thread_condition_t data = f_thread_condition_t_initialize;
+ f_thread_condition_t data_array[] = { data };
+ f_thread_conditions_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_conditions_t datas_array[] = { datas };
+ f_thread_conditionss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_conditionss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_cond_destroy, true);
+ will_return(__wrap_pthread_cond_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_conditionss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_conditionss_destroy_callback__works(void **state) {
+
+ f_thread_condition_t data = f_thread_condition_t_initialize;
+ f_thread_condition_t data_array[] = { data };
+ f_thread_conditions_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_conditions_t datas_array[] = { datas };
+ f_thread_conditionss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_conditionss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_cond_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_conditionss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__conditionss_destroy_callback
+#define _TEST__F_thread__conditionss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_conditionss_destroy_callback_()
+ */
+extern void test__f_thread_conditionss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_conditionss_destroy_callback_()
+ */
+extern void test__f_thread_conditionss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__conditionss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-keyss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_keyss_delete_callback__fails(void **state) {
+
+ f_thread_key_t data = f_thread_key_t_initialize;
+ f_thread_key_t data_array[] = { data };
+ f_thread_keys_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_keys_t datas_array[] = { datas };
+ f_thread_keyss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_keyss_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_key_delete, errnos[i]);
+
+ const f_status_t status = f_thread_keyss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_keyss_delete_callback__works(void **state) {
+
+ f_thread_key_t data = f_thread_key_t_initialize;
+ f_thread_key_t data_array[] = { data };
+ f_thread_keys_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_keys_t datas_array[] = { datas };
+ f_thread_keyss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_keyss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_key_delete, 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_keyss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__keyss_delete_callback
+#define _TEST__F_thread__keyss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_keyss_delete_callback_()
+ */
+extern void test__f_thread_keyss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_keyss_delete_callback_()
+ */
+extern void test__f_thread_keyss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__keyss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-keyss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_keyss_destroy_callback__fails(void **state) {
+
+ f_thread_key_t data = f_thread_key_t_initialize;
+ f_thread_key_t data_array[] = { data };
+ f_thread_keys_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_keys_t datas_array[] = { datas };
+ f_thread_keyss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_keyss_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_key_delete, errnos[i]);
+
+ const f_status_t status = f_thread_keyss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_keyss_destroy_callback__works(void **state) {
+
+ f_thread_key_t data = f_thread_key_t_initialize;
+ f_thread_key_t data_array[] = { data };
+ f_thread_keys_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_keys_t datas_array[] = { datas };
+ f_thread_keyss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_keyss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_key_delete, 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_keyss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__keyss_destroy_callback
+#define _TEST__F_thread__keyss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_keyss_destroy_callback_()
+ */
+extern void test__f_thread_keyss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_keyss_destroy_callback_()
+ */
+extern void test__f_thread_keyss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__keyss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-lock_attributess_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_lock_attributess_delete_callback__fails(void **state) {
+
+ f_thread_lock_attribute_t data = f_thread_lock_attribute_t_initialize;
+ f_thread_lock_attribute_t data_array[] = { data };
+ f_thread_lock_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_lock_attributes_t datas_array[] = { datas };
+ f_thread_lock_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lock_attributess_t datass_array[] = { datass };
+
+ int errnos[] = {
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 1; ++i) {
+
+ will_return(__wrap_pthread_rwlockattr_destroy, true);
+ will_return(__wrap_pthread_rwlockattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_lock_attributess_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_lock_attributess_delete_callback__works(void **state) {
+
+ f_thread_lock_attribute_t data = f_thread_lock_attribute_t_initialize;
+ f_thread_lock_attribute_t data_array[] = { data };
+ f_thread_lock_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_lock_attributes_t datas_array[] = { datas };
+ f_thread_lock_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lock_attributess_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_rwlockattr_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_lock_attributess_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__lock_attributess_delete_callback
+#define _TEST__F_thread__lock_attributess_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_lock_attributess_delete_callback_()
+ */
+extern void test__f_thread_lock_attributess_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_lock_attributess_delete_callback_()
+ */
+extern void test__f_thread_lock_attributess_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__lock_attributess_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-lock_attributess_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_lock_attributess_destroy_callback__fails(void **state) {
+
+ f_thread_lock_attribute_t data = f_thread_lock_attribute_t_initialize;
+ f_thread_lock_attribute_t data_array[] = { data };
+ f_thread_lock_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_lock_attributes_t datas_array[] = { datas };
+ f_thread_lock_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lock_attributess_t datass_array[] = { datass };
+
+ int errnos[] = {
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 1; ++i) {
+
+ will_return(__wrap_pthread_rwlockattr_destroy, true);
+ will_return(__wrap_pthread_rwlockattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_lock_attributess_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_lock_attributess_destroy_callback__works(void **state) {
+
+ f_thread_lock_attribute_t data = f_thread_lock_attribute_t_initialize;
+ f_thread_lock_attribute_t data_array[] = { data };
+ f_thread_lock_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_lock_attributes_t datas_array[] = { datas };
+ f_thread_lock_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lock_attributess_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_rwlockattr_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_lock_attributess_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__lock_attributess_destroy_callback
+#define _TEST__F_thread__lock_attributess_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_lock_attributess_destroy_callback_()
+ */
+extern void test__f_thread_lock_attributess_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_lock_attributess_destroy_callback_()
+ */
+extern void test__f_thread_lock_attributess_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__lock_attributess_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-lock_fullss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_lock_fullss_delete_callback__fails(void **state) {
+
+ f_thread_lock_full_t data = f_thread_lock_full_t_initialize;
+ f_thread_lock_full_t data_array[] = { data };
+ f_thread_lock_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_lock_fulls_t datas_array[] = { datas };
+ f_thread_lock_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lock_fullss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_rwlock_destroy, true);
+ will_return(__wrap_pthread_rwlock_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_lock_fullss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+
+ {
+ const uint8_t i = 2;
+
+ will_return(__wrap_pthread_rwlock_destroy, false);
+ will_return(__wrap_pthread_rwlockattr_destroy, true);
+ will_return(__wrap_pthread_rwlockattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_lock_fullss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ }
+}
+
+void test__f_thread_lock_fullss_delete_callback__works(void **state) {
+
+ f_thread_lock_full_t data = f_thread_lock_full_t_initialize;
+ f_thread_lock_full_t data_array[] = { data };
+ f_thread_lock_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_lock_fulls_t datas_array[] = { datas };
+ f_thread_lock_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lock_fullss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_rwlock_destroy, false);
+ will_return(__wrap_pthread_rwlockattr_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_lock_fullss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__lock_fullss_delete_callback
+#define _TEST__F_thread__lock_fullss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_lock_fullss_delete_callback_()
+ */
+extern void test__f_thread_lock_fullss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_lock_fullss_delete_callback_()
+ */
+extern void test__f_thread_lock_fullss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__lock_fullss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-lock_fullss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_lock_fullss_destroy_callback__fails(void **state) {
+
+ f_thread_lock_full_t data = f_thread_lock_full_t_initialize;
+ f_thread_lock_full_t data_array[] = { data };
+ f_thread_lock_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_lock_fulls_t datas_array[] = { datas };
+ f_thread_lock_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lock_fullss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_rwlock_destroy, true);
+ will_return(__wrap_pthread_rwlock_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_lock_fullss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+
+ {
+ const uint8_t i = 2;
+
+ will_return(__wrap_pthread_rwlock_destroy, false);
+ will_return(__wrap_pthread_rwlockattr_destroy, true);
+ will_return(__wrap_pthread_rwlockattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_lock_fullss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ }
+}
+
+void test__f_thread_lock_fullss_destroy_callback__works(void **state) {
+
+ f_thread_lock_full_t data = f_thread_lock_full_t_initialize;
+ f_thread_lock_full_t data_array[] = { data };
+ f_thread_lock_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_lock_fulls_t datas_array[] = { datas };
+ f_thread_lock_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lock_fullss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_rwlock_destroy, false);
+ will_return(__wrap_pthread_rwlockattr_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_lock_fullss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__lock_fullss_destroy_callback
+#define _TEST__F_thread__lock_fullss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_lock_fullss_destroy_callback_()
+ */
+extern void test__f_thread_lock_fullss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_lock_fullss_destroy_callback_()
+ */
+extern void test__f_thread_lock_fullss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__lock_fullss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-lockss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_lockss_delete_callback__fails(void **state) {
+
+ f_thread_lock_t data = f_thread_lock_t_initialize;
+ f_thread_lock_t data_array[] = { data };
+ f_thread_locks_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_locks_t datas_array[] = { datas };
+ f_thread_lockss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lockss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_rwlock_destroy, true);
+ will_return(__wrap_pthread_rwlock_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_lockss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_lockss_delete_callback__works(void **state) {
+
+ f_thread_lock_t data = f_thread_lock_t_initialize;
+ f_thread_lock_t data_array[] = { data };
+ f_thread_locks_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_locks_t datas_array[] = { datas };
+ f_thread_lockss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lockss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_rwlock_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_lockss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__lockss_delete_callback
+#define _TEST__F_thread__lockss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_lockss_delete_callback_()
+ */
+extern void test__f_thread_lockss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_lockss_delete_callback_()
+ */
+extern void test__f_thread_lockss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__lockss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-lockss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_lockss_destroy_callback__fails(void **state) {
+
+ f_thread_lock_t data = f_thread_lock_t_initialize;
+ f_thread_lock_t data_array[] = { data };
+ f_thread_locks_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_locks_t datas_array[] = { datas };
+ f_thread_lockss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lockss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_rwlock_destroy, true);
+ will_return(__wrap_pthread_rwlock_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_lockss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_lockss_destroy_callback__works(void **state) {
+
+ f_thread_lock_t data = f_thread_lock_t_initialize;
+ f_thread_lock_t data_array[] = { data };
+ f_thread_locks_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_locks_t datas_array[] = { datas };
+ f_thread_lockss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_lockss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_rwlock_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_lockss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__lockss_destroy_callback
+#define _TEST__F_thread__lockss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_lockss_destroy_callback_()
+ */
+extern void test__f_thread_lockss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_lockss_destroy_callback_()
+ */
+extern void test__f_thread_lockss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__lockss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-mutex_attributess_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_mutex_attributess_delete_callback__fails(void **state) {
+
+ f_thread_mutex_attribute_t data = f_thread_mutex_attribute_t_initialize;
+ f_thread_mutex_attribute_t data_array[] = { data };
+ f_thread_mutex_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutex_attributes_t datas_array[] = { datas };
+ f_thread_mutex_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutex_attributess_t datass_array[] = { datass };
+
+ int errnos[] = {
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 1; ++i) {
+
+ will_return(__wrap_pthread_mutexattr_destroy, true);
+ will_return(__wrap_pthread_mutexattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_mutex_attributess_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_mutex_attributess_delete_callback__works(void **state) {
+
+ f_thread_mutex_attribute_t data = f_thread_mutex_attribute_t_initialize;
+ f_thread_mutex_attribute_t data_array[] = { data };
+ f_thread_mutex_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutex_attributes_t datas_array[] = { datas };
+ f_thread_mutex_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutex_attributess_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_mutexattr_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_mutex_attributess_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__mutex_attributess_delete_callback
+#define _TEST__F_thread__mutex_attributess_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_mutex_attributess_delete_callback_()
+ */
+extern void test__f_thread_mutex_attributess_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_mutex_attributess_delete_callback_()
+ */
+extern void test__f_thread_mutex_attributess_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__mutex_attributess_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-mutex_attributess_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_mutex_attributess_destroy_callback__fails(void **state) {
+
+ f_thread_mutex_attribute_t data = f_thread_mutex_attribute_t_initialize;
+ f_thread_mutex_attribute_t data_array[] = { data };
+ f_thread_mutex_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutex_attributes_t datas_array[] = { datas };
+ f_thread_mutex_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutex_attributess_t datass_array[] = { datass };
+
+ int errnos[] = {
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 1; ++i) {
+
+ will_return(__wrap_pthread_mutexattr_destroy, true);
+ will_return(__wrap_pthread_mutexattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_mutex_attributess_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_mutex_attributess_destroy_callback__works(void **state) {
+
+ f_thread_mutex_attribute_t data = f_thread_mutex_attribute_t_initialize;
+ f_thread_mutex_attribute_t data_array[] = { data };
+ f_thread_mutex_attributes_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutex_attributes_t datas_array[] = { datas };
+ f_thread_mutex_attributess_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutex_attributess_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_mutexattr_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_mutex_attributess_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__mutex_attributess_destroy_callback
+#define _TEST__F_thread__mutex_attributess_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_mutex_attributess_destroy_callback_()
+ */
+extern void test__f_thread_mutex_attributess_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_mutex_attributess_destroy_callback_()
+ */
+extern void test__f_thread_mutex_attributess_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__mutex_attributess_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-mutex_fullss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_mutex_fullss_delete_callback__fails(void **state) {
+
+ f_thread_mutex_full_t data = f_thread_mutex_full_t_initialize;
+ f_thread_mutex_full_t data_array[] = { data };
+ f_thread_mutex_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutex_fulls_t datas_array[] = { datas };
+ f_thread_mutex_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutex_fullss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_mutex_destroy, true);
+ will_return(__wrap_pthread_mutex_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_mutex_fullss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+
+ {
+ const uint8_t i = 2;
+
+ will_return(__wrap_pthread_mutex_destroy, false);
+ will_return(__wrap_pthread_mutexattr_destroy, true);
+ will_return(__wrap_pthread_mutexattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_mutex_fullss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ }
+}
+
+void test__f_thread_mutex_fullss_delete_callback__works(void **state) {
+
+ f_thread_mutex_full_t data = f_thread_mutex_full_t_initialize;
+ f_thread_mutex_full_t data_array[] = { data };
+ f_thread_mutex_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutex_fulls_t datas_array[] = { datas };
+ f_thread_mutex_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutex_fullss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_mutex_destroy, false);
+ will_return(__wrap_pthread_mutexattr_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_mutex_fullss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__mutex_fullss_delete_callback
+#define _TEST__F_thread__mutex_fullss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_mutex_fullss_delete_callback_()
+ */
+extern void test__f_thread_mutex_fullss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_mutex_fullss_delete_callback_()
+ */
+extern void test__f_thread_mutex_fullss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__mutex_fullss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-mutex_fullss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_mutex_fullss_destroy_callback__fails(void **state) {
+
+ f_thread_mutex_full_t data = f_thread_mutex_full_t_initialize;
+ f_thread_mutex_full_t data_array[] = { data };
+ f_thread_mutex_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutex_fulls_t datas_array[] = { datas };
+ f_thread_mutex_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutex_fullss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_mutex_destroy, true);
+ will_return(__wrap_pthread_mutex_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_mutex_fullss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+
+ {
+ const uint8_t i = 2;
+
+ will_return(__wrap_pthread_mutex_destroy, false);
+ will_return(__wrap_pthread_mutexattr_destroy, true);
+ will_return(__wrap_pthread_mutexattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_mutex_fullss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ }
+}
+
+void test__f_thread_mutex_fullss_destroy_callback__works(void **state) {
+
+ f_thread_mutex_full_t data = f_thread_mutex_full_t_initialize;
+ f_thread_mutex_full_t data_array[] = { data };
+ f_thread_mutex_fulls_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutex_fulls_t datas_array[] = { datas };
+ f_thread_mutex_fullss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutex_fullss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_mutex_destroy, false);
+ will_return(__wrap_pthread_mutexattr_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_mutex_fullss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__mutex_fullss_destroy_callback
+#define _TEST__F_thread__mutex_fullss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_mutex_fullss_destroy_callback_()
+ */
+extern void test__f_thread_mutex_fullss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_mutex_fullss_destroy_callback_()
+ */
+extern void test__f_thread_mutex_fullss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__mutex_fullss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-mutexss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_mutexss_delete_callback__fails(void **state) {
+
+ f_thread_mutex_t data = f_thread_mutex_t_initialize;
+ f_thread_mutex_t data_array[] = { data };
+ f_thread_mutexs_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutexs_t datas_array[] = { datas };
+ f_thread_mutexss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutexss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_mutex_destroy, true);
+ will_return(__wrap_pthread_mutex_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_mutexss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_mutexss_delete_callback__works(void **state) {
+
+ f_thread_mutex_t data = f_thread_mutex_t_initialize;
+ f_thread_mutex_t data_array[] = { data };
+ f_thread_mutexs_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutexs_t datas_array[] = { datas };
+ f_thread_mutexss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutexss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_mutex_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_mutexss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__mutexss_delete_callback
+#define _TEST__F_thread__mutexss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_mutexss_delete_callback_()
+ */
+extern void test__f_thread_mutexss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_mutexss_delete_callback_()
+ */
+extern void test__f_thread_mutexss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__mutexss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-mutexss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_mutexss_destroy_callback__fails(void **state) {
+
+ f_thread_mutex_t data = f_thread_mutex_t_initialize;
+ f_thread_mutex_t data_array[] = { data };
+ f_thread_mutexs_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutexs_t datas_array[] = { datas };
+ f_thread_mutexss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutexss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_mutex_destroy, true);
+ will_return(__wrap_pthread_mutex_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_mutexss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_mutexss_destroy_callback__works(void **state) {
+
+ f_thread_mutex_t data = f_thread_mutex_t_initialize;
+ f_thread_mutex_t data_array[] = { data };
+ f_thread_mutexs_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_mutexs_t datas_array[] = { datas };
+ f_thread_mutexss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_mutexss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_mutex_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_mutexss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__mutexss_destroy_callback
+#define _TEST__F_thread__mutexss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_mutexss_destroy_callback_()
+ */
+extern void test__f_thread_mutexss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_mutexss_destroy_callback_()
+ */
+extern void test__f_thread_mutexss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__mutexss_destroy_callback
--- /dev/null
+#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
--- /dev/null
+/**
+ * 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
--- /dev/null
+#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
--- /dev/null
+/**
+ * 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
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-semaphoress_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_semaphoress_delete_callback__fails(void **state) {
+
+ f_thread_semaphore_t data = f_thread_semaphore_t_initialize;
+ f_thread_semaphore_t data_array[] = { data };
+ f_thread_semaphores_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_semaphores_t datas_array[] = { datas };
+ f_thread_semaphoress_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_semaphoress_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_sem_destroy, true);
+ will_return(__wrap_sem_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_semaphoress_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_semaphoress_delete_callback__works(void **state) {
+
+ f_thread_semaphore_t data = f_thread_semaphore_t_initialize;
+ f_thread_semaphore_t data_array[] = { data };
+ f_thread_semaphores_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_semaphores_t datas_array[] = { datas };
+ f_thread_semaphoress_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_semaphoress_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_sem_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_semaphoress_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__semaphoress_delete_callback
+#define _TEST__F_thread__semaphoress_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_semaphoress_delete_callback_()
+ */
+extern void test__f_thread_semaphoress_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_semaphoress_delete_callback_()
+ */
+extern void test__f_thread_semaphoress_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__semaphoress_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-semaphoress_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_semaphoress_destroy_callback__fails(void **state) {
+
+ f_thread_semaphore_t data = f_thread_semaphore_t_initialize;
+ f_thread_semaphore_t data_array[] = { data };
+ f_thread_semaphores_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_semaphores_t datas_array[] = { datas };
+ f_thread_semaphoress_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_semaphoress_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_sem_destroy, true);
+ will_return(__wrap_sem_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_semaphoress_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_semaphoress_destroy_callback__works(void **state) {
+
+ f_thread_semaphore_t data = f_thread_semaphore_t_initialize;
+ f_thread_semaphore_t data_array[] = { data };
+ f_thread_semaphores_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_semaphores_t datas_array[] = { datas };
+ f_thread_semaphoress_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_semaphoress_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_sem_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_semaphoress_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__semaphoress_destroy_callback
+#define _TEST__F_thread__semaphoress_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_semaphoress_destroy_callback_()
+ */
+extern void test__f_thread_semaphoress_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_semaphoress_destroy_callback_()
+ */
+extern void test__f_thread_semaphoress_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__semaphoress_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-setss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_setss_delete_callback__fails(void **state) {
+
+ f_thread_set_t data = f_thread_set_t_initialize;
+ f_thread_set_t data_array[] = { data };
+ f_thread_sets_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_sets_t datas_array[] = { datas };
+ f_thread_setss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_setss_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_setss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_setss_delete_callback__works(void **state) {
+
+ f_thread_set_t data = f_thread_set_t_initialize;
+ f_thread_set_t data_array[] = { data };
+ f_thread_sets_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_sets_t datas_array[] = { datas };
+ f_thread_setss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_setss_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_setss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__setss_delete_callback
+#define _TEST__F_thread__setss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_setss_delete_callback_()
+ */
+extern void test__f_thread_setss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_setss_delete_callback_()
+ */
+extern void test__f_thread_setss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__setss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-setss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_setss_destroy_callback__fails(void **state) {
+
+ f_thread_set_t data = f_thread_set_t_initialize;
+ f_thread_set_t data_array[] = { data };
+ f_thread_sets_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_sets_t datas_array[] = { datas };
+ f_thread_setss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_setss_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_setss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_setss_destroy_callback__works(void **state) {
+
+ f_thread_set_t data = f_thread_set_t_initialize;
+ f_thread_set_t data_array[] = { data };
+ f_thread_sets_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_sets_t datas_array[] = { datas };
+ f_thread_setss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_setss_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_setss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__setss_destroy_callback
+#define _TEST__F_thread__setss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_setss_destroy_callback_()
+ */
+extern void test__f_thread_setss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_setss_destroy_callback_()
+ */
+extern void test__f_thread_setss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__setss_destroy_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-spinss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_spinss_delete_callback__fails(void **state) {
+
+ f_thread_spin_t data = f_thread_spin_t_initialize;
+ f_thread_spin_t data_array[] = { data };
+ f_thread_spins_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_spins_t datas_array[] = { datas };
+ f_thread_spinss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_spinss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_spin_destroy, true);
+ will_return(__wrap_pthread_spin_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_spinss_delete_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_spinss_delete_callback__works(void **state) {
+
+ f_thread_spin_t data = f_thread_spin_t_initialize;
+ f_thread_spin_t data_array[] = { data };
+ f_thread_spins_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_spins_t datas_array[] = { datas };
+ f_thread_spinss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_spinss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_spin_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_spinss_delete_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__spinss_delete_callback
+#define _TEST__F_thread__spinss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_spinss_delete_callback_()
+ */
+extern void test__f_thread_spinss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_spinss_delete_callback_()
+ */
+extern void test__f_thread_spinss_delete_callback__works(void **state);
+
+#endif // _TEST__F_thread__spinss_delete_callback
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-spinss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_spinss_destroy_callback__fails(void **state) {
+
+ f_thread_spin_t data = f_thread_spin_t_initialize;
+ f_thread_spin_t data_array[] = { data };
+ f_thread_spins_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_spins_t datas_array[] = { datas };
+ f_thread_spinss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_spinss_t datass_array[] = { datass };
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_status_set_error(F_busy),
+ F_status_set_error(F_parameter),
+ F_status_set_error(F_failure),
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_spin_destroy, true);
+ will_return(__wrap_pthread_spin_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_spinss_destroy_callback(0, 1, (void *) datass_array);
+
+ assert_int_equal(status, statuss[i]);
+ } // for
+}
+
+void test__f_thread_spinss_destroy_callback__works(void **state) {
+
+ f_thread_spin_t data = f_thread_spin_t_initialize;
+ f_thread_spin_t data_array[] = { data };
+ f_thread_spins_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_thread_spins_t datas_array[] = { datas };
+ f_thread_spinss_t datass = { .array = datas_array, .used = 1, .size = 1 };
+ f_thread_spinss_t datass_array[] = { datass };
+ const f_number_unsigned_t length = 1;
+
+ {
+ will_return(__wrap_pthread_spin_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_spinss_destroy_callback(0, length, (void *) datass_array);
+
+ assert_int_equal(status, F_okay);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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__spinss_destroy_callback
+#define _TEST__F_thread__spinss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_thread_spinss_destroy_callback_()
+ */
+extern void test__f_thread_spinss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_thread_spinss_destroy_callback_()
+ */
+extern void test__f_thread_spinss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_thread__spinss_destroy_callback
cmocka_unit_test(test__f_thread_attributes_delete_callback__works),
cmocka_unit_test(test__f_thread_attributes_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_attributess_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_attributess_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_attributess_delete_callback__works),
+ cmocka_unit_test(test__f_thread_attributess_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_barriers_delete_callback__fails),
cmocka_unit_test(test__f_thread_barriers_destroy_callback__fails),
cmocka_unit_test(test__f_thread_barriers_delete_callback__works),
cmocka_unit_test(test__f_thread_barriers_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_barrierss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_barrierss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_barrierss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_barrierss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_barrier_attributes_delete_callback__fails),
cmocka_unit_test(test__f_thread_barrier_attributes_destroy_callback__fails),
cmocka_unit_test(test__f_thread_barrier_attributes_delete_callback__works),
cmocka_unit_test(test__f_thread_barrier_attributes_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_barrier_attributess_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_barrier_attributess_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_barrier_attributess_delete_callback__works),
+ cmocka_unit_test(test__f_thread_barrier_attributess_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_barrier_fulls_delete_callback__fails),
cmocka_unit_test(test__f_thread_barrier_fulls_destroy_callback__fails),
cmocka_unit_test(test__f_thread_barrier_fulls_delete_callback__works),
cmocka_unit_test(test__f_thread_barrier_fulls_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_barrier_fullss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_barrier_fullss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_barrier_fullss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_barrier_fullss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_conditions_delete_callback__fails),
cmocka_unit_test(test__f_thread_conditions_destroy_callback__fails),
cmocka_unit_test(test__f_thread_conditions_delete_callback__works),
cmocka_unit_test(test__f_thread_conditions_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_conditionss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_conditionss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_conditionss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_conditionss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_condition_attributes_delete_callback__fails),
cmocka_unit_test(test__f_thread_condition_attributes_destroy_callback__fails),
cmocka_unit_test(test__f_thread_condition_attributes_delete_callback__works),
cmocka_unit_test(test__f_thread_condition_attributes_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_condition_attributess_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_condition_attributess_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_condition_attributess_delete_callback__works),
+ cmocka_unit_test(test__f_thread_condition_attributess_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_condition_fulls_delete_callback__fails),
cmocka_unit_test(test__f_thread_condition_fulls_destroy_callback__fails),
cmocka_unit_test(test__f_thread_condition_fulls_delete_callback__works),
cmocka_unit_test(test__f_thread_condition_fulls_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_condition_fullss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_condition_fullss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_condition_fullss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_condition_fullss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_keys_delete_callback__fails),
cmocka_unit_test(test__f_thread_keys_destroy_callback__fails),
cmocka_unit_test(test__f_thread_keys_delete_callback__works),
cmocka_unit_test(test__f_thread_keys_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_keyss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_keyss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_keyss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_keyss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_locks_delete_callback__fails),
cmocka_unit_test(test__f_thread_locks_destroy_callback__fails),
cmocka_unit_test(test__f_thread_locks_delete_callback__works),
cmocka_unit_test(test__f_thread_locks_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_lockss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_lockss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_lockss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_lockss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_lock_attributes_delete_callback__fails),
cmocka_unit_test(test__f_thread_lock_attributes_destroy_callback__fails),
cmocka_unit_test(test__f_thread_lock_attributes_delete_callback__works),
cmocka_unit_test(test__f_thread_lock_attributes_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_lock_attributess_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_lock_attributess_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_lock_attributess_delete_callback__works),
+ cmocka_unit_test(test__f_thread_lock_attributess_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_lock_fulls_delete_callback__fails),
cmocka_unit_test(test__f_thread_lock_fulls_destroy_callback__fails),
cmocka_unit_test(test__f_thread_lock_fulls_delete_callback__works),
cmocka_unit_test(test__f_thread_lock_fulls_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_lock_fullss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_lock_fullss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_lock_fullss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_lock_fullss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_mutexs_delete_callback__fails),
cmocka_unit_test(test__f_thread_mutexs_destroy_callback__fails),
cmocka_unit_test(test__f_thread_mutexs_delete_callback__works),
cmocka_unit_test(test__f_thread_mutexs_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_mutexss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_mutexss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_mutexss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_mutexss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_mutex_attributes_delete_callback__fails),
cmocka_unit_test(test__f_thread_mutex_attributes_destroy_callback__fails),
cmocka_unit_test(test__f_thread_mutex_attributes_delete_callback__works),
cmocka_unit_test(test__f_thread_mutex_attributes_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_mutex_attributess_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_mutex_attributess_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_mutex_attributess_delete_callback__works),
+ cmocka_unit_test(test__f_thread_mutex_attributess_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_mutex_fulls_delete_callback__fails),
cmocka_unit_test(test__f_thread_mutex_fulls_destroy_callback__fails),
cmocka_unit_test(test__f_thread_mutex_fulls_delete_callback__works),
cmocka_unit_test(test__f_thread_mutex_fulls_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_mutex_fullss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_mutex_fullss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_mutex_fullss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_mutex_fullss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_semaphores_delete_callback__fails),
cmocka_unit_test(test__f_thread_semaphores_destroy_callback__fails),
cmocka_unit_test(test__f_thread_semaphores_delete_callback__works),
cmocka_unit_test(test__f_thread_semaphores_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_semaphoress_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_semaphoress_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_semaphoress_delete_callback__works),
+ cmocka_unit_test(test__f_thread_semaphoress_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_sets_delete_callback__fails),
cmocka_unit_test(test__f_thread_sets_destroy_callback__fails),
cmocka_unit_test(test__f_thread_sets_delete_callback__works),
cmocka_unit_test(test__f_thread_sets_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_setss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_setss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_setss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_setss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_spins_delete_callback__fails),
cmocka_unit_test(test__f_thread_spins_destroy_callback__fails),
cmocka_unit_test(test__f_thread_spins_delete_callback__works),
cmocka_unit_test(test__f_thread_spins_destroy_callback__works),
+ cmocka_unit_test(test__f_thread_spinss_delete_callback__fails),
+ cmocka_unit_test(test__f_thread_spinss_destroy_callback__fails),
+ cmocka_unit_test(test__f_thread_spinss_delete_callback__works),
+ cmocka_unit_test(test__f_thread_spinss_destroy_callback__works),
+
cmocka_unit_test(test__f_thread_at_fork__fails),
cmocka_unit_test(test__f_thread_at_fork__works),
// f_thread_attributes_delete_callback() doesn't use parameter checking.
// f_thread_attributes_destroy_callback() doesn't use parameter checking.
+ // f_thread_attributess_delete_callback() doesn't use parameter checking.
+ // f_thread_attributess_destroy_callback() doesn't use parameter checking.
+
// f_thread_barriers_delete_callback() doesn't use parameter checking.
// f_thread_barriers_destroy_callback() doesn't use parameter checking.
+ // f_thread_barrierss_delete_callback() doesn't use parameter checking.
+ // f_thread_barrierss_destroy_callback() doesn't use parameter checking.
+
// f_thread_barrier_attributes_delete_callback() doesn't use parameter checking.
// f_thread_barrier_attributes_destroy_callback() doesn't use parameter checking.
+ // f_thread_barrier_attributess_delete_callback() doesn't use parameter checking.
+ // f_thread_barrier_attributess_destroy_callback() doesn't use parameter checking.
+
// f_thread_barrier_fulls_delete_callback() doesn't use parameter checking.
// f_thread_barrier_fulls_destroy_callback() doesn't use parameter checking.
+ // f_thread_barrier_fullss_delete_callback() doesn't use parameter checking.
+ // f_thread_barrier_fullss_destroy_callback() doesn't use parameter checking.
+
// f_thread_conditions_delete_callback() doesn't use parameter checking.
// f_thread_conditions_destroy_callback() doesn't use parameter checking.
+ // f_thread_conditionss_delete_callback() doesn't use parameter checking.
+ // f_thread_conditionss_destroy_callback() doesn't use parameter checking.
+
// f_thread_condition_attributes_delete_callback() doesn't use parameter checking.
// f_thread_condition_attributes_destroy_callback() doesn't use parameter checking.
+ // f_thread_condition_attributess_delete_callback() doesn't use parameter checking.
+ // f_thread_condition_attributess_destroy_callback() doesn't use parameter checking.
+
// f_thread_condition_fulls_delete_callback() doesn't use parameter checking.
// f_thread_condition_fulls_destroy_callback() doesn't use parameter checking.
+ // f_thread_condition_fullss_delete_callback() doesn't use parameter checking.
+ // f_thread_condition_fullss_destroy_callback() doesn't use parameter checking.
+
// f_thread_keys_delete_callback() doesn't use parameter checking.
// f_thread_keys_destroy_callback() doesn't use parameter checking.
+ // f_thread_keyss_delete_callback() doesn't use parameter checking.
+ // f_thread_keyss_destroy_callback() doesn't use parameter checking.
+
// f_thread_locks_delete_callback() doesn't use parameter checking.
// f_thread_locks_destroy_callback() doesn't use parameter checking.
+ // f_thread_lockss_delete_callback() doesn't use parameter checking.
+ // f_thread_lockss_destroy_callback() doesn't use parameter checking.
+
// f_thread_lock_attributes_delete_callback() doesn't use parameter checking.
// f_thread_lock_attributes_destroy_callback() doesn't use parameter checking.
+ // f_thread_lock_attributess_delete_callback() doesn't use parameter checking.
+ // f_thread_lock_attributess_destroy_callback() doesn't use parameter checking.
+
// f_thread_lock_fulls_delete_callback() doesn't use parameter checking.
// f_thread_lock_fulls_destroy_callback() doesn't use parameter checking.
+ // f_thread_lock_fullss_delete_callback() doesn't use parameter checking.
+ // f_thread_lock_fullss_destroy_callback() doesn't use parameter checking.
+
// f_thread_mutexs_delete_callback() doesn't use parameter checking.
// f_thread_mutexs_destroy_callback() doesn't use parameter checking.
+ // f_thread_mutexss_delete_callback() doesn't use parameter checking.
+ // f_thread_mutexss_destroy_callback() doesn't use parameter checking.
+
// f_thread_mutex_attributes_delete_callback() doesn't use parameter checking.
// f_thread_mutex_attributes_destroy_callback() doesn't use parameter checking.
+ // f_thread_mutex_attributess_delete_callback() doesn't use parameter checking.
+ // f_thread_mutex_attributess_destroy_callback() doesn't use parameter checking.
+
// f_thread_mutex_fulls_delete_callback() doesn't use parameter checking.
// f_thread_mutex_fulls_destroy_callback() doesn't use parameter checking.
+ // f_thread_mutex_fullss_delete_callback() doesn't use parameter checking.
+ // f_thread_mutex_fullss_destroy_callback() doesn't use parameter checking.
+
// f_thread_semaphores_delete_callback() doesn't use parameter checking.
// f_thread_semaphores_destroy_callback() doesn't use parameter checking.
+ // f_thread_semaphoress_delete_callback() doesn't use parameter checking.
+ // f_thread_semaphoress_destroy_callback() doesn't use parameter checking.
+
// f_thread_sets_delete_callback() doesn't use parameter checking.
// f_thread_sets_destroy_callback() doesn't use parameter checking.
+ // f_thread_setss_delete_callback() doesn't use parameter checking.
+ // f_thread_setss_destroy_callback() doesn't use parameter checking.
+
// f_thread_spins_delete_callback() doesn't use parameter checking.
// f_thread_spins_destroy_callback() doesn't use parameter checking.
+ // f_thread_spinss_delete_callback() doesn't use parameter checking.
+ // f_thread_spinss_destroy_callback() doesn't use parameter checking.
+
cmocka_unit_test(test__f_thread_at_fork__parameter_checking),
cmocka_unit_test(test__f_thread_attribute_affinity_get__parameter_checking),
#include "test-thread-attribute_stack_size_set.h"
#include "test-thread-attributes_delete_callback.h"
#include "test-thread-attributes_destroy_callback.h"
+#include "test-thread-attributess_delete_callback.h"
+#include "test-thread-attributess_destroy_callback.h"
#include "test-thread-barrier_attribute_create.h"
#include "test-thread-barrier_attribute_delete.h"
#include "test-thread-barrier_attribute_shared_get.h"
#include "test-thread-barrier_attribute_shared_set.h"
#include "test-thread-barrier_attributes_delete_callback.h"
#include "test-thread-barrier_attributes_destroy_callback.h"
+#include "test-thread-barrier_attributess_delete_callback.h"
+#include "test-thread-barrier_attributess_destroy_callback.h"
#include "test-thread-barrier_create.h"
#include "test-thread-barrier_delete.h"
#include "test-thread-barrier_full_delete.h"
#include "test-thread-barrier_fulls_delete_callback.h"
#include "test-thread-barrier_fulls_destroy_callback.h"
+#include "test-thread-barrier_fullss_delete_callback.h"
+#include "test-thread-barrier_fullss_destroy_callback.h"
#include "test-thread-barrier_wait.h"
#include "test-thread-barriers_delete_callback.h"
#include "test-thread-barriers_destroy_callback.h"
+#include "test-thread-barrierss_delete_callback.h"
+#include "test-thread-barrierss_destroy_callback.h"
#include "test-thread-caller.h"
#include "test-thread-cancel.h"
#include "test-thread-cancel_state_set.h"
#include "test-thread-condition_attribute_shared_set.h"
#include "test-thread-condition_attributes_delete_callback.h"
#include "test-thread-condition_attributes_destroy_callback.h"
+#include "test-thread-condition_attributess_delete_callback.h"
+#include "test-thread-condition_attributess_destroy_callback.h"
#include "test-thread-condition_create.h"
#include "test-thread-condition_delete.h"
#include "test-thread-condition_full_delete.h"
#include "test-thread-condition_fulls_delete_callback.h"
#include "test-thread-condition_fulls_destroy_callback.h"
+#include "test-thread-condition_fullss_delete_callback.h"
+#include "test-thread-condition_fullss_destroy_callback.h"
#include "test-thread-condition_signal.h"
#include "test-thread-condition_signal_all.h"
#include "test-thread-condition_wait.h"
#include "test-thread-condition_wait_timed.h"
#include "test-thread-conditions_delete_callback.h"
#include "test-thread-conditions_destroy_callback.h"
+#include "test-thread-conditionss_delete_callback.h"
+#include "test-thread-conditionss_destroy_callback.h"
#include "test-thread-create.h"
#include "test-thread-detach.h"
#include "test-thread-exit.h"
#include "test-thread-key_set.h"
#include "test-thread-keys_delete_callback.h"
#include "test-thread-keys_destroy_callback.h"
+#include "test-thread-keyss_delete_callback.h"
+#include "test-thread-keyss_destroy_callback.h"
#include "test-thread-lock_attribute_create.h"
#include "test-thread-lock_attribute_delete.h"
#include "test-thread-lock_attribute_shared_get.h"
#include "test-thread-lock_attribute_shared_set.h"
#include "test-thread-lock_attributes_delete_callback.h"
#include "test-thread-lock_attributes_destroy_callback.h"
+#include "test-thread-lock_attributess_delete_callback.h"
+#include "test-thread-lock_attributess_destroy_callback.h"
#include "test-thread-lock_create.h"
#include "test-thread-lock_delete.h"
#include "test-thread-lock_full_delete.h"
#include "test-thread-lock_fulls_delete_callback.h"
#include "test-thread-lock_fulls_destroy_callback.h"
+#include "test-thread-lock_fullss_delete_callback.h"
+#include "test-thread-lock_fullss_destroy_callback.h"
#include "test-thread-lock_read.h"
#include "test-thread-lock_read_timed.h"
#include "test-thread-lock_read_try.h"
#include "test-thread-lock_write_try.h"
#include "test-thread-locks_delete_callback.h"
#include "test-thread-locks_destroy_callback.h"
+#include "test-thread-lockss_delete_callback.h"
+#include "test-thread-lockss_destroy_callback.h"
#include "test-thread-mutex_attribute_create.h"
#include "test-thread-mutex_attribute_delete.h"
#include "test-thread-mutex_attribute_priority_ceiling_get.h"
#include "test-thread-mutex_attribute_protocol_set.h"
#include "test-thread-mutex_attributes_delete_callback.h"
#include "test-thread-mutex_attributes_destroy_callback.h"
+#include "test-thread-mutex_attributess_delete_callback.h"
+#include "test-thread-mutex_attributess_destroy_callback.h"
#include "test-thread-mutex_consistent.h"
#include "test-thread-mutex_create.h"
#include "test-thread-mutex_delete.h"
#include "test-thread-mutex_full_delete.h"
#include "test-thread-mutex_fulls_delete_callback.h"
#include "test-thread-mutex_fulls_destroy_callback.h"
+#include "test-thread-mutex_fullss_delete_callback.h"
+#include "test-thread-mutex_fullss_destroy_callback.h"
#include "test-thread-mutex_lock.h"
#include "test-thread-mutex_lock_timed.h"
#include "test-thread-mutex_lock_try.h"
#include "test-thread-mutex_priority_ceiling_set.h"
#include "test-thread-mutexs_delete_callback.h"
#include "test-thread-mutexs_destroy_callback.h"
+#include "test-thread-mutexss_delete_callback.h"
+#include "test-thread-mutexss_destroy_callback.h"
#include "test-thread-name_get.h"
#include "test-thread-name_set.h"
#include "test-thread-once.h"
#include "test-thread-semaphore_value_get.h"
#include "test-thread-semaphores_delete_callback.h"
#include "test-thread-semaphores_destroy_callback.h"
+#include "test-thread-semaphoress_delete_callback.h"
+#include "test-thread-semaphoress_destroy_callback.h"
#include "test-thread-sets_delete_callback.h"
#include "test-thread-sets_destroy_callback.h"
+#include "test-thread-setss_delete_callback.h"
+#include "test-thread-setss_destroy_callback.h"
#include "test-thread-signal_mask.h"
#include "test-thread-signal_queue.h"
#include "test-thread-signal_write.h"
#include "test-thread-spin_unlock.h"
#include "test-thread-spins_delete_callback.h"
#include "test-thread-spins_destroy_callback.h"
+#include "test-thread-spinss_delete_callback.h"
+#include "test-thread-spinss_destroy_callback.h"
#ifdef __cplusplus
extern "C" {