From af75b037837ba8855c37cd09b55e68811af7a17a Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 25 Apr 2024 21:57:36 -0500 Subject: [PATCH] Update: Add "const" to the pointer in numerous thread functions. These are past directly to the thread functions that do not have "const" qualifier. This needs extensive testing. Clean up related function comments. --- level_0/f_thread/c/thread.c | 48 ++++++------ level_0/f_thread/c/thread.h | 174 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 166 insertions(+), 56 deletions(-) diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index c9dcfb2..a680544 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -51,7 +51,7 @@ extern "C" { #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 *affinity_set, f_thread_attribute_t * const attribute) { + 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_ @@ -59,7 +59,7 @@ extern "C" { 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 *affinity_set, f_thread_attribute_t * const attribute) { + 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_ @@ -390,7 +390,7 @@ extern "C" { #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 **stack) { + 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); @@ -484,7 +484,7 @@ extern "C" { #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 *attribute) { + 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_ @@ -531,7 +531,7 @@ extern "C" { #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 *barrier) { + 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_ @@ -552,7 +552,7 @@ extern "C" { #endif // _di_f_thread_barrier_create_ #ifndef _di_f_thread_barrier_delete_ - f_status_t f_thread_barrier_delete(f_thread_barrier_t *barrier) { + 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_ @@ -745,7 +745,7 @@ extern "C" { #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 *condition_attribute) { + f_status_t f_thread_condition_attribute_delete(f_thread_condition_attribute_t * const condition_attribute) { #ifndef _di_level_0_parameter_checking_ if (!condition_attribute) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -824,7 +824,7 @@ extern "C" { #endif // _di_f_thread_condition_create_ #ifndef _di_f_thread_condition_delete_ - f_status_t f_thread_condition_delete(f_thread_condition_t *condition) { + 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_ @@ -901,7 +901,7 @@ extern "C" { #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 *wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex) { + 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); @@ -924,7 +924,7 @@ extern "C" { #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, void *(*routine) (void *), void *argument) { + f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, void *(*routine) (void *), 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); @@ -961,7 +961,7 @@ extern "C" { #endif // _di_f_thread_detach_ #ifndef _di_f_thread_exit_ - f_status_t f_thread_exit(int *result) { + 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_ @@ -973,7 +973,7 @@ extern "C" { #endif // _di_f_thread_exit_ #ifndef _di_f_thread_join_ - f_status_t f_thread_join(const f_thread_id_t id, void **result) { + f_status_t f_thread_join(const f_thread_id_t id, void ** const result) { const int error = pthread_join(id, result); @@ -991,7 +991,7 @@ extern "C" { #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 **result) { + f_status_t f_thread_join_try(const f_thread_id_t id, void ** const result) { const int error = pthread_tryjoin_np(id, result); @@ -1010,7 +1010,7 @@ extern "C" { #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 **result) { + 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); @@ -1064,7 +1064,7 @@ extern "C" { #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 **value) { + 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_ @@ -1076,7 +1076,7 @@ extern "C" { #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 *value) { + 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_ @@ -1116,7 +1116,7 @@ extern "C" { #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 *attribute) { + 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_ @@ -1187,7 +1187,7 @@ extern "C" { #endif // _di_f_thread_lock_create_ #ifndef _di_f_thread_lock_delete_ - f_status_t f_thread_lock_delete(f_thread_lock_t *lock) { + 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_ @@ -1353,7 +1353,7 @@ extern "C" { #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 *attribute) { + 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_ @@ -1558,7 +1558,7 @@ extern "C" { #endif // _di_f_thread_mutex_create_ #ifndef _di_f_thread_mutex_delete_ - f_status_t f_thread_mutex_delete(f_thread_mutex_t *mutex) { + 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_ @@ -1815,7 +1815,7 @@ extern "C" { #endif // _di_f_thread_semaphore_create_ #ifndef _di_f_thread_semaphore_delete_ - f_status_t f_thread_semaphore_delete(f_thread_semaphore_t *semaphore) { + 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_ @@ -1827,7 +1827,7 @@ extern "C" { #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 *semaphore) { + 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_ @@ -1859,7 +1859,7 @@ extern "C" { #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 **semaphore) { + 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); @@ -2064,7 +2064,7 @@ extern "C" { #endif // _di_f_thread_spin_create_ #ifndef _di_f_thread_spin_delete_ - f_status_t f_thread_spin_delete(f_thread_spin_t *spin) { + 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_ diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index b21aa81..31abe60 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -56,10 +56,13 @@ extern "C" { * * @param before * The function to call before forking. + * Must not be NULL. * @param after_parent * The function called after forking, for the parent process. + * Must not be NULL. * @param after_child * The function called after forking, for the child process. + * Must not be NULL. * * @return * F_okay on success. @@ -84,6 +87,7 @@ extern "C" { * The size of the affinity_set. * @param affinity_set * The assigned affinity information. + * Must not be NULL. * * @return * F_okay on success. @@ -107,6 +111,7 @@ extern "C" { * The affinity information to assign. * @param attribute * The thread attributes to update. + * Must not be NULL. * * @return * F_okay on success. @@ -130,6 +135,7 @@ extern "C" { * * @param level * The concurrency level. + * Must not be NULL. * * @return * F_okay on success. @@ -171,8 +177,8 @@ extern "C" { * Create (initialize) a thread attribute structure. * * @param attribute - * (optional) The attribute to set. - * Set to NULL to not use (in which case the default attribute is used). + * The attribute to set. + * Must not be NULL. * * @return * F_okay on success. @@ -193,6 +199,7 @@ extern "C" { * * @param attribute * The thread attributes to process. + * Must not be NULL. * * @return * F_okay on success. @@ -212,6 +219,7 @@ extern "C" { * * @param attribute * The thread attributes to update. + * Must not be NULL. * * @return * F_okay on success. @@ -237,6 +245,7 @@ extern "C" { * * @param attribute * The thread attributes to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -258,6 +267,7 @@ extern "C" { * The thread attributes to process. * @param state * The currently assigned state. + * Must not be NULL. * * @return * F_okay on success. @@ -279,6 +289,7 @@ extern "C" { * 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. @@ -300,6 +311,7 @@ extern "C" { * The thread attributes to process. * @param guard * The currently assigned guard size. + * Must not be NULL. * * @return * F_okay on success. @@ -321,6 +333,7 @@ extern "C" { * The guard size to assign. * @param attribute * The thread attributes to update. + * Must not be NULL. * * @return * F_okay on success. @@ -342,6 +355,7 @@ extern "C" { * The thread attributes to process. * @param inherit * The currently assigned scheduler inherit state. + * Must not be NULL. * * @return * F_okay on success. @@ -363,6 +377,7 @@ extern "C" { * 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. @@ -384,6 +399,7 @@ extern "C" { * The thread attributes to process. * @param parameter * The currently assigned scheduler parameters. + * Must not be NULL. * * @return * F_okay on success. @@ -405,6 +421,7 @@ extern "C" { * The parameters of the scheduler. * @param attribute * The thread attributes to update. + * Must not be NULL. * * @return * F_okay on success. @@ -426,6 +443,7 @@ extern "C" { * The thread attributes to process. * @param policy * The currently assigned scheduler policy state. + * Must not be NULL. * * @return * F_okay on success. @@ -447,6 +465,7 @@ extern "C" { * 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. @@ -468,6 +487,7 @@ extern "C" { * The thread attributes to process. * @param scope * The currently assigned scheduler scope state. + * Must not be NULL. * * @return * F_okay on success. @@ -489,6 +509,7 @@ extern "C" { * 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. @@ -511,8 +532,10 @@ extern "C" { * 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. @@ -525,7 +548,7 @@ extern "C" { * @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 **stack); + 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_ /** @@ -535,8 +558,10 @@ extern "C" { * The size of the stack. * @param stack * The stack to assign. + * Must not be NULL. * @param attribute - * The thread attributes to update. + * The thread attributes to update + * Must not be NULL.. * * @return * F_okay on success. @@ -559,6 +584,7 @@ extern "C" { * The thread attributes to process. * @param stack_size * The assigned size of the stack. + * Must not be NULL. * * @return * F_okay on success. @@ -580,6 +606,7 @@ extern "C" { * The size of the stack. * @param attribute * The thread attributes to update. + * Must not be NULL. * * @return * F_okay on success. @@ -598,8 +625,8 @@ extern "C" { * Create (initialize) a thread barrier attribute structure. * * @param attribute - * (optional) The attribute to set. - * Set to NULL to not use (in which case the default attribute is used). + * The attribute to set. + * Must not be NULL. * * @return * F_okay on success. @@ -625,6 +652,7 @@ extern "C" { * * @param attribute * The thread barrier_attributes to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -636,7 +664,7 @@ extern "C" { * @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 *attribute); + extern f_status_t f_thread_barrier_attribute_delete(f_thread_barrier_attribute_t * const attribute); #endif // _di_f_thread_barrier_attribute_delete_ /** @@ -644,8 +672,10 @@ extern "C" { * * @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. @@ -667,6 +697,7 @@ extern "C" { * The process shared attribute value. * @param attribute * The barrier thread attribute. + * Must not be NULL. * * @return * F_okay on success. @@ -691,6 +722,7 @@ extern "C" { * 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. @@ -705,7 +737,7 @@ extern "C" { * @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 *barrier); + 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_ /** @@ -718,6 +750,7 @@ extern "C" { * * @param barrier * The thread barriers to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -729,7 +762,7 @@ extern "C" { * @see pthread_barrier_destroy() */ #ifndef _di_f_thread_barrier_delete_ - extern f_status_t f_thread_barrier_delete(f_thread_barrier_t *barrier); + extern f_status_t f_thread_barrier_delete(f_thread_barrier_t * const barrier); #endif // _di_f_thread_barrier_delete_ /** @@ -737,6 +770,7 @@ extern "C" { * * @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. @@ -850,6 +884,7 @@ extern "C" { * The ID of the thread to use. * @param id_clock * The retrieved clock ID. + * Must not be NULL. * * @return * F_okay on success. @@ -887,6 +922,7 @@ extern "C" { * @param attribute * The attribute to set. * This assigns the default to the attribute. + * Must not be NULL. * * @return * F_okay on success. @@ -906,8 +942,10 @@ extern "C" { * * @param attribute * The thread condition attribute. + * Must not be NULL. * @param id * The clock ID. + * Must not be NULL. * * @return * F_okay on success. @@ -929,6 +967,7 @@ extern "C" { * The clock ID. * @param attribute * The thread condition attribute. + * Must not be NULL. * * @return * F_okay on success. @@ -951,6 +990,7 @@ extern "C" { * * @param attribute * The attribute to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -963,7 +1003,7 @@ extern "C" { * @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 *attribute); + extern f_status_t f_thread_condition_attribute_delete(f_thread_condition_attribute_t * const attribute); #endif // _di_f_thread_condition_attribute_delete_ /** @@ -1038,6 +1078,7 @@ extern "C" { * * @param condition * The condition to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -1049,7 +1090,7 @@ extern "C" { * @see pthread_cond_destroy() */ #ifndef _di_f_thread_condition_delete_ - extern f_status_t f_thread_condition_delete(f_thread_condition_t *condition); + extern f_status_t f_thread_condition_delete(f_thread_condition_t * const condition); #endif // _di_f_thread_condition_delete_ /** @@ -1129,8 +1170,10 @@ extern "C" { * 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. @@ -1146,7 +1189,7 @@ extern "C" { * @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 *wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex); + 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_ /** @@ -1158,8 +1201,10 @@ extern "C" { * @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. @@ -1176,7 +1221,7 @@ extern "C" { * @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, void *(*routine) (void *), void *argument); + extern f_status_t f_thread_create(const f_thread_attribute_t * const attribute, f_thread_id_t * const id, void *(*routine) (void *), void * const argument); #endif // _di_f_thread_create_ /** @@ -1210,6 +1255,7 @@ extern "C" { * * @param result * The code returned by the exited thread. + * Must not be NULL. * * @return * F_okay on success. @@ -1219,7 +1265,7 @@ extern "C" { * @see pthread_exit() */ #ifndef _di_f_thread_exit_ - extern f_status_t f_thread_exit(int *result); + extern f_status_t f_thread_exit(int * const result); #endif // _di_f_thread_exit_ /** @@ -1247,7 +1293,7 @@ extern "C" { * @see pthread_join() */ #ifndef _di_f_thread_join_ - extern f_status_t f_thread_join(const f_thread_id_t id, void **result); + extern f_status_t f_thread_join(const f_thread_id_t id, void ** const result); #endif // _di_f_thread_join_ /** @@ -1276,7 +1322,7 @@ extern "C" { * @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 **result); + extern f_status_t f_thread_join_try(const f_thread_id_t id, void ** const result); #endif // _di_f_thread_join_try_ /** @@ -1310,7 +1356,7 @@ extern "C" { * @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 **result); + 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_ /** @@ -1318,8 +1364,10 @@ extern "C" { * * @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. @@ -1344,6 +1392,7 @@ extern "C" { * * @param key * The key to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -1365,6 +1414,7 @@ extern "C" { * The thread key. * @param value * The assigned thread key value. + * Must not be NULL. * * @return * F_okay on success. @@ -1374,7 +1424,7 @@ extern "C" { * @see pthread_getspecific() */ #ifndef _di_f_thread_key_get_ - extern f_status_t f_thread_key_get(const f_thread_key_t key, void **value); + extern f_status_t f_thread_key_get(const f_thread_key_t key, void ** const value); #endif // _di_f_thread_key_get_ /** @@ -1384,6 +1434,7 @@ extern "C" { * The thread key. * @param value * The thread key value to assign. + * Must not be NULL. * * @return * F_okay on success. @@ -1395,7 +1446,7 @@ extern "C" { * @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 *value); + extern f_status_t f_thread_key_set(const f_thread_key_t key, const void * const value); #endif // _di_f_thread_key_set_ /** @@ -1403,6 +1454,7 @@ extern "C" { * * @param attribute * The lock attributes to create. + * Must not be NULL. * * @return * F_okay on success. @@ -1429,6 +1481,7 @@ extern "C" { * * @param attribute * The attribute to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -1441,7 +1494,7 @@ extern "C" { * @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 *attribute); + extern f_status_t f_thread_lock_attribute_delete(f_thread_lock_attribute_t * const attribute); #endif // _di_f_thread_lock_attribute_delete_ /** @@ -1449,8 +1502,10 @@ extern "C" { * * @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. @@ -1468,10 +1523,11 @@ extern "C" { /** * Set the lock attribute process shared thread attribute. * - * @param attribute - * The lock attribute. * @param shared * The lock shared attribute value. + * @param attribute + * The lock attribute. + * Must not be NULL. * * @return * F_okay on success. @@ -1491,6 +1547,7 @@ extern "C" { * * @param attribute * The lock attribute. + * Must not be NULL. * @param lock * The lock to create. * @@ -1517,6 +1574,7 @@ extern "C" { * * @param lock * The lock to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -1529,7 +1587,7 @@ extern "C" { * @see pthread_rwlock_destroy() */ #ifndef _di_f_thread_lock_delete_ - extern f_status_t f_thread_lock_delete(f_thread_lock_t *lock); + extern f_status_t f_thread_lock_delete(f_thread_lock_t * const lock); #endif // _di_f_thread_lock_delete_ /** @@ -1539,6 +1597,7 @@ extern "C" { * * @param lock * The thread lock. + * Must not be NULL. * * @return * F_okay on success. @@ -1564,8 +1623,10 @@ extern "C" { * * @param timeout * The timeout. + * Must not be NULL. * @param lock * The read/write lock. + * Must not be NULL. * * @return * F_okay on success. @@ -1592,6 +1653,7 @@ extern "C" { * * @param lock * The thread lock. + * Must not be NULL. * * @return * F_okay on success. @@ -1615,6 +1677,7 @@ extern "C" { * * @param lock * The thread lock. + * Must not be NULL. * * @return * F_okay on success. @@ -1640,8 +1703,10 @@ extern "C" { * * @param timeout * The timeout. + * Must not be NULL. * @param lock * The read/write lock. + * Must not be NULL. * * @return * F_okay on success. @@ -1667,6 +1732,7 @@ extern "C" { * * @param lock * The thread lock. + * Must not be NULL. * * @return * F_okay on success. @@ -1688,6 +1754,7 @@ extern "C" { * * @param attribute * The mutex attributes to create. + * Must not be NULL. * * @return * F_okay on success. @@ -1713,6 +1780,7 @@ extern "C" { * * @param attribute * The attribute to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -1724,7 +1792,7 @@ extern "C" { * @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 *attribute); + extern f_status_t f_thread_mutex_attribute_delete(f_thread_mutex_attribute_t * const attribute); #endif // _di_f_thread_mutex_attribute_delete_ /** @@ -1732,8 +1800,10 @@ extern "C" { * * @param attribute * The thread mutex attribute. + * Must not be NULL. * @param ceiling * The priority ceiling. + * Must not be NULL. * * @return * F_okay on success. @@ -1754,6 +1824,7 @@ extern "C" { * The priority ceiling. * @param attribute * The thread mutex attribute. + * Must not be NULL. * * @return * F_okay on success. @@ -1772,8 +1843,10 @@ extern "C" { * * @param attribute * The thread mutex attribute. + * Must not be NULL. * @param protocol * The protocol. + * Must not be NULL. * * @return * F_okay on success. @@ -1796,6 +1869,7 @@ extern "C" { * The protocol. * @param attribute * The thread mutex attribute. + * Must not be NULL. * * @return * F_okay on success. @@ -1817,8 +1891,10 @@ extern "C" { * * @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. @@ -1836,10 +1912,11 @@ extern "C" { /** * Set the mutex attribute process shared thread attribute. * - * @param attribute - * The mutex attribute. * @param shared * The mutex shared attribute value. + * @param attribute + * The mutex attribute. + * Must not be NULL. * * @return * F_okay on success. @@ -1859,8 +1936,10 @@ extern "C" { * * @param attribute * The mutex attribute. + * Must not be NULL. * @param type * The type. + * Must not be NULL. * * @return * F_okay on success. @@ -1882,6 +1961,7 @@ extern "C" { * The type. * @param attribute * The mutex attribute. + * Must not be NULL. * * @return * F_okay on success. @@ -1904,6 +1984,7 @@ extern "C" { * 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. @@ -1930,6 +2011,7 @@ extern "C" { * * @param mutex * The mutex to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -1942,7 +2024,7 @@ extern "C" { * @see pthread_mutex_destroy() */ #ifndef _di_f_thread_mutex_delete_ - extern f_status_t f_thread_mutex_delete(f_thread_mutex_t *mutex); + extern f_status_t f_thread_mutex_delete(f_thread_mutex_t * const mutex); #endif // _di_f_thread_mutex_delete_ /** @@ -1950,8 +2032,10 @@ extern "C" { * * @param mutex * The thread mutex. + * Must not be NULL. * @param ceiling * The priority ceiling. + * Must not be NULL. * * @return * F_okay on success. @@ -1974,6 +2058,7 @@ extern "C" { * 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. @@ -2001,6 +2086,7 @@ extern "C" { * * @param mutex * The thread mutex. + * Must not be NULL. * * @return * F_okay on success. @@ -2024,6 +2110,7 @@ extern "C" { * * @param mutex * The thread mutex. + * Must not be NULL. * * @return * F_okay on success. @@ -2049,8 +2136,10 @@ extern "C" { * * @param timeout * The timeout. + * Must not be NULL. * @param mutex * The thread mutex. + * Must not be NULL. * * @return * F_okay on success. @@ -2080,6 +2169,7 @@ extern "C" { * * @param mutex * The thread mutex. + * Must not be NULL. * * @return * F_okay on success. @@ -2105,6 +2195,7 @@ extern "C" { * 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. @@ -2126,8 +2217,10 @@ extern "C" { * The thread ID. * @param policy * The scheduler policy + * Must not be NULL. * @param parameter * The scheduler parameter + * Must not be NULL. * * @return * F_okay on success. @@ -2152,6 +2245,7 @@ extern "C" { * The scheduler policy * @param parameter * The scheduler parameter + * Must not be NULL. * * @return * F_okay on success. @@ -2164,7 +2258,7 @@ extern "C" { * @see pthread_setschedparam() */ #ifndef _di_f_thread_scheduler_parameter_set_ - extern f_status_t f_thread_scheduler_parameter_set(const f_thread_id_t id, const int policy, const struct sched_param *parameter); + extern f_status_t f_thread_scheduler_parameter_set(const f_thread_id_t id, const int policy, const struct sched_param * const parameter); #endif // _di_f_thread_scheduler_parameter_set_ /** @@ -2201,6 +2295,7 @@ extern "C" { * The value to initially assign the semaphore on creation. * @param semaphore * The semaphore to create. + * Must not be NULL. * * @return * F_okay on success. @@ -2224,6 +2319,7 @@ extern "C" { * * @param semaphore * The semaphore to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -2236,7 +2332,7 @@ extern "C" { * @see sem_destroy() */ #ifndef _di_f_thread_semaphore_delete_ - extern f_status_t f_thread_semaphore_delete(f_thread_semaphore_t *semaphore); + extern f_status_t f_thread_semaphore_delete(f_thread_semaphore_t * const semaphore); #endif // _di_f_thread_semaphore_delete_ /** @@ -2246,6 +2342,7 @@ extern "C" { * * @param semaphore * The semaphore to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -2257,7 +2354,7 @@ extern "C" { * @see sem_close() */ #ifndef _di_f_thread_semaphore_file_close_ - extern f_status_t f_thread_semaphore_file_close(f_thread_semaphore_t *semaphore); + extern f_status_t f_thread_semaphore_file_close(f_thread_semaphore_t * const semaphore); #endif // _di_f_thread_semaphore_file_close_ /** @@ -2306,6 +2403,7 @@ extern "C" { * Ignored when mode is NULL. * @param semaphore * The thread semaphore. + * Must not be NULL. * * @return * F_okay on success. @@ -2325,7 +2423,7 @@ extern "C" { * @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 **semaphore); + 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_ /** @@ -2337,6 +2435,7 @@ extern "C" { * * @param semaphore * The thread semaphore. + * Must not be NULL. * * @return * F_okay on success. @@ -2363,6 +2462,7 @@ extern "C" { * The timeout. * @param semaphore * The thread semaphore. + * Must not be NULL. * * @return * F_okay on success. @@ -2388,6 +2488,7 @@ extern "C" { * * @param semaphore * The thread semaphore. + * Must not be NULL. * * @return * F_okay on success. @@ -2411,6 +2512,7 @@ extern "C" { * * @param semaphore * The thread semaphore. + * Must not be NULL. * * @return * F_okay on success. @@ -2431,8 +2533,10 @@ extern "C" { * * @param semaphore * The thread semaphore. + * Must not be NULL. * @param value * The semaphore's value. + * Must not be NULL. * * @return * F_okay on success. @@ -2531,6 +2635,7 @@ extern "C" { * The shared process setting. * @param spin * The spin to create. + * Must not be NULL. * * @return * F_okay on success. @@ -2555,6 +2660,7 @@ extern "C" { * * @param spin * The spin to delete. + * Must not be NULL. * * @return * F_okay on success. @@ -2567,7 +2673,7 @@ extern "C" { * @see pthread_spin_destroy() */ #ifndef _di_f_thread_spin_delete_ - extern f_status_t f_thread_spin_delete(f_thread_spin_t *spin); + extern f_status_t f_thread_spin_delete(f_thread_spin_t * const spin); #endif // _di_f_thread_spin_delete_ /** @@ -2577,6 +2683,7 @@ extern "C" { * * @param spin * The thread spin. + * Must not be NULL. * * @return * F_okay on success. @@ -2602,6 +2709,7 @@ extern "C" { * * @param spin * The thread spin. + * Must not be NULL. * * @return * F_okay on success. @@ -2623,6 +2731,7 @@ extern "C" { * * @param spin * The thread spin. + * Must not be NULL. * * @return * F_okay on success. @@ -2644,6 +2753,7 @@ extern "C" { * * @param lock * The thread lock. + * Must not be NULL. * * @return * F_okay on success. -- 1.8.3.1