int rand_r ( int * seed)
is reentrant
int rand ( void)
is not reentrant
#include <pthread.h> int pthread_create(pthread_t *restrict thread, const pthread_attr_t *restrict attr, void *(*start_routine)(void *), void *restrict arg); Compile and link with -pthread.
thread
is the id of the thread that is created.
attr
is a hints field we will discuss later.
start_routine
is a function to call
void *
void *
as a parameter.
arg
is a pointer to the argument we are passing.
int pthread_join(pthread_t thread, void **retval);