summaryrefslogtreecommitdiff
path: root/implement.h
diff options
context:
space:
mode:
authorrpj <rpj>2001-02-08 16:31:20 +0000
committerrpj <rpj>2001-02-08 16:31:20 +0000
commit2b3eede0b834a82c7dce5ec328f3929c0effc536 (patch)
tree24414750f16e0c7bc7d231139d7f20a76b512ae4 /implement.h
parent3c0fbfafe563b7b312d60c42c0d58a3a1f4d5930 (diff)
Fixes to new mutex routines and various tests.exp-2001-02-09-passed
Diffstat (limited to 'implement.h')
-rw-r--r--implement.h39
1 files changed, 32 insertions, 7 deletions
diff --git a/implement.h b/implement.h
index 353f4f9..165708a 100644
--- a/implement.h
+++ b/implement.h
@@ -121,19 +121,34 @@ struct pthread_attr_t_ {
#define PTW32_OBJECT_AUTO_INIT ((void *) -1)
#define PTW32_OBJECT_INVALID NULL
-struct pthread_mutex_t_ {
- HANDLE mutex;
+/*
+ * Our own critical section type, used
+ * when the system doesn't support TryEnterCriticalSection()
+ */
+typedef struct ptw32_cs_t_ {
+ int valid;
+ pthread_t owner;
+ long lock_idx;
+ long entered_count;
+} ptw32_cs_t;
+
+typedef union ptw32_cs_u_t_ {
CRITICAL_SECTION cs;
- int lockCount;
- pthread_t ownerThread;
-};
-
+ ptw32_cs_t csFake;
+} ptw32_cs_u_t;
struct pthread_mutexattr_t_ {
int pshared;
- int forcecs;
+ int type;
};
+struct pthread_mutex_t_ {
+ ptw32_cs_u_t cs;
+ int lockCount;
+ int pshared;
+ int type;
+ pthread_t ownerThread;
+};
struct pthread_key_t_ {
DWORD key;
@@ -365,6 +380,16 @@ BOOL ptw32_increase_semaphore(sem_t * sem,
unsigned int n);
#endif /* NEED_SEM */
+int ptw32_InitializeCriticalSection (ptw32_cs_u_t *);
+
+void ptw32_DeleteCriticalSection (ptw32_cs_u_t *);
+
+void ptw32_EnterCriticalSection (ptw32_cs_u_t *);
+
+void ptw32_LeaveCriticalSection (ptw32_cs_u_t *);
+
+BOOL ptw32_TryEnterCriticalSection (ptw32_cs_u_t *);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */