toaruos/base/usr/include/pthread.h

54 lines
1.6 KiB
C
Raw Normal View History

2018-02-25 11:14:43 +03:00
#pragma once
2018-10-12 05:15:40 +03:00
#include <_cheader.h>
2018-02-25 11:14:43 +03:00
#include <stdint.h>
2018-10-12 05:15:40 +03:00
_Begin_C_Header
2018-02-25 11:14:43 +03:00
typedef struct {
uint32_t id;
char * stack;
void * ret_val;
} pthread_t;
typedef unsigned int pthread_attr_t;
typedef struct {
int volatile atomic_lock;
int volatile readers;
int writerPid;
} pthread_rwlock_t;
2018-03-01 17:15:37 +03:00
extern int pthread_create(pthread_t * thread, pthread_attr_t * attr, void *(*start_routine)(void *), void * arg);
extern void pthread_exit(void * value);
extern int pthread_kill(pthread_t thread, int sig);
2018-02-25 11:14:43 +03:00
2018-03-01 17:15:37 +03:00
extern int clone(uintptr_t,uintptr_t,void*);
extern int gettid();
2018-02-25 11:14:43 +03:00
2018-12-19 08:38:08 +03:00
extern void pthread_cleanup_push(void (*routine)(void *), void *arg);
extern void pthread_cleanup_pop(int execute);
typedef int volatile pthread_mutex_t;
typedef int pthread_mutexattr_t;
extern int pthread_join(pthread_t thread, void **retval);
#define PTHREAD_MUTEX_INITIALIZER 0
extern int pthread_mutex_lock(pthread_mutex_t *mutex);
extern int pthread_mutex_trylock(pthread_mutex_t *mutex);
extern int pthread_mutex_unlock(pthread_mutex_t *mutex);
extern int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
extern int pthread_mutex_destroy(pthread_mutex_t *mutex);
extern int pthread_attr_init(pthread_attr_t *attr);
extern int pthread_attr_destroy(pthread_attr_t *attr);
extern int pthread_rwlock_init(pthread_rwlock_t * lock, void * args);
extern int pthread_rwlock_wrlock(pthread_rwlock_t * lock);
extern int pthread_rwlock_rdlock(pthread_rwlock_t * lock);
extern int pthread_rwlock_unlock(pthread_rwlock_t * lock);
extern int pthread_rwlock_destroy(pthread_rwlock_t * lock);
2018-12-19 08:38:08 +03:00
2018-10-12 05:15:40 +03:00
_End_C_Header