barrier_init(3synch) barrier_init(3synch)
NAME
barrier_init - initialize a blocking barrier
SYNOPSIS
cc [options] -Kthread file
#include <synch.h>
int barrier_init(barrier_t *barrier, int count, int type, void *arg);
Parameters
barrier
pointer to barrier to be initialized
count number of threads to use the barrier for
synchronization
type USYNC_THREAD or USYNC_PROCESS
arg NULL (reserved for future use)
DESCRIPTION
barrier_init initializes the blocking barrier pointed to by
barrier to be of type type and to synchronize count threads.
Once initialized, the barrier can be used any number of times
to synchronize execution of count threads.
Threads waiting at a blocking barrier will block, or sleep,
until all count threads arrive at the barrier.
barrier Parameter
barrier points to the blocking barrier to be initialized.
count Parameter
count is the number of threads that will be synchronized by
the barrier. That is, barrier_wait will block any calling
threads until count threads have reached the barrier.
type Parameter
type can be set to one of the following values:
USYNC_THREAD Initialize the barrier for threads within the
current process.
USYNC_PROCESS Initialize the barrier for threads across
processes.
Copyright 1994 Novell, Inc. Page 1
barrier_init(3synch) barrier_init(3synch)
arg Parameter
arg should be set to NULL. It is not currently used, but is
reserved for future use.
Return Values
barrier_init returns zero for success and an error number for
failure, as described below.
Errors
If one of the following conditions is detected, barrier_init
returns the corresponding value:
EINVAL Invalid argument specified.
USAGE
Warnings
A barrier should not be re-initialized while threads are
waiting at the barrier.
REFERENCES
barrier(3synch), barrier_destroy(3synch),
barrier_wait(3synch), synch(3synch)
Copyright 1994 Novell, Inc. Page 2