Blame sysdeps/pthread/semaphore.h

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