2000-02-17 20:38:33 +01:00
|
|
|
/* pthread.cc: posix pthread interface for Cygwin
|
|
|
|
|
2003-01-10 13:32:49 +01:00
|
|
|
Copyright 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-03-18 22:11:25 +01:00
|
|
|
Originally written by Marco Fuykschot <marco@ddi.nl>
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
#include "winsup.h"
|
2000-08-22 07:10:20 +02:00
|
|
|
#include "thread.h"
|
2002-09-16 12:53:29 +02:00
|
|
|
#include "errno.h"
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-03-21 03:17:58 +01:00
|
|
|
extern "C"
|
2000-02-17 20:38:33 +01:00
|
|
|
{
|
2001-03-21 03:17:58 +01:00
|
|
|
/* ThreadCreation */
|
2001-04-09 02:44:25 +02:00
|
|
|
int
|
2001-04-12 06:04:53 +02:00
|
|
|
pthread_create (pthread_t * thread, const pthread_attr_t * attr,
|
|
|
|
void *(*start_routine) (void *), void *arg)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return pthread::create (thread, attr, start_routine, arg);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
|
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return pthread::once (once_control, init_routine);
|
2001-04-12 06:04:53 +02:00
|
|
|
}
|
|
|
|
|
2001-04-13 17:28:20 +02:00
|
|
|
int
|
2002-09-22 05:38:57 +02:00
|
|
|
pthread_atfork (void (*prepare)(void), void (*parent)(void), void (*child)(void))
|
2001-04-13 17:28:20 +02:00
|
|
|
{
|
2002-09-22 05:38:57 +02:00
|
|
|
return pthread::atfork (prepare, parent, child);
|
2001-04-13 17:28:20 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_attr_init (pthread_attr_t * attr)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_attr_init (attr);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_attr_destroy (pthread_attr_t * attr)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_attr_destroy (attr);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_attr_setdetachstate (attr, detachstate);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-04-12 06:04:53 +02:00
|
|
|
pthread_attr_getdetachstate (const pthread_attr_t * attr, int *detachstate)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_attr_getdetachstate (attr, detachstate);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_attr_setstacksize (pthread_attr_t * attr, size_t size)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_attr_setstacksize (attr, size);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_attr_getstacksize (const pthread_attr_t * attr, size_t * size)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_attr_getstacksize (attr, size);
|
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_attr_setinheritsched (pthread_attr_t * attr, int inheritsched)
|
|
|
|
{
|
|
|
|
return __pthread_attr_setinheritsched (attr, inheritsched);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_attr_getinheritsched (const pthread_attr_t * attr, int *inheritsched)
|
|
|
|
{
|
|
|
|
return __pthread_attr_getinheritsched (attr, inheritsched);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_attr_setschedparam (pthread_attr_t * attr,
|
|
|
|
const struct sched_param *param)
|
|
|
|
{
|
|
|
|
return __pthread_attr_setschedparam (attr, param);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_attr_getschedparam (const pthread_attr_t * attr,
|
|
|
|
struct sched_param *param)
|
|
|
|
{
|
|
|
|
return __pthread_attr_getschedparam (attr, param);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_attr_setschedpolicy (pthread_attr_t * attr, int policy)
|
|
|
|
{
|
|
|
|
return __pthread_attr_setschedpolicy (attr, policy);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_attr_getschedpolicy (const pthread_attr_t * attr, int *policy)
|
|
|
|
{
|
|
|
|
return __pthread_attr_getschedpolicy (attr, policy);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_attr_setscope (pthread_attr_t * attr, int contentionscope)
|
|
|
|
{
|
|
|
|
return __pthread_attr_setscope (attr, contentionscope);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_attr_getscope (const pthread_attr_t * attr, int *contentionscope)
|
|
|
|
{
|
|
|
|
return __pthread_attr_getscope (attr, contentionscope);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef _POSIX_THREAD_ATTR_STACKADDR
|
|
|
|
int
|
|
|
|
pthread_attr_setstackaddr (pthread_attr_t * attr, void *stackaddr)
|
|
|
|
{
|
|
|
|
return __pthread_attr_setstackaddr (attr, stackaddr);
|
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_attr_getstackaddr (const pthread_attr_t * attr, void **stackaddr)
|
|
|
|
{
|
|
|
|
return __pthread_attr_getstackaddr (attr, stackaddr);
|
|
|
|
}
|
|
|
|
#endif
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/* Thread Exit */
|
2001-04-12 06:04:53 +02:00
|
|
|
void
|
|
|
|
pthread_exit (void *value_ptr)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-22 05:38:57 +02:00
|
|
|
return pthread::self ()->exit (value_ptr);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_join (pthread_t thread, void **return_val)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return pthread::join (&thread, (void **) return_val);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_detach (pthread_t thread)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return pthread::detach (&thread);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
|
|
|
|
/* This isn't a posix call... should we keep it? */
|
|
|
|
int
|
|
|
|
pthread_suspend (pthread_t thread)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return pthread::suspend (&thread);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
/* same */
|
|
|
|
int
|
|
|
|
pthread_continue (pthread_t thread)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return pthread::resume (&thread);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
unsigned long
|
|
|
|
pthread_getsequence_np (pthread_t * thread)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-16 12:53:29 +02:00
|
|
|
if (!pthread::isGoodObject (thread))
|
|
|
|
return EINVAL;
|
2002-09-22 05:38:57 +02:00
|
|
|
return (*thread)->getsequence_np ();
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/* Thread SpecificData */
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_key_create (pthread_key_t * key, void (*destructor) (void *))
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_key_create (key, destructor);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_key_delete (pthread_key_t key)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_key_delete (key);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_setspecific (pthread_key_t key, const void *value)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_setspecific (key, value);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
void *
|
|
|
|
pthread_getspecific (pthread_key_t key)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return (void *) __pthread_getspecific (key);
|
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/* Thread signal */
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_kill (pthread_t thread, int sig)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_kill (thread, sig);
|
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-04-09 02:44:25 +02:00
|
|
|
int
|
2001-04-12 06:04:53 +02:00
|
|
|
pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_sigmask (operation, set, old_set);
|
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/* ID */
|
|
|
|
|
2001-04-09 02:44:25 +02:00
|
|
|
pthread_t pthread_self ()
|
|
|
|
{
|
2002-09-22 05:38:57 +02:00
|
|
|
return pthread::self ();
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_equal (pthread_t t1, pthread_t t2)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_equal (&t1, &t2);
|
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/* Mutexes */
|
2001-04-09 02:44:25 +02:00
|
|
|
int
|
2001-04-12 06:04:53 +02:00
|
|
|
pthread_mutex_init (pthread_mutex_t * mutex, const pthread_mutexattr_t * attr)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-30 01:47:45 +02:00
|
|
|
return pthread_mutex::init (mutex, attr);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_mutex_lock (pthread_mutex_t * mutex)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_mutex_lock (mutex);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_mutex_trylock (pthread_mutex_t * mutex)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_mutex_trylock (mutex);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_mutex_unlock (pthread_mutex_t * mutex)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_mutex_unlock (mutex);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_mutex_destroy (pthread_mutex_t * mutex)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_mutex_destroy (mutex);
|
|
|
|
}
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_mutex_setprioceiling (pthread_mutex_t * mutex,
|
|
|
|
int prioceiling, int *old_ceiling)
|
|
|
|
{
|
|
|
|
return __pthread_mutex_setprioceiling (mutex, prioceiling, old_ceiling);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutex_getprioceiling (const pthread_mutex_t * mutex, int *prioceiling)
|
|
|
|
{
|
|
|
|
return __pthread_mutex_getprioceiling (mutex, prioceiling);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_destroy (pthread_mutexattr_t * attr)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_destroy (attr);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_getprioceiling (const pthread_mutexattr_t * attr,
|
|
|
|
int *prioceiling)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_getprioceiling (attr, prioceiling);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_getprotocol (const pthread_mutexattr_t * attr,
|
|
|
|
int *protocol)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_getprotocol (attr, protocol);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_getpshared (const pthread_mutexattr_t * attr, int *pshared)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_getpshared (attr, pshared);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *type)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_gettype (attr, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_init (pthread_mutexattr_t * attr)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_init (attr);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_setprioceiling (pthread_mutexattr_t * attr, int prioceiling)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_setprioceiling (attr, prioceiling);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_setprotocol (pthread_mutexattr_t * attr, int protocol)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_setprotocol (attr, protocol);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, int pshared)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_setpshared (attr, pshared);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_mutexattr_settype (pthread_mutexattr_t * attr, int type)
|
|
|
|
{
|
|
|
|
return __pthread_mutexattr_settype (attr, type);
|
|
|
|
}
|
|
|
|
|
2001-03-17 02:14:58 +01:00
|
|
|
/* Synchronisation */
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_cond_destroy (pthread_cond_t * cond)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_cond_destroy (cond);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-04-12 06:04:53 +02:00
|
|
|
pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2003-01-09 21:40:44 +01:00
|
|
|
return pthread_cond::init (cond, attr);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_cond_signal (pthread_cond_t * cond)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_cond_signal (cond);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_cond_broadcast (pthread_cond_t * cond)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_cond_broadcast (cond);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_condattr_init (pthread_condattr_t * condattr)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_condattr_init (condattr);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_condattr_destroy (pthread_condattr_t * condattr)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_condattr_destroy (condattr);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-04-12 06:04:53 +02:00
|
|
|
pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_condattr_getpshared (attr, pshared);
|
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
|
|
|
return __pthread_condattr_setpshared (attr, pshared);
|
|
|
|
}
|
2001-03-17 02:14:58 +01:00
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
/* Scheduling */
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_getconcurrency (void)
|
|
|
|
{
|
|
|
|
return __pthread_getconcurrency ();
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_setconcurrency (int new_level)
|
|
|
|
{
|
|
|
|
return __pthread_setconcurrency (new_level);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_getschedparam (pthread_t thread, int *policy,
|
|
|
|
struct sched_param *param)
|
|
|
|
{
|
|
|
|
return __pthread_getschedparam (thread, policy, param);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_setschedparam (pthread_t thread, int policy,
|
|
|
|
const struct sched_param *param)
|
|
|
|
{
|
|
|
|
return __pthread_setschedparam (thread, policy, param);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Cancelability */
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_cancel (pthread_t thread)
|
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return pthread::cancel (thread);
|
2001-04-12 06:04:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_setcancelstate (int state, int *oldstate)
|
|
|
|
{
|
2002-09-22 05:38:57 +02:00
|
|
|
return pthread::self ()->setcancelstate (state, oldstate);
|
2001-04-12 06:04:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
pthread_setcanceltype (int type, int *oldtype)
|
|
|
|
{
|
2002-09-22 05:38:57 +02:00
|
|
|
return pthread::self ()->setcanceltype (type, oldtype);
|
2001-04-12 06:04:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
pthread_testcancel (void)
|
|
|
|
{
|
2002-09-22 05:38:57 +02:00
|
|
|
pthread::self ()->testcancel ();
|
2001-04-12 06:04:53 +02:00
|
|
|
}
|
|
|
|
|
2002-06-10 03:10:45 +02:00
|
|
|
void
|
|
|
|
_pthread_cleanup_push (__pthread_cleanup_handler *handler)
|
|
|
|
{
|
2002-09-22 05:38:57 +02:00
|
|
|
pthread::self ()->push_cleanup_handler (handler);
|
2002-06-10 03:10:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_pthread_cleanup_pop (int execute)
|
|
|
|
{
|
2002-09-22 05:38:57 +02:00
|
|
|
pthread::self ()->pop_cleanup_handler (execute);
|
2002-06-10 03:10:45 +02:00
|
|
|
}
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/* Semaphores */
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
sem_init (sem_t * sem, int pshared, unsigned int value)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return semaphore::init (sem, pshared, value);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
sem_destroy (sem_t * sem)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return semaphore::destroy (sem);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
sem_wait (sem_t * sem)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return semaphore::wait (sem);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
sem_trywait (sem_t * sem)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return semaphore::trywait (sem);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
|
|
|
|
2001-04-12 06:04:53 +02:00
|
|
|
int
|
|
|
|
sem_post (sem_t * sem)
|
2001-04-09 02:44:25 +02:00
|
|
|
{
|
2002-09-21 05:59:58 +02:00
|
|
|
return semaphore::post (sem);
|
2001-04-09 02:44:25 +02:00
|
|
|
}
|
2001-04-12 06:04:53 +02:00
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
}
|