5cc0027cf7
- pthread_cond_clockwait(2) - pthread_mutex_clocklock(2) - pthread_mutex_timedlock(2) - pthread_rwlock_clockrdlock(2) - pthread_rwlock_clockwrlock(2) - pthread_rwlock_timedrdlock(2) - pthread_rwlock_timedwrlock(2) - sem_clockwait(2)
64 lines
1.7 KiB
C
64 lines
1.7 KiB
C
/*
|
|
* Copyright (c) 2014, 2021 Jonas 'Sortie' Termansen.
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*
|
|
* semaphore.h
|
|
* Semaphore API.
|
|
*/
|
|
|
|
#ifndef _INCLUDE_SEMAPHORE_H
|
|
#define _INCLUDE_SEMAPHORE_H
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <time.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct
|
|
{
|
|
#if defined(__is_sortix_libc)
|
|
int value;
|
|
int waiters;
|
|
#else
|
|
int __value;
|
|
int __waiters;
|
|
#endif
|
|
} sem_t;
|
|
|
|
#define SEM_FAILED ((sem_t*) 0)
|
|
|
|
/*int sem_close(sem_t*);*/
|
|
int sem_destroy(sem_t*);
|
|
int sem_getvalue(sem_t* __restrict, int* __restrict);
|
|
int sem_init(sem_t*, int, unsigned int);
|
|
/*sem_t* sem_open(const char*, int, ...);*/
|
|
int sem_post(sem_t*);
|
|
int sem_timedwait(sem_t* __restrict, const struct timespec* __restrict);
|
|
int sem_trywait(sem_t*);
|
|
/*int sem_unlink(const char*);*/
|
|
int sem_wait(sem_t*);
|
|
|
|
#if __USE_SORTIX || 202405L <= __USE_POSIX
|
|
int sem_clockwait(sem_t* __restrict, clockid_t clock,
|
|
const struct timespec* __restrict);
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#endif
|