From 40cf527fe65e12a745ca7b981676da1fb691eee6 Mon Sep 17 00:00:00 2001 From: rpj Date: Sun, 19 Jul 1998 16:48:18 +0000 Subject: Mon Jul 20 02:31:05 1998 Ross Johnson * private.c (_pthread_getthreadindex): Implement. * pthread.h: Add application static data dependent on _PTHREADS_BUILD_DLL define. This is needed to avoid allocating non-sharable static data within the pthread DLL. * implement.h: Add _pthread_cleanup_stack_t, _pthread_cleanup_node_t and _PTHREAD_HASH_INDEX. * exit.c (pthread_exit): Begin work on cleanup and de-allocate thread-private storage. * create.c (pthread_create): Add thread to thread table. Keep a thread-private copy of the attributes with default values filled in when necessary. Same for the cleanup stack. Make pthread_create C run-time library friendly by using _beginthreadex() instead of CreateThread(). Fix error returns. Sun Jul 19 16:26:23 1998 Ross Johnson * implement.h: Rename pthreads_thread_count to _pthread_threads_count. Create _pthread_threads_thread_t struct to keep thread specific data. * create.c: Rename pthreads_thread_count to _pthread_threads_count. (pthread_create): Handle errors from CreateThread(). --- pthread.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'pthread.h') diff --git a/pthread.h b/pthread.h index 8137f53..abce374 100644 --- a/pthread.h +++ b/pthread.h @@ -163,4 +163,31 @@ int pthread_key_delete(pthread_key_t key); } #endif /* __cplusplus */ +/* Below here goes all internal definitions required by this implementation + of pthreads for Win32. + */ + +/* An element in the thread table. */ +typedef struct _pthread_threads_thread _pthread_threads_thread_t; +struct _pthread_threads_thread { + pthread_t thread; + _pthread_attr_t *attr; +}; + +/* _PTHREAD_BUILD_DLL must only be defined if we are building the DLL. */ +#ifndef _PTHREADS_BUILD_DLL +/* Static global data that must be static within the application + but not the DLL. + */ +pthread_mutex_t _pthread_count_mutex = PTHREAD_MUTEX_INITIALIZER; +DWORD _pthread_threads_count = 0; +_pthread_threads_thread_t _pthread_threads_table[PTHREAD_THREADS_MAX]; +#else +extern pthread_mutex_t _pthread_count_mutex; +extern DWORD _pthread_threads_count; +extern _pthread_threads_thread_t _pthread_threads_table[]; +#endif + +/* End of application static data */ + #endif /* _PTHREADS_H */ -- cgit v1.2.3