bar_init(3)		   Library Functions Manual		   bar_init(3)

NAME
     bar_init – initialize thread barrier

SYNOPSIS
     library “threads”
     #include <threadse.h>

     int
     bar_init(bar_t *barrier, int type, unsigned count);

DESCRIPTION
     The function bar_init() initializes a thread barrier of the given type as
     specified below and the amount of threads that need to call bar_wait(3)
     before the barrier will be released count.

     The type argument can be either of

     bar_private
	     the barrier is not shared among child processes.

     bar_shared
	     the barrier is shared among child processes.

RETURN VALUES
     Upon success bar_init() returns thrd_success, otherwise thrd_error will
     be returned.

SEE ALSO
     bar_destroy(3) bar_wait(3)

HISTORY
     The bar_init() function first appeared in the Adelsbach Enhanced
     Threading Library.	 MacOS support was added in version 1.0.1 due to the
     lack of native MacOS support for thread barriers the implementation
     manually implements this using mutexes and condition variables.

AUTHORS
     Jan Adelsbach <jan@jadelsbach.de>

Linux 6.13.6-1-default		March 30, 2025		Linux 6.13.6-1-default