summaryrefslogtreecommitdiff
path: root/pthread.h
diff options
context:
space:
mode:
authorrpj <rpj>2000-07-25 16:14:23 +0000
committerrpj <rpj>2000-07-25 16:14:23 +0000
commite2fd6e2de322cc12d9153da548ab76379049c11c (patch)
tree0e055e3496bbe45a4003d3e140e09a763d116fda /pthread.h
parentb035ed05977fdef5ced4691028284b7f0ebaba19 (diff)
2000-07-25 Ross Johnson <rpj@special.ise.canberra.edu.au>
* sched.c (sched_get_priority_max): Handle different WinCE and Win32 priority values together. (sched_get_priority_min): Ditto. - Tristan Savatier <tristan@mpegtv.com> * create.c (pthread_create): Force new threads to wait until pthread_create has the new thread's handle; we also retain a local copy of the handle for internal use until pthread_create returns. * private.c (_pthread_threadStart): Initialise ei[]. (_pthread_threadStart): When beginthread is used to start the thread, force waiting until the creator thread had the thread handle. * cancel.c (_pthread_cancel_thread): Include context switch code for defined(_X86_) environments in addition to _M_IX86. * rwlock.c (pthread_rwlock_destroy): Assignment changed to avoid compiler warning. * private.c (_pthread_get_exception_services_code): Cast NULL return value to avoid compiler warning. * cleanup.c (pthread_pop_cleanup): Initialise "cleanup" variable to avoid compiler warnings. * misc.c (_pthread_new): Change "new" variable to "t" to avoid confusion with the C++ keyword of the same name. * condvar.c (cond_wait_cleanup): Initialise lastWaiter variable. (cond_timedwait): Remove unused local variables. to avoid compiler warnings. * dll.c (dllMain): Remove 2000-07-21 change - problem appears to be in pthread_create(). 2000-07-22 Ross Johnson <rpj@special.ise.canberra.edu.au> * tsd.c (pthread_key_create): If a destructor was given and the pthread_mutex_init failed, then would try to reference a NULL pointer (*key); eliminate this section of code by using a dynamically initialised mutex (PTHREAD_MUTEX_INITIALIZER). * tsd.c (pthread_setspecific): Return an error if unable to set the value; simplify cryptic conditional. * tsd.c (pthread_key_delete): Locking threadsLock relied on mutex_lock returning an error if the key has no destructor. ThreadsLock is only initialised if the key has a destructor. Making this mutex a static could reduce the number of mutexes used by an application since it is actually created only at first use and it's often destroyed soon after. 2000-07-22 Ross Johnson <rpj@special.ise.canberra.edu.au> * FAQ: Added Q5 and Q6. tests/ChangeLog: 2000-07-25 Ross Johnson <rpj@special.ise.canberra.edu.au> * runtest.bat: modified to work under W98. * runall.bat: Add new tests; modified to work under W98. It was ok under NT. * Makefile: Add new tests. * exception1.c: New; Test passing exceptions back to the application and retaining library internal exceptions. * join0.c: New; Test a single join.
Diffstat (limited to 'pthread.h')
-rw-r--r--pthread.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/pthread.h b/pthread.h
index bed1ae3..822152c 100644
--- a/pthread.h
+++ b/pthread.h
@@ -282,8 +282,12 @@ struct timespec {
#ifdef __MINGW32__
#define PT_STDCALL
#else
+#ifdef __cplusplus
+#define PT_STDCALL __cdecl
+#else
#define PT_STDCALL __stdcall
#endif
+#endif
#ifdef __cplusplus
extern "C"
@@ -420,8 +424,12 @@ extern "C"
* simply simulating keys.
*
* PTHREADS_STACK_MIN
- * artibrarily chose 1K. By default, WIN32
- * selects 1Meg stacks.
+ * POSIX specifies 0 which is also the value WIN32
+ * interprets as allowing the system to
+ * set the size to that of the main thread. The
+ * maximum stack size in Win32 is 1Meg. WIN32
+ * allocates more stack as required up to the 1Meg
+ * limit.
*
* PTHREAD_THREADS_MAX
* Not documented by WIN32. Wrote a test program
@@ -431,7 +439,7 @@ extern "C"
*/
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
#define PTHREAD_KEYS_MAX 64
-#define PTHREAD_STACK_MIN 1024
+#define PTHREAD_STACK_MIN 0
#define PTHREAD_THREADS_MAX 2019
@@ -584,7 +592,7 @@ struct _pthread_cleanup_t
#endif /* !_MSC_VER && ! __cplusplus */
};
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && !defined(__cplusplus)
/*
* WIN32 SEH version of cancel cleanup.
*/
@@ -609,7 +617,7 @@ struct _pthread_cleanup_t
} \
}
-#else /* _MSC_VER */
+#else /* _MSC_VER && ! __cplusplus */
#ifndef __cplusplus
@@ -703,9 +711,9 @@ struct _pthread_cleanup_t
cleanup.execute( _execute ); \
}
-#endif /* !__cplusplus */
+#endif /* !__cplusplus) */
-#endif /* _MSC_VER */
+#endif /* _MSC_VER && ! __cplusplus */
/*
* ===============
@@ -958,12 +966,14 @@ int * _errno( void );
rand()
-#ifdef _MSC_VER
+/* FIXME: This is only required if the library was built using SEH */
/*
* Get internal SEH tag
*/
DWORD _pthread_get_exception_services_code(void);
+#if defined(_MSC_VER) && !defined(__cplusplus)
+
/*
* Redefine the SEH __except keyword to ensure that applications
* propagate our internal exceptions up to the library's internal handlers.
@@ -972,9 +982,12 @@ DWORD _pthread_get_exception_services_code(void);
__except((GetExceptionCode() == _pthread_get_exception_services_code()) \
? EXCEPTION_CONTINUE_SEARCH : (E))
-#endif
+#endif /* _MSC_VER && ! __cplusplus */
#ifdef __cplusplus
+
+/* FIXME: This is only required if the library was built using C++EH */
+
/*
* Internal exceptions
*/