}
#endif // _di_f_thread_mutex_lock_try_
+#ifndef _di_f_thread_semaphore_create_
+ f_status_t f_thread_semaphore_create(const bool shared, const unsigned int value, f_thread_semaphore_t *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_supported_not);
+
+ return F_status_set_error(F_failure);
+ }
+
+ return F_none;
+ }
+#endif // _di_f_thread_semaphore_create_
+
+#ifndef _di_f_thread_semaphore_delete_
+ f_status_t f_thread_semaphore_delete(f_thread_semaphore_t *semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_thread_semaphore_delete(semaphore);
+ }
+#endif // _di_f_thread_semaphore_delete_
+
+#ifndef _di_f_thread_semaphore_file_create_
+ f_status_t f_thread_semaphore_file_create(const f_string_t name, const int flag, mode_t mode, unsigned int value, f_thread_semaphore_t *semaphore) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphore) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (flag & O_CREAT) {
+ semaphore = sem_open(name, flag, mode, value);
+ }
+ else {
+ semaphore = sem_open(name, 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_none;
+ }
+#endif // _di_f_thread_semaphore_file_create_
+
+#ifndef _di_f_thread_semaphore_file_delete_
+ f_status_t f_thread_semaphore_file_delete(f_thread_semaphore_t *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_none;
+ }
+#endif // _di_f_thread_semaphore_file_delete_
+
+#ifndef _di_f_thread_semaphore_file_destroy_
+ f_status_t f_thread_semaphore_file_destroy(const f_string_t name) {
+
+ if (sem_unlink(name) == -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_none;
+ }
+#endif // _di_f_thread_semaphore_file_destroy_
+
+#ifndef _di_f_thread_semaphore_lock_
+ f_status_t f_thread_semaphore_lock(f_thread_semaphore_t *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_none;
+ }
+#endif // _di_f_thread_semaphore_lock_
+
+#ifndef _di_f_thread_semaphore_lock_timed_
+ f_status_t f_thread_semaphore_lock_timed(const struct timespec *timeout, f_thread_semaphore_t *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_none;
+ }
+#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 *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_none;
+ }
+#endif // _di_f_thread_semaphore_lock_try_
+
+#ifndef _di_f_thread_semaphore_unlock_
+ f_status_t f_thread_semaphore_unlock(f_thread_semaphore_t *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_none;
+ }
+#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 *semaphore, int *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_none;
+ }
+#endif // _di_f_thread_semaphore_value_get_
+
#ifndef _di_f_thread_mutex_priority_ceiling_get_
f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t *mutex, int *ceiling) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_thread_scheduler_priority_set_
+#ifndef _di_f_thread_semaphores_adjust_
+ f_status_t f_thread_semaphores_adjust(const f_array_length_t length, f_thread_semaphores_t *semaphores) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphores) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_thread_semaphores_adjust(length, semaphores);
+ }
+#endif // _di_f_thread_semaphores_adjust_
+
+#ifndef _di_f_thread_semaphores_decimate_by_
+ f_status_t f_thread_semaphores_decimate_by(const f_array_length_t amount, f_thread_semaphores_t *semaphores) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!semaphores) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (semaphores->size - amount > 0) {
+ return private_f_thread_semaphores_adjust(semaphores->size - amount, semaphores);
+ }
+
+ return private_f_thread_semaphores_adjust(0, semaphores);
+ }
+#endif // _di_f_thread_semaphores_decimate_by_
+
+#ifndef _di_f_thread_semaphores_decrease_by_
+ f_status_t f_thread_semaphores_decrease_by(const f_array_length_t amount, f_thread_semaphores_t *semaphores) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!semaphores) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (semaphores->size - amount > 0) {
+ return private_f_thread_semaphores_resize(semaphores->size - amount, semaphores);
+ }
+
+ return private_f_thread_semaphores_resize(0, semaphores);
+ }
+#endif // _di_f_thread_semaphores_decrease_by_
+
+#ifndef _di_f_thread_semaphores_increase_
+ f_status_t f_thread_semaphores_increase(f_thread_semaphores_t *semaphores) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphores) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (semaphores->used + 1 > semaphores->size) {
+ f_array_length_t size = semaphores->used + f_memory_default_allocation_step;
+
+ if (size > f_array_length_t_size) {
+ if (semaphores->used + 1 > f_array_length_t_size) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ size = f_array_length_t_size;
+ }
+
+ return private_f_thread_semaphores_resize(size, semaphores);
+ }
+
+ return F_data_not;
+ }
+#endif // _di_f_thread_semaphores_increase_
+
+#ifndef _di_f_thread_semaphores_increase_by_
+ f_status_t f_thread_semaphores_increase_by(const f_array_length_t amount, f_thread_semaphores_t *semaphores) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!amount) return F_status_set_error(F_parameter);
+ if (!semaphores) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (semaphores->used + amount > semaphores->size) {
+ if (semaphores->used + amount > f_array_length_t_size) {
+ return F_status_set_error(F_array_too_large);
+ }
+
+ return private_f_thread_semaphores_resize(semaphores->used + amount, semaphores);
+ }
+
+ return F_data_not;
+ }
+#endif // _di_f_thread_semaphores_increase_by_
+
+#ifndef _di_f_thread_semaphores_resize_
+ f_status_t f_thread_semaphores_resize(const f_array_length_t length, f_thread_semaphores_t *semaphores) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!semaphores) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return private_f_thread_semaphores_resize(length, semaphores);
+ }
+#endif // _di_f_thread_semaphores_resize_
+
#ifndef _di_f_thread_sets_adjust_
f_status_t f_thread_sets_adjust(const f_array_length_t length, f_thread_sets_t *sets) {
#ifndef _di_level_0_parameter_checking_
#define _GNU_SOURCE
// libc includes
+#include <fcntl.h>
+#include <semaphore.h>
#include <signal.h>
#include <sys/types.h>
#include <time.h>
#include <level_0/type.h>
#include <level_0/status.h>
#include <level_0/memory.h>
+#include <level_0/string.h>
// fll-0 thread includes
#include <level_0/thread-common.h>
*
* 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_atfork()
* F_none 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()
*
* 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()
* F_none 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()
* F_none 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()
* F_none 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()
* F_none 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()
*
* 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()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_getattr_default_np()
*
* 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()
* F_none 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()
* F_none 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()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_attr_setdetachstate()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_attr_getguardsize()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_attr_setguardsize()
* F_none 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()
* F_none 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()
* F_none 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()
* F_none 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()
* F_none 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()
* F_none 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()
* F_none 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()
*
* F_parameter (with error bit) if a parameter is invalid.
* F_supported_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()
*
* 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()
*
* 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()
* F_none 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()
* F_none 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()
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_attributes_increase_by_
extern f_status_t f_thread_attributes_increase_by(const f_array_length_t amount, f_thread_attributes_t *attributes);
*
* 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()
* F_none 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()
* F_none 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()
* F_none 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()
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_barrier_attributes_increase_by_
extern f_status_t f_thread_barrier_attributes_increase_by(const f_array_length_t amount, f_thread_barrier_attributes_t *attributes);
*
* 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_barrier_init()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_barrier_destroy()
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_barriers_increase_by_
extern f_status_t f_thread_barriers_increase_by(const f_array_length_t amount, f_thread_barriers_t *barriers);
* F_none 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()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_setcancelstate()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_setcanceltype()
*
* F_found_not (with error bit) if no thread by the given ID was found.
* F_supported_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()
*
* 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()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_setconcurrency()
* F_none 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()
*
* F_busy (with error bit) if the attribute is busy.
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_condattr_destroy()
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_condition_attributes_increase_by_
extern f_status_t f_thread_condition_attributes_increase_by(const f_array_length_t amount, f_thread_condition_attributes_t *attributes);
* F_none 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()
* F_none 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()
* F_none 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()
* F_none on success.
*
* F_parameter (with error bit) if a parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_cond_wait()
*
* 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_cond_timedwait()
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_conditions_increase_by_
extern f_status_t f_thread_conditions_increase_by(const f_array_length_t amount, f_thread_conditions_t *conditions);
* 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()
* 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()
*/
* F_parameter (with error bit) if a parameter is invalid.
* F_supported_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()
*/
* 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_supported_not (with error bit) if the thread is not joinable or is already being joined by another thr
+ * F_supported_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()
*/
* F_parameter (with error bit) if a parameter is invalid.
* F_supported_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()
*/
* 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()
* F_none 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()
*
* 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_
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_keys_increase_by_
extern f_status_t f_thread_keys_increase_by(const f_array_length_t amount, f_thread_keys_t *keys);
* 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()
*
* 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_rwlockattr_destroy()
* F_none 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()
* F_none 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()
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_lock_attributes_increase_by_
extern f_status_t f_thread_lock_attributes_increase_by(const f_array_length_t amount, f_thread_lock_attributes_t *attributes);
* 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()
*
* 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()
* 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_rdlock()
*/
#ifndef _di_f_thread_lock_read_
* 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_timedrdlock()
*/
#ifndef _di_f_thread_lock_read_timed_
* 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_tryrdlock()
*/
#ifndef _di_f_thread_lock_read_try_
* 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_
* 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_
* 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_
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_locks_increase_by_
extern f_status_t f_thread_locks_increase_by(const f_array_length_t amount, f_thread_locks_t *locks);
* F_none 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()
* F_none 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()
* F_none 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()
* F_none 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()
* 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_
* F_prohibited (with error bit) if not allowed to perform the operation.
* F_supported_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_
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_mutex_attributes_increase_by_
extern f_status_t f_thread_mutex_attributes_increase_by(const f_array_length_t amount, f_thread_mutex_attributes_t *attributes);
* 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()
*
* 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()
* F_parameter (with error bit) if a parameter is invalid.
* 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_
* F_resource_not (with error bit) if max mutex locks is reached.
* F_thread_not (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_timedlock()
*/
#ifndef _di_f_thread_mutex_lock_timed_
* F_parameter (with error bit) if a parameter is invalid.
* 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_mutex_lock_try_
* 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_
* F_resource_not (with error bit) if max mutex locks is reached.
* F_thread_not (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_
* F_prohibited (with error bit) if not allowed to perform the operation (possibly because mutex is not owned by current thread).
* F_resource_not (with error bit) if max mutex locks is reached.
*
+ * F_failure (with error bit) on any other error.
+ *
* @see pthread_mutex_unlock()
*/
#ifndef _di_f_thread_mutex_unlock_
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_mutexs_increase_by_
extern f_status_t f_thread_mutexs_increase_by(const f_array_length_t amount, f_thread_mutexs_t *mutexs);
*
* 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_
*
* F_parameter (with error bit) if a parameter is invalid.
* F_supported_not (with error bit) if the policy or scheduling parameter is invalid.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_getschedparam()
*
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if insufficient privileges or scheduler (or policy) does not allow operation.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_setschedparam()
* @return
* F_none on success.
*
+ * F_found_not (with error bit) no thread by the given ID was found.
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if insufficient privileges.
- * F_found_not (with error bit) no thread by the given ID was found.
+ *
* F_failure (with error bit) on any other error.
*
* @see pthread_setschedprio()
#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.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_supported_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 *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.
+ *
+ * @return
+ * F_none 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 *semaphore);
+#endif // _di_f_thread_semaphore_delete_
+
+/**
+ * Create a thread (named) semaphore.
+ *
+ * @param name
+ * The semaphore file name to create.
+ * @param flag
+ * The file create/open flags.
+ * @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.
+ * @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.
+ * @param semaphore
+ * The thread semaphore.
+ *
+ * @return
+ * F_none 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_supported_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_create_
+ extern f_status_t f_thread_semaphore_file_create(const f_string_t name, const int flag, mode_t mode, unsigned int value, f_thread_semaphore_t *semaphore);
+#endif // _di_f_thread_semaphore_file_create_
+
+/**
+ * Delete a thread (named) semaphore.
+ *
+ * A named semaphore should be deleted with this function or with f_thread_semephore_file_destroy().
+ *
+ * @param semaphore
+ * The semaphore to delete.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * F_failure (with error bit) on any other error.
+ *
+ * A named semaphore should be deleted with this function or with f_thread_semephore_file_destroy().
+ *
+ * @see sem_close()
+ *
+ * @see f_thread_semaphore_file_destroy()
+ */
+#ifndef _di_f_thread_semaphore_file_delete_
+ extern f_status_t f_thread_semaphore_file_delete(f_thread_semaphore_t *semaphore);
+#endif // _di_f_thread_semaphore_file_delete_
+
+/**
+ * Destroy a thread (named) semaphore.
+ *
+ * This will immediately delete the semaphore file and all processes holding this semaphore will be forced to close.
+ *
+ * A named semaphore should be deleted with this function or with f_thread_semephore_file_delete().
+ *
+ * @param name
+ * The semaphore name to delete.
+ *
+ * @return
+ * F_none 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()
+ *
+ * @see f_thread_semaphore_file_delete()
+ */
+#ifndef _di_f_thread_semaphore_file_destroy_
+ extern f_status_t f_thread_semaphore_file_destroy(const f_string_t name);
+#endif // _di_f_thread_semaphore_file_destroy_
+
+/**
+ * Lock the semaphore.
+ *
+ * This is a blocking function.
+ *
+ * @param semaphore
+ * The thread semaphore.
+ *
+ * @return
+ * F_none 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 *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.
+ *
+ * @return
+ * F_none 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 struct timespec *timeout, f_thread_semaphore_t *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.
+ *
+ * @return
+ * F_none 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 *semaphore);
+#endif // _di_f_thread_semaphore_lock_try_
+
+/**
+ * Unlock the semaphore.
+ *
+ * @param semaphore
+ * The thread semaphore.
+ *
+ * @return
+ * F_none 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 *semaphore);
+#endif // _di_f_thread_semaphore_unlock_
+
+/**
+ * Get the semaphore value.
+ *
+ * @param semaphore
+ * The thread semaphore.
+ * @param value
+ * The semaphore's value.
+ *
+ * @return
+ * F_none 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 *semaphore, int *value);
+#endif // _di_f_thread_semaphore_value_get_
+
+/**
+ * Resize the thread semaphores array.
+ *
+ * @param length
+ * The new size to use.
+ * @param semaphores
+ * The string semaphores array to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_memory_not (with error bit) on out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_thread_semaphores_adjust_
+ extern f_status_t f_thread_semaphores_adjust(const f_array_length_t length, f_thread_semaphores_t *semaphores);
+#endif // _di_f_thread_semaphores_adjust_
+
+/**
+ * Resize the thread semaphores array to a smaller size.
+ *
+ * This will resize making the array smaller based on (size - given length).
+ * If the given length is too small, then the resize will fail.
+ * This will not shrink the size to less than 0.
+ *
+ * @param amount
+ * A positive number representing how much to decimate the size by.
+ * @param semaphores
+ * The string semaphores array to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_memory_not (with error bit) on out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_thread_semaphores_decimate_by_
+ extern f_status_t f_thread_semaphores_decimate_by(const f_array_length_t amount, f_thread_semaphores_t *semaphores);
+#endif // _di_f_thread_semaphores_decimate_by_
+
+/**
+ * Resize the thread semaphores array to a smaller size.
+ *
+ * This will resize making the array smaller based on (size - given length).
+ * If the given length is too small, then the resize will fail.
+ * This will not shrink the size to less than 0.
+ *
+ * @param amount
+ * A positive number representing how much to decrease the size by.
+ * @param semaphores
+ * The string semaphores array to resize.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_memory_not (with error bit) on out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_thread_semaphores_decrease_by_
+ extern f_status_t f_thread_semaphores_decrease_by(const f_array_length_t amount, f_thread_semaphores_t *semaphores);
+#endif // _di_f_thread_semaphores_decrease_by_
+
+/**
+ * Increase the size of the thread semaphores array, but only if necessary.
+ *
+ * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
+ * If already set to the maximum buffer size, then the resize will fail.
+ *
+ * @param semaphores
+ * The string semaphores array to resize.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is no reason to increase size (used + 1 <= size).
+ *
+ * F_array_too_large (with error bit) if the new array length is too large.
+ * F_memory_not (with error bit) on out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_thread_semaphores_increase_
+ extern f_status_t f_thread_semaphores_increase(f_thread_semaphores_t *semaphores);
+#endif // _di_f_thread_semaphores_increase_
+
+/**
+ * Resize the thread semaphores array to a larger size.
+ *
+ * This will resize making the array larger based on the given length.
+ * If the given length is too large for the buffer, then attempt to set max buffer size (f_array_length_t_size).
+ * If already set to the maximum buffer size, then the resize will fail.
+ *
+ * @param amount
+ * A positive number representing how much to increase the size by.
+ * @param semaphores
+ * The string semaphores array to resize.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is no reason to increase size (used + amount <= size).
+ *
+ * F_array_too_large (with error bit) if the new array length is too large.
+ * F_memory_not (with error bit) on out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_thread_semaphores_increase_by_
+ extern f_status_t f_thread_semaphores_increase_by(const f_array_length_t amount, f_thread_semaphores_t *semaphores);
+#endif // _di_f_thread_semaphores_increase_by_
+
+/**
+ * Resize the thread semaphores array.
+ *
+ * @param length
+ * The new size to use.
+ * @param semaphores
+ * The string semaphores array to adjust.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_memory_not (with error bit) on out of memory.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_thread_semaphores_resize_
+ extern f_status_t f_thread_semaphores_resize(const f_array_length_t length, f_thread_semaphores_t *semaphores);
+#endif // _di_f_thread_semaphores_resize_
+
+/**
* Resize the thread sets array.
*
* @param length
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_sets_increase_by_
extern f_status_t f_thread_sets_increase_by(const f_array_length_t amount, f_thread_sets_t *sets);
* F_none on success but no signal found.
*
* F_parameter (with error bit) if a parameter is invalid.
- * F_failure (with error bit) for any other error.
+ *
+ * F_failure (with error bit) on any other error.
*
* @see pthread_sigmask()
*/
* F_parameter (with error bit) if a parameter is invalid.
* F_resource_not (with error bit) if the max signals is reached.
* F_supported_not (with error bit) if this action is not supported by the current OS.
- * F_failure (with error bit) for any other error.
+ *
+ * F_failure (with error bit) on any other error.
*
* @see pthread_sigqueue()
*/
* 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()
*
* 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()
* 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_
* 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_
* 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_
* F_none on success.
* F_data_not on success, but there is no reason to increase size (used + amount <= size).
*
+ * F_array_too_large (with error bit) if the new array length is too large.
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
- * F_array_too_large (with error bit) if the new array length is too large.
*/
#ifndef _di_f_thread_spins_increase_by_
extern f_status_t f_thread_spins_increase_by(const f_array_length_t amount, f_thread_spins_t *spins);
* F_prohibited (with error bit) if not allowed to perform the operation (possibly because lock is not owned by current thread).
* F_resource_not (with error bit) if max lock locks is reached.
*
+ * F_failure (with error bit) on any other error.
+ *
* @see pthread_rwlock_unlock()
*/
#ifndef _di_f_thread_unlock_