|
Packit Service |
82fcde |
/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License as published by the Free Software Foundation; either
|
|
Packit Service |
82fcde |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; if not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifndef _SEMAPHORE_H
|
|
Packit Service |
82fcde |
#define _SEMAPHORE_H 1
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <features.h>
|
|
Packit Service |
82fcde |
#include <sys/types.h>
|
|
Packit Service |
82fcde |
#ifdef __USE_XOPEN2K
|
|
Packit Service |
82fcde |
# include <bits/types/struct_timespec.h>
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Get the definition for sem_t. */
|
|
Packit Service |
82fcde |
#include <bits/semaphore.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
__BEGIN_DECLS
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Initialize semaphore object SEM to VALUE. If PSHARED then share it
|
|
Packit Service |
82fcde |
with other processes. */
|
|
Packit Service |
82fcde |
extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value)
|
|
Packit Service |
82fcde |
__THROW;
|
|
Packit Service |
82fcde |
/* Free resources associated with semaphore object SEM. */
|
|
Packit Service |
82fcde |
extern int sem_destroy (sem_t *__sem) __THROW;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Open a named semaphore NAME with open flags OFLAG. */
|
|
Packit Service |
82fcde |
extern sem_t *sem_open (const char *__name, int __oflag, ...) __THROW;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Close descriptor for named semaphore SEM. */
|
|
Packit Service |
82fcde |
extern int sem_close (sem_t *__sem) __THROW;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Remove named semaphore NAME. */
|
|
Packit Service |
82fcde |
extern int sem_unlink (const char *__name) __THROW;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Wait for SEM being posted.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
This function is a cancellation point and therefore not marked with
|
|
Packit Service |
82fcde |
__THROW. */
|
|
Packit Service |
82fcde |
extern int sem_wait (sem_t *__sem);
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#ifdef __USE_XOPEN2K
|
|
Packit Service |
82fcde |
/* Similar to `sem_wait' but wait only until ABSTIME.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
This function is a cancellation point and therefore not marked with
|
|
Packit Service |
82fcde |
__THROW. */
|
|
Packit Service |
82fcde |
extern int sem_timedwait (sem_t *__restrict __sem,
|
|
Packit Service |
82fcde |
const struct timespec *__restrict __abstime);
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Test whether SEM is posted. */
|
|
Packit Service |
82fcde |
extern int sem_trywait (sem_t *__sem) __THROWNL;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Post SEM. */
|
|
Packit Service |
82fcde |
extern int sem_post (sem_t *__sem) __THROWNL;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Get current value of SEM and store it in *SVAL. */
|
|
Packit Service |
82fcde |
extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
|
|
Packit Service |
82fcde |
__THROW;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
__END_DECLS
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#endif /* semaphore.h */
|