NAME

kjb_pthread_create - Create a new additional thread

SYNOPSIS

#include "l_mt/l_mt_pthread.h"

Example compile flags (system dependent):
  -DLINUX_X86_64 -DLINUX_X86_64_OPTERON  -DGNU_COMPILER 
   -I/home/kobus/include
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 


int kjb_pthread_create
(
	kjb_pthread_t *newthread,
	const kjb_pthread_attr_t *attr,
	void *(*start_routine)(void *),
	void *arg
);

PARAMETERS

kjb_pthread_t *newthread
(for output) thread ID created
const kjb_pthread_attr_t *attr
optional attributes for new thread
void *(*start_routine)(void *)
function the new thread will run
void *arg
optional argument to start routine

DESCRIPTION

This creates a new thread of control, sharing code and static data with the original thread. The 'newthread' parameter is a pointer used to pass back the thread identifier structure created by this function, if it is successful. Please treat that structure as opaque: please do not access the fields. The 'attr' parameter lets you set the thread attributes, but give a NULL argument to use the default attributes. The 'start_routine' parameter is a function pointer that you must provide which points to the function for the thread to execute. The 'arg' parameter serves as the argument passed to the *start_routine. To learn more, see the man page for pthread_create(3), which this wraps. Remember that many parts of the library use static data and thus are not thread-safe. Be sure to serialize library-based IO and memory allocation, or anything that uses IO or memory allocation. LOCK STATUS: yes, this locks/unlocks the thread_master_lock.

RETURNS

This returns NO_ERROR if successful, otherwise it sets an error message and returns ERROR. There are a large number of unlikely ways the function can fail, some of them disastrous. So, it would be wise to check the result code.

DISCLAIMER

This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.

AUTHOR

Andrew Predoehl

DOCUMENTER

Andrew Predoehl

SEE ALSO

kjb_pthread_mutex_lock , kjb_pthread_mutex_trylock , kjb_pthread_mutex_unlock , kjb_pthread_equal , get_kjb_pthread_self , kjb_pthread_exit , kjb_pthread_join , kjb_pthread_cancel , kjb_pthread_mutex_init , kjb_pthread_mutex_destroy , kjb_multithread_wrapper_serialization_lock , kjb_multithread_wrapper_serialization_unlock , kjb_pthread_key_create , kjb_pthread_key_delete , kjb_pthread_setspecific , kjb_pthread_getspecific , kjb_pthread_once , kjb_pthread_read_prng_seeds , kjb_pthread_attr_init , kjb_pthread_attr_destroy , kjb_pthread_attr_setdetachstate , kjb_pthread_attr_getdetachstate , get_kjb_pthread_number , reset_kjb_pthread_counter