aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/thread.h
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hotmail.com>2002-09-21 03:59:58 +0000
committerRobert Collins <rbtcollins@hotmail.com>2002-09-21 03:59:58 +0000
commit01f58e415cffeee5675b9cdc842df41fa0d12596 (patch)
treee9e61c664629570cc32d5dbc4176e047405dc9fb /winsup/cygwin/thread.h
parentaf428c1ef4e90fafd6d2b98065ce4595bcd8f61b (diff)
downloadnewlib-01f58e415cffeee5675b9cdc842df41fa0d12596.zip
newlib-01f58e415cffeee5675b9cdc842df41fa0d12596.tar.gz
newlib-01f58e415cffeee5675b9cdc842df41fa0d12596.tar.bz2
2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* pthread.cc: Use class::call for converted pthread and semaphore calls. * thread.cc: Convert various __pthread_call and __sem_call to pthread::call and sem::call throughout. * pthread.h (__pthread_cancel): Convert to pthread::cancel. (__pthread_join): Convert to pthread::join. (__pthread_detach): Convert to pthread::detach. (__pthread_create): Convert to pthread::create. (__pthread_once): Convert to pthread::once. (__pthread_atfork): Convert to pthread::atfork. (__pthread_suspend): Convert to pthread::suspend. (__pthread_continue): Convert to pthread::resume. (__sem_init): Convert to semaphore::init. (__sem_destroy): Convert to semaphore::destroy. (__sem_wait): Convert to semaphore::wait. (__sem_trywait): Convert to semaphore::trywait. (__sem_post): Convert to semaphore::post.
Diffstat (limited to 'winsup/cygwin/thread.h')
-rw-r--r--winsup/cygwin/thread.h48
1 files changed, 19 insertions, 29 deletions
diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h
index 3585b0f..c364660 100644
--- a/winsup/cygwin/thread.h
+++ b/winsup/cygwin/thread.h
@@ -336,9 +336,21 @@ public:
static void atforkparent();
static void atforkchild();
+ /* API calls */
+ static int cancel (pthread_t);
+ static int join (pthread_t * thread, void **return_val);
+ static int detach (pthread_t * thread);
+ static int create (pthread_t * thread, const pthread_attr_t * attr,
+ void *(*start_routine) (void *), void *arg);
+ static int once (pthread_once_t *, void (*)(void));
+ static int atfork(void (*)(void), void (*)(void), void (*)(void));
+ static int suspend (pthread_t * thread);
+ static int resume (pthread_t * thread);
+
virtual void exit (void *value_ptr);
virtual int cancel ();
+
virtual void testcancel ();
static void static_cancel_self ();
@@ -358,9 +370,6 @@ private:
__pthread_cleanup_handler *cleanup_stack;
pthread_mutex mutex;
- friend int __pthread_join (pthread_t * thread, void **return_val);
- friend int __pthread_detach (pthread_t * thread);
-
void pop_all_cleanup_handlers (void);
void precreate (pthread_attr *);
void postcreate ();
@@ -439,6 +448,13 @@ class semaphore:public verifyable_object
{
public:
static bool isGoodObject(sem_t const *);
+ /* API calls */
+ static int init (sem_t * sem, int pshared, unsigned int value);
+ static int destroy (sem_t * sem);
+ static int wait (sem_t * sem);
+ static int trywait (sem_t * sem);
+ static int post (sem_t * sem);
+
HANDLE win32_obj_id;
class semaphore * next;
int shared;
@@ -496,21 +512,8 @@ public:
}
};
-/* Cancellation */
-int __pthread_cancel (pthread_t thread);
-
-/* Thread Exit */
-int __pthread_join (pthread_t * thread, void **return_val);
-int __pthread_detach (pthread_t * thread);
-
extern "C"
{
-/* ThreadCreation */
-int __pthread_create (pthread_t * thread, const pthread_attr_t * attr,
- void *(*start_routine) (void *), void *arg);
-int __pthread_once (pthread_once_t *, void (*)(void));
-int __pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
-
int __pthread_attr_init (pthread_attr_t * attr);
int __pthread_attr_destroy (pthread_attr_t * attr);
int __pthread_attr_setdetachstate (pthread_attr_t *, int);
@@ -531,10 +534,6 @@ int __pthread_attr_setschedpolicy (pthread_attr_t *, int);
int __pthread_attr_setscope (pthread_attr_t *, int);
int __pthread_attr_setstackaddr (pthread_attr_t *, void *);
-/* Thread suspend */
-int __pthread_suspend (pthread_t * thread);
-int __pthread_continue (pthread_t * thread);
-
/* Thread SpecificData */
int __pthread_key_create (pthread_key_t * key, void (*destructor) (void *));
int __pthread_key_delete (pthread_key_t key);
@@ -593,16 +592,7 @@ int __pthread_getschedparam (pthread_t thread, int *policy,
int __pthread_setschedparam (pthread_t thread, int policy,
const struct sched_param *param);
-/* cancelability states */
-
-/* Semaphores */
-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);
};
-
#endif // MT_SAFE
#endif // _CYGNUS_THREADS_