Table of Contents
qthread_init - initialize the qthread library
#include <qthread/qthread.h>
int
qthread_init(const int nshepherds);
Use this function to initialize
the qthreads environment before spawning any qthreads or using any of the
qthreads locking/FEB functions. The number of shepherd pthreads that will
execute qthreads is specified with nshepherds. If nshepherds is 0, the library
will attempt to guess the correct number of shepherds, defaulting to a
single shepherd if no information about the system could be found. Shepherds
will attempt to pin themselves to processors using whatever CPU affinity
libraries are available.
The operation of qthread_init() is modified
by the following environment variables:
- QTHREAD_AFFINITY
- If this variable
is set to "no", then the shepherds will not pin themselves to specific
locations.
- QTHREAD_DEBUG_LEVEL
- This variable is used to control the verbosity
of debug messages that get printed at runtime. Higher numbers increase the
verbosity; a value of 0 is the same as being unset, which prevents debug
messages from being printed. This is only applicable if debugging has been
enabled when the library was built.
- QTHREAD_STACK_SIZE
- This variable adjusts
the size of the stacks that will be created for each thread. Changes to
this value during the course of the program run are ignored; the value
is only considered when qthread_init() is run.
On success, the
system is ready to fork threads and 0 is returned. On error, an non-zero
error code is returned.
- ENOMEM
- Not enough memory could be allocated.
qthread_finalize(3)
Table of Contents