int sem_init(sem_t *sem, int pshared, unsigned int value);
int sem_destroy(sem_t *sem);
int sem_wait(sem_t *sem);
int sem_trywait(sem_t *sem);
int sem_post(sem_t *sem);
int sem_getvalue(sem_t *sem, int *sval);
int pthread_mutexattr_init( pthread_mutexattr_t *attr);
int pthread_mutexattr_destroy( pthread_mutexattr_t *attr);
int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *mutex_attr);
int pthread_mutex_destroy(pthread_mutex_t *mutex);
int pthread_mutex_lock(pthread_mutex_t *mutex);
int pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_mutex_timedlock(pthread_mutex_t *mutex,
const struct timespec *abstime);
int pthread_mutex_unlock(pthread_mutex_t *mutex);
int pthread_condattr_init(pthread_condattr_t *attr);
int pthread_condattr_destroy(pthread_condattr_t *attr);
int pthread_cond_init(pthread_cond_t *cond,
const pthread_condattr_t *attr);
int pthread_cond_destroy(pthread_cond_t *cond);
int pthread_cond_signal(pthread_cond_t *cond);
int pthread_cond_broadcast(pthread_cond_t *cond);
int pthread_cond_wait(pthread_cond_t *cond,
pthread_mutex_t *mutex);
int pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
const struct timespec *abstime);
sem_t *sem_open(const char *name, int oflag, ...); // TBA
int sem_close(sem_t *sem); // TBA
int sem_unlink(const char *name); // TBA
int pthread_mutexattr_getpshared( const pthread_mutexattr_t *attr,
int *pshared );
int pthread_mutexattr_setpshared( const pthread_mutexattr_t *attr,
int pshared );
int pthread_condattr_getpshared( const pthread_condattr_t *attr,
int *pshared);
int pthread_condattr_setpshared( const pthread_condattr_t *attr,
int pshared);
The presence of semaphores is controlled by the
CYGPKG_POSIX_SEMAPHORES option. This in turn
causes the _POSIX_SEMAPHORES feature test
macro to be defined and the semaphore API to be made
available.
The pshared argument to
sem_init() is not implemented,
its value is ignored.
Functions sem_open(),
sem_close() and
sem_unlink() are present but
always return an error (ENOSYS).
The exact priority inversion protocols supported may be
controlled with the
_POSIX_THREAD_PRIO_INHERIT and
_POSIX_THREAD_PRIO_PROTECT
configuration options.
{_POSIX_THREAD_PROCESS_SHARED} is
not defined, so the
process-shared mutex
and condition variable attributes are not supported, and
neither are the functions
pthread_mutexattr_getpshared(),
pthread_mutexattr_setpshared(),
pthread_condattr_getpshared() and
pthread_condattr_setpshared().
Condition variables do not become bound to a particular
mutex when
pthread_cond_wait() is
called. Hence different threads may wait on a condition
variable with different mutexes. This is at variance with
the standard, which requires a condition variable to
become (dynamically) bound by the first waiter, and
unbound when the last finishes. However, this difference
is largely benign, and the cost of policing this feature
is non-trivial.