2021-02-11 21:55:35 +03:30
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-11 21:55:35 +03:30
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-04-14 22:45:21 +02:00
|
|
|
#include <limits.h>
|
2021-04-14 04:29:39 +02:00
|
|
|
#include <pthread.h>
|
2021-02-11 21:55:35 +03:30
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
2021-04-14 04:29:39 +02:00
|
|
|
typedef struct {
|
2021-07-05 15:10:34 +03:00
|
|
|
uint32_t value;
|
2021-04-14 04:29:39 +02:00
|
|
|
} sem_t;
|
2021-02-11 21:55:35 +03:30
|
|
|
|
|
|
|
|
int sem_close(sem_t*);
|
|
|
|
|
int sem_destroy(sem_t*);
|
|
|
|
|
int sem_getvalue(sem_t*, int*);
|
|
|
|
|
int sem_init(sem_t*, int, unsigned int);
|
|
|
|
|
sem_t* sem_open(const char*, int, ...);
|
|
|
|
|
int sem_post(sem_t*);
|
|
|
|
|
int sem_trywait(sem_t*);
|
|
|
|
|
int sem_unlink(const char*);
|
|
|
|
|
int sem_wait(sem_t*);
|
2021-07-05 15:10:34 +03:00
|
|
|
int sem_timedwait(sem_t*, const struct timespec* abstime);
|
2021-02-11 21:55:35 +03:30
|
|
|
|
2021-04-14 22:45:21 +02:00
|
|
|
#define SEM_VALUE_MAX INT_MAX
|
|
|
|
|
|
2021-02-11 21:55:35 +03:30
|
|
|
__END_DECLS
|