mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
semaphore: add a new semaphore_timedwait helper
This is the same as semaphore_wait except it allows for the acquire attempt to time out after a given period of time.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <spinlock.h>
|
||||
#include <time.h>
|
||||
|
||||
#define SEM_TAIL 0
|
||||
#define SEM_HEAD 1
|
||||
@@ -24,6 +25,7 @@ typedef struct semaphore_t{
|
||||
|
||||
|
||||
int semaphore_wait(semaphore_t *sem, bool interruptible);
|
||||
int semaphore_timedwait(semaphore_t *sem, time_t timeoutusec, bool interruptible);
|
||||
void semaphore_signal(semaphore_t *sem);
|
||||
bool semaphore_test(semaphore_t *sem);
|
||||
bool semaphore_haswaiters(semaphore_t *sem);
|
||||
|
||||
Reference in New Issue
Block a user