MyOS Libc
pthread.h File Reference
#include <sys/types.h>

Go to the source code of this file.

Typedefs

typedef pid_t pthread_t
 Represents a thread.
 
typedef int pthread_attr_t
 Created as dummy.
 

Functions

int pthread_create (pthread_t *restrict thread, const pthread_attr_t *restrict attr, void *(*start_routine)(void *), void *restrict arg)
 
void pthread_exit (void *value_ptr)
 

Function Documentation

◆ pthread_create()

int pthread_create ( pthread_t *restrict  thread,
const pthread_attr_t *restrict  attr,
void *(*)(void *)  start_routine,
void *restrict  arg 
)

Create a thread in the current process

Parameters
threadA pointer to a pthread_t where the created thread will be placed
attrEither a pointer to a thread attribute structure, or NULL, in which case the default attributes will be used
start_routineThe start function of the thread
argAn arhument to the start function
Returns
0 if creation was sucsessful, 1 otherwise

◆ pthread_exit()

void pthread_exit ( void *  value_ptr)

Terminate the current thread

Parameters
value_ptrA pointer that when other threads in the process join on the current thread, they will recieve. (not implemented)