| 1 |
/**************************************************************************/ |
| 2 |
/* */ |
| 3 |
/* This file is part of Frama-C. */ |
| 4 |
/* */ |
| 5 |
/* Copyright (C) 2007-2022 */ |
| 6 |
/* CEA (Commissariat à l'énergie atomique et aux énergies */ |
| 7 |
/* alternatives) */ |
| 8 |
/* */ |
| 9 |
/* you can redistribute it and/or modify it under the terms of the GNU */ |
| 10 |
/* Lesser General Public License as published by the Free Software */ |
| 11 |
/* Foundation, version 2.1. */ |
| 12 |
/* */ |
| 13 |
/* It is distributed in the hope that it will be useful, */ |
| 14 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 15 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 16 |
/* GNU Lesser General Public License for more details. */ |
| 17 |
/* */ |
| 18 |
/* See the GNU Lesser General Public License version 2.1 */ |
| 19 |
/* for more details (enclosed in the file licenses/LGPLv2.1). */ |
| 20 |
/* */ |
| 21 |
/**************************************************************************/ |
| 22 |
|
| 23 |
// POSIX-compatible minimalist interface for sched.h |
| 24 |
|
| 25 |
#ifndef __FC_SEMAPHORE |
| 26 |
#define __FC_SEMAPHORE |
| 27 |
#include "features.h" |
| 28 |
__PUSH_FC_STDLIB |
| 29 |
#include "time.h" |
| 30 |
|
| 31 |
__BEGIN_DECLS |
| 32 |
|
| 33 |
typedef union __fc_sem_t { |
| 34 |
char __size[16]; |
| 35 |
} sem_t; |
| 36 |
|
| 37 |
#define SEM_FAILED ((sem_t *) 0) |
| 38 |
|
| 39 |
extern int sem_close(sem_t *); |
| 40 |
extern int sem_destroy(sem_t *); |
| 41 |
extern int sem_getvalue(sem_t *restrict, int *restrict); |
| 42 |
extern int sem_init(sem_t *, int, unsigned); |
| 43 |
extern sem_t *sem_open(const char *, int, ...); |
| 44 |
extern int sem_post(sem_t *); |
| 45 |
extern int sem_timedwait(sem_t *restrict, const struct timespec *restrict); |
| 46 |
extern int sem_trywait(sem_t *); |
| 47 |
extern int sem_unlink(const char *); |
| 48 |
extern int sem_wait(sem_t *); |
| 49 |
|
| 50 |
__END_DECLS |
| 51 |
__POP_FC_STDLIB |
| 52 |
#endif |