Scroll to navigation

LIBCTHREADS(3) Library Functions Manual LIBCTHREADS(3)

NAME

libcthreads.hLibrary to support cross-platform C threads functions

SYNOPSIS

#include <libcthreads.h>

Support functions


const char *
libcthreads_get_version( void);

Error functions


void
libcthreads_error_free( libcthreads_error_t **error);

int
libcthreads_error_fprint( libcthreads_error_t *error, FILE *stream);

int
libcthreads_error_sprint( libcthreads_error_t *error, char *string, size_t size);

int
libcthreads_error_backtrace_fprint( libcthreads_error_t *error, FILE *stream);

int
libcthreads_error_backtrace_sprint( libcthreads_error_t *error, char *string, size_t size);

Thread functions


int
libcthreads_thread_create( libcthreads_thread_t **thread, const libcthreads_thread_attributes_t *thread_attributes, int (*callback_function)( void *arguments ), void *callback_function_arguments, libcthreads_error_t **error);

int
libcthreads_thread_join( libcthreads_thread_t **thread, libcthreads_error_t **error);

Thread attributes functions


int
libcthreads_thread_attributes_initialize( libcthreads_thread_attributes_t **thread_attributes, libcthreads_error_t **error);

int
libcthreads_thread_attributes_free( libcthreads_thread_attributes_t **thread_attributes, libcthreads_error_t **error);

Condition functions


int
libcthreads_condition_initialize( libcthreads_condition_t **condition, libcthreads_error_t **error);

int
libcthreads_condition_free( libcthreads_condition_t **condition, libcthreads_error_t **error);

int
libcthreads_condition_broadcast( libcthreads_condition_t *condition, libcthreads_error_t **error);

int
libcthreads_condition_signal( libcthreads_condition_t *condition, libcthreads_error_t **error);

int
libcthreads_condition_wait( libcthreads_condition_t *condition, libcthreads_mutex_t *mutex, libcthreads_error_t **error);

Lock functions


int
libcthreads_lock_initialize( libcthreads_lock_t **lock, libcthreads_error_t **error);

int
libcthreads_lock_free( libcthreads_lock_t **lock, libcthreads_error_t **error);

int
libcthreads_lock_grab( libcthreads_lock_t *lock, libcthreads_error_t **error);

int
libcthreads_lock_release( libcthreads_lock_t *lock, libcthreads_error_t **error);

Mutex functions


int
libcthreads_mutex_initialize( libcthreads_mutex_t **mutex, libcthreads_error_t **error);

int
libcthreads_mutex_free( libcthreads_mutex_t **mutex, libcthreads_error_t **error);

int
libcthreads_mutex_grab( libcthreads_mutex_t *mutex, libcthreads_error_t **error);

int
libcthreads_mutex_try_grab( libcthreads_mutex_t *mutex, libcthreads_error_t **error);

int
libcthreads_mutex_release( libcthreads_mutex_t *mutex, libcthreads_error_t **error);

Read/Write lock functions


int
libcthreads_read_write_lock_initialize( libcthreads_read_write_lock_t **read_write_lock, libcthreads_error_t **error);

int
libcthreads_read_write_lock_free( libcthreads_read_write_lock_t **read_write_lock, libcthreads_error_t **error);

int
libcthreads_read_write_lock_grab_for_read( libcthreads_read_write_lock_t *read_write_lock, libcthreads_error_t **error);

int
libcthreads_read_write_lock_grab_for_write( libcthreads_read_write_lock_t *read_write_lock, libcthreads_error_t **error);

int
libcthreads_read_write_lock_release_for_read( libcthreads_read_write_lock_t *read_write_lock, libcthreads_error_t **error);

int
libcthreads_read_write_lock_release_for_write( libcthreads_read_write_lock_t *read_write_lock, libcthreads_error_t **error);

Queue functions


int
libcthreads_queue_initialize( libcthreads_queue_t **queue, int maximum_number_of_values, libcthreads_error_t **error);

int
libcthreads_queue_free( libcthreads_queue_t **queue, int (*value_free_function)( intptr_t **value, libcthreads_error_t **error ), libcthreads_error_t **error);

int
libcthreads_queue_empty( libcthreads_queue_t *queue, libcthreads_error_t **error);

int
libcthreads_queue_try_pop( libcthreads_queue_t *queue, intptr_t **value, libcthreads_error_t **error);

int
libcthreads_queue_pop( libcthreads_queue_t *queue, intptr_t **value, libcthreads_error_t **error);

int
libcthreads_queue_try_push( libcthreads_queue_t *queue, intptr_t *value, libcthreads_error_t **error);

int
libcthreads_queue_push( libcthreads_queue_t *queue, intptr_t *value, libcthreads_error_t **error);

int
libcthreads_queue_push_sorted( libcthreads_queue_t *queue, intptr_t *value, int (*value_compare_function)( intptr_t *first_value, intptr_t *second_value, libcthreads_error_t **error ), uint8_t sort_flags, libcthreads_error_t **error);

Thread pool functions


int
libcthreads_thread_pool_create( libcthreads_thread_pool_t **thread_pool, const libcthreads_thread_attributes_t *thread_attributes, int number_of_threads, int maximum_number_of_values, int (*callback_function)( intptr_t *value, void *arguments ), void *callback_function_arguments, libcthreads_error_t **error);

int
libcthreads_thread_pool_push( libcthreads_thread_pool_t *thread_pool, intptr_t *value, libcthreads_error_t **error);

int
libcthreads_thread_pool_push_sorted( libcthreads_thread_pool_t *thread_pool, intptr_t *value, int (*value_compare_function)( intptr_t *first_value, intptr_t *second_value, libcthreads_error_t **error ), uint8_t sort_flags, libcthreads_error_t **error);

int
libcthreads_thread_pool_join( libcthreads_thread_pool_t **thread_pool, libcthreads_error_t **error);

DESCRIPTION

The () function is used to retrieve the library version.

RETURN VALUES

Most of the functions return NULL or -1 on error, dependent on the return type. For the actual return values see <libcthreads.h>.

ENVIRONMENT

None

FILES

None

SEE ALSO

<libcthreads.h>

AUTHORS

Joachim Metz <joachim.metz@gmail.com>

BUGS

Please report bugs of any kind on the project issue tracker: https://github.com/libyal/libcthreads/issues

COPYRIGHT

Copyright (C) 2012-2026, Joachim Metz <joachim.metz@gmail.com>.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

June 10, 2026 Linux 6.4.0-150700.53.73-default