NAME
cthread_init - Startup Cthreads
LIBRARY
C Threads Library (libcthreads.a)
SYNOPSIS
#include <cthread.h>
int cthread_init( int procs, void (*func)());
PARAMETERS
procs The number of processors to use.
func The function to use as the initial thread.
DESCRIPTION
cthread_init() starts up and initializes the cthread pack-
age. On multiprocessor targets, it allocates <procs> pro-
cessors. On the SPARC, it creates <procs> processes to
simulate multiple processors. (Note that the procs parame-
ter can be overridden by a "-num_procs" argument if
cthread_parse_args() is used.) A quantity of shared memory
and free threads are allocated on a per processor basis as
specified with cthread_configure() and cthread_parse_args().
The function func is started on logical processor 0 as the
initial thread. Note that there is no way of specifying an
argument to func.
In normal operation, cthread_init() never returns. The
cthread library will cause the termination of the program
when the initial thread exits. (The barrier() function may
be useful in controlling program termination.)
See cthread_parse_args() for information on controlling
cthreads initialization and enabling application level
debugging printouts.
DIAGNOSTICS
cthread_init() returns T_ALREADY_INIT if it is called more
than once.
If more processors are requested than are available,
cthread_init() will fail with an error.
Various other kinds of failures due to insufficient
resources may occur in the process of initializing cthreads.
All cause the termination of the program along with a
corresponding error message.
SEE ALSO
cthread_intro(3), cthread_parse_args(3),
cthread_configure(3), barrier(3)
AUTHOR
Cthreads was written and maintained by many people.
This man page written by Greg Eisenhauer.