summaryrefslogtreecommitdiff
path: root/implement.h
diff options
context:
space:
mode:
authorrpj <rpj>2000-08-18 08:02:29 +0000
committerrpj <rpj>2000-08-18 08:02:29 +0000
commit11eb4dfd2d42417327fc205c649ea32ee623cf92 (patch)
tree79b7a28890e779a4cc8d77e9289dba919d371bdd /implement.h
parent88de1621e4371cd118e1a98c9c08ff23c46e6899 (diff)
2000-08-18 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
* Several: Fix typos from scripted edit session yesterday. * nonportable.c (pthread_mutexattr_setforcecs_np): Moved this function from mutex.c. (pthread_getw32threadhandle_np): New function to return the win32 thread handle that the POSIX thread is using. * mutex.c (pthread_mutexattr_setforcecs_np): Moved to new file "nonportable.c". * pthread.h (PTW32_BUILD): Only redefine __except and catch compiler keywords if we aren't building the library (ie. PTW32_BUILD is not defined) - this is safer than defining and then undefining if not building the library. * implement.h: Remove __except and catch undefines. * Makefile (CFLAGS): Define PTW32_BUILD. * GNUmakefile (CFLAGS): Define PTW32_BUILD. * All appropriate: Change Pthread_exception* to ptw32_exception* to be consistent with internal identifier naming. * private.c (ptw32_throw): New function to provide a generic exception throw for all internal exceptions and EH schemes. (ptw32_threadStart): pthread_exit() value is now returned via the thread structure exitStatus element. * exit.c (pthread_exit): pthread_exit() value is now returned via the thread structure exitStatus element. * cancel.c (ptw32_cancel_self): Now uses ptw32_throw. (pthread_setcancelstate): Ditto. (pthread_setcanceltype): Ditto. (pthread_testcancel): Ditto. (pthread_cancel): Ditto. * misc.c (CancelableWait): Ditto. * exit.c (pthread_exit): Ditto. * All applicable: Change PTW32_ prefix to PTW32_ prefix to remove leading underscores from private library identifiers.
Diffstat (limited to 'implement.h')
-rw-r--r--implement.h50
1 files changed, 15 insertions, 35 deletions
diff --git a/implement.h b/implement.h
index 6cfcc75..4172618 100644
--- a/implement.h
+++ b/implement.h
@@ -96,7 +96,7 @@ struct pthread_t_ {
/*
* Special value to mark attribute objects as valid.
*/
-#define _PTHREAD_ATTR_VALID ((unsigned long) 0xC4C0FFEE)
+#define PTW32_ATTR_VALID ((unsigned long) 0xC4C0FFEE)
struct pthread_attr_t_ {
unsigned long valid;
@@ -118,8 +118,8 @@ struct pthread_attr_t_ {
* ====================
*/
-#define _PTHREAD_OBJECT_AUTO_INIT ((void *) -1)
-#define _PTHREAD_OBJECT_INVALID NULL
+#define PTW32_OBJECT_AUTO_INIT ((void *) -1)
+#define PTW32_OBJECT_INVALID NULL
struct pthread_mutex_t_ {
HANDLE mutex;
@@ -282,51 +282,29 @@ struct ThreadKeyAssoc {
* We store our actual component and error code within
* the optional information array.
*/
-#define EXCEPTION_PTHREAD_SERVICES \
+#define EXCEPTION_PTW32_SERVICES \
MAKE_SOFTWARE_EXCEPTION( SE_ERROR, \
- _PTHREAD_SERVICES_FACILITY, \
- _PTHREAD_SERVICES_ERROR )
+ PTW32_SERVICES_FACILITY, \
+ PTW32_SERVICES_ERROR )
-#define _PTHREAD_SERVICES_FACILITY 0xBAD
-#define _PTHREAD_SERVICES_ERROR 0xDEED
+#define PTW32_SERVICES_FACILITY 0xBAD
+#define PTW32_SERVICES_ERROR 0xDEED
/*
- * Services available through EXCEPTION_PTHREAD_SERVICES
+ * Services available through EXCEPTION_PTW32_SERVICES
*/
-#define _PTHREAD_EPS_CANCEL 0
-#define _PTHREAD_EPS_EXIT 1
-
-/*
- * '__except' was redefined in pthread.h. We use the real one internally.
- */
-#ifdef __except
-#undef __except
-#endif
-
-#else
-
-#ifdef __cplusplus
-/*
- * 'catch' was redefined in pthread.h. We use the real one internally.
- */
-#ifdef catch
-#undef catch
-#endif
-
-#else /* __cplusplus */
-
-#warning File __FILE__, Line __LINE__: Cancellation not supported if library compiled as C.
-
-#endif /* __cplusplus */
+#define PTW32_EPS_CANCEL 0
+#define PTW32_EPS_EXIT 1
#endif /* _MSC_VER */
+
/* Function pointer to TryEnterCriticalSection if it exists; otherwise NULL */
extern BOOL (WINAPI *ptw32_try_enter_critical_section)(LPCRITICAL_SECTION);
/* Declared in global.c */
extern int ptw32_processInitialized;
-extern pthread_key_t ptw32_elfThreadKey;
+extern pthread_key_t ptw32_selfThreadKey;
extern pthread_key_t ptw32_cleanupKey;
extern CRITICAL_SECTION ptw32_mutex_test_init_lock;
extern CRITICAL_SECTION ptw32_cond_test_init_lock;
@@ -338,6 +316,8 @@ extern CRITICAL_SECTION ptw32_rwlock_test_init_lock;
void *ptw32_calloc(size_t n, size_t s);
#endif
+/* Declared in private.c */
+void ptw32_throw(DWORD exception);
#ifdef __cplusplus
extern "C" {