Kore 3
Loading...
Searching...
No Matches
semaphore.h
Go to the documentation of this file.
1#ifndef KORE_THREADS_SEMAPHORE_HEADER
2#define KORE_THREADS_SEMAPHORE_HEADER
3
4#include <kore3/global.h>
5
6#include <kore3/backend/semaphore.h>
7
8#include <stdbool.h>
9
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18typedef struct kore_semaphore {
19 kore_semaphore_impl impl;
21
28KORE_FUNC void kore_semaphore_init(kore_semaphore *semaphore, int current, int max);
29
34KORE_FUNC void kore_semaphore_destroy(kore_semaphore *semaphore);
35
41KORE_FUNC void kore_semaphore_release(kore_semaphore *semaphore, int count);
42
47KORE_FUNC void kore_semaphore_acquire(kore_semaphore *semaphore);
48
55KORE_FUNC bool kore_semaphore_try_to_acquire(kore_semaphore *semaphore, double timeout);
56
57#ifdef __cplusplus
58}
59#endif
60
61#endif
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
KORE_FUNC void kore_semaphore_init(kore_semaphore *semaphore, int current, int max)
Initializes a semaphore.
KORE_FUNC void kore_semaphore_release(kore_semaphore *semaphore, int count)
Increases the current count of the semaphore, therefore allowing more acquires to succeed.
KORE_FUNC void kore_semaphore_acquire(kore_semaphore *semaphore)
Decreases the count of the semaphore by one. Blocks until it is possible to decrease the count if it ...
KORE_FUNC bool kore_semaphore_try_to_acquire(kore_semaphore *semaphore, double timeout)
Attempts to decrease the count of the semaphore by one.
KORE_FUNC void kore_semaphore_destroy(kore_semaphore *semaphore)
Destroys a semaphore.
Definition semaphore.h:18