Kore
Loading...
Searching...
No Matches
semaphore.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
5#include <kinc/backend/semaphore.h>
6
7#include <stdbool.h>
8
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17typedef struct kinc_semaphore {
18 kinc_semaphore_impl_t impl;
19} kinc_semaphore_t;
20
27KINC_FUNC void kinc_semaphore_init(kinc_semaphore_t *semaphore, int current, int max);
28
33KINC_FUNC void kinc_semaphore_destroy(kinc_semaphore_t *semaphore);
34
40KINC_FUNC void kinc_semaphore_release(kinc_semaphore_t *semaphore, int count);
41
46KINC_FUNC void kinc_semaphore_acquire(kinc_semaphore_t *semaphore);
47
54KINC_FUNC bool kinc_semaphore_try_to_acquire(kinc_semaphore_t *semaphore, double timeout);
55
56#ifdef __cplusplus
57}
58#endif
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
KINC_FUNC void kinc_semaphore_release(kinc_semaphore_t *semaphore, int count)
Increases the current count of the semaphore, therefore allowing more acquires to succeed.
KINC_FUNC void kinc_semaphore_acquire(kinc_semaphore_t *semaphore)
Decreases the count of the semaphore by one. Blocks until it is possible to decrease the count if it ...
KINC_FUNC void kinc_semaphore_destroy(kinc_semaphore_t *semaphore)
Destroys a semaphore.
KINC_FUNC void kinc_semaphore_init(kinc_semaphore_t *semaphore, int current, int max)
Initializes a semaphore.
KINC_FUNC bool kinc_semaphore_try_to_acquire(kinc_semaphore_t *semaphore, double timeout)
Attempts to decrease the count of the semaphore by one.
Definition semaphore.h:17