Skip to content

Commit

Permalink
libgcc: gthr-posix.h: declare some pthread function prototypes
Browse files Browse the repository at this point in the history
Just experimenting... basically using the SDK CI as a compiler because
it's not very obvious how to build the SDK from scratch.

Signed-off-by: Chris Friedt <[email protected]>
  • Loading branch information
cfriedt committed Dec 4, 2023
1 parent 1e35c83 commit 63b345a
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions libgcc/gthr-posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,63 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# endif
#endif

#define PTHREAD_MUTEX_INITIALIZER (-1)
#define PTHREAD_MUTEX_NORMAL 0
#define PTHREAD_MUTEX_RECURSIVE 1
#define PTHREAD_MUTEX_ERRORCHECK 2
#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL

#define PTHREAD_COND_INITIALIZER (-1)

#define PTHREAD_ONCE_INIT {1,0}

/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cancel.html */
int pthread_cancel(pthread_t thread);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_broadcast.html */
int pthread_cond_broadcast(pthread_cond_t *cond);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_destroy.html */
int pthread_cond_destroy(pthread_cond_t *cond);
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *__restrict attr);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_broadcast.html */
int pthread_cond_signal(pthread_cond_t *cond);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_timedwait.html */
int pthread_cond_timedwait(pthread_cond_t *__restrict cond, pthread_mutex_t *__restrict mutex, const struct timespec *__restrict abstime);
int pthread_cond_wait(pthread_cond_t *__restrict cond, pthread_mutex_t *__restrict mutex);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_create.html */
int pthread_create(pthread_t *__restrict thread, const pthread_attr_t *__restrict attr, void *(*start_routine)(void*), void *__restrict arg);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_detach.html */
int pthread_detach(pthread_t thread);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_equal.html */
int pthread_equal(pthread_t t1, pthread_t t2);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_getspecific.html */
void *pthread_getspecific(pthread_key_t key);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_join.html */
int pthread_join(pthread_t thread, void **value_ptr);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_key_create.html */
int pthread_key_create(pthread_key_t *key, void (*destructor)(void*));
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_key_delete.html */
int pthread_key_delete(pthread_key_t key);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_destroy.html */
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
int pthread_mutexattr_init(pthread_mutexattr_t *attr);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_gettype.html */
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_destroy.html */
int pthread_mutex_destroy(pthread_mutex_t *mutex);
int pthread_mutex_init(pthread_mutex_t *__restrict mutex, const pthread_mutexattr_t *__restrict attr);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html */
int pthread_mutex_lock(pthread_mutex_t *mutex);
int pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_mutex_unlock(pthread_mutex_t *mutex);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_once.html */
int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
/* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html */
pthread_t pthread_self(void);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_getspecific.html */
int pthread_setspecific(pthread_key_t key, const void *value);
/* https://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html */
int sched_yield(void);

typedef pthread_t __gthread_t;
typedef pthread_key_t __gthread_key_t;
typedef pthread_once_t __gthread_once_t;
Expand Down

0 comments on commit 63b345a

Please sign in to comment.