summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>1998-07-30 15:33:13 +0000
committerrpj <rpj>1998-07-30 15:33:13 +0000
commit46dc6c8f550e64ed07650b98ea437fdbb1de54c7 (patch)
tree8b524534506a5b6eb2071eea6218a57ff47a6198
parent1d10646cae6e5bf0c6f96b43b7766096be16a9e6 (diff)
Fri Jul 31 00:05:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* Makefile (SRCS): Create. Preliminary. * windows.h: Create. Contains Win32 definitions for compile testing. This is just a standin for the real one. * pthread.h (SIG_UNBLOCK): Fix typo. Was SIG_BLOCK. (windows.h): Add include. Required for CRITICAL_SECTION. (pthread_cond_t): Move enum declaration outside of struct definition. (unistd.h): Add include - may be temporary. * condvar.c (windows.h): Add include.
-rw-r--r--ChangeLog13
-rw-r--r--Makefile14
-rw-r--r--condvar.c1
-rw-r--r--pthread.h9
-rw-r--r--windows.h103
5 files changed, 137 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index fe25b56..909442f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
Fri Jul 31 00:05:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+ * Makefile (SRCS): Create. Preliminary.
+
+ * windows.h: Create. Contains Win32 definitions for compile
+ testing. This is just a standin for the real one.
+
+ * pthread.h (SIG_UNBLOCK): Fix typo. Was SIG_BLOCK.
+ (windows.h): Add include. Required for CRITICAL_SECTION.
+ (pthread_cond_t): Move enum declaration outside of struct
+ definition.
+ (unistd.h): Add include - may be temporary.
+
+ * condvar.c (windows.h): Add include.
+
* implement.h (_PTHREAD_THIS): Remove - no longer required.
(_PTHREAD_STACK): Use pthread_self() instead of _PTHREAD_THIS.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f0f3653
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+
+CFLAGS = -I.
+
+SRCS = attr.c cancel.c cleanup.c condvar.c create.c dll.c \
+ exit.c fork.c global.c misc.c mutex.c private.c sched.c \
+ signal.c sync.c tsd.c
+
+OBJS = attr.o cancel.o cleanup.o condvar.o create.o dll.o \
+ exit.o fork.o global.o misc.o mutex.o private.o sched.o \
+ signal.o sync.o tsd.o
+
+INCL = implement.h pthread.h windows.h
+
+all: $(OBJS) \ No newline at end of file
diff --git a/condvar.c b/condvar.c
index 0468294..d11c322 100644
--- a/condvar.c
+++ b/condvar.c
@@ -5,6 +5,7 @@
* This translation unit implements condition variables and their primitives.
*/
+#include <windows.h>
#include "pthread.h"
int
diff --git a/pthread.h b/pthread.h
index d2be555..17f91b7 100644
--- a/pthread.h
+++ b/pthread.h
@@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _PTHREADS_H
#define _PTHREADS_H
+#include <windows.h>
+#include <unistd.h>
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
@@ -35,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif /* SIG_BLOCK */
#ifndef SIG_UNBLOCK
-#define SIG_BLOCK 1
+#define SIG_UNBLOCK 1
#endif /* SIG_UNBLOCK */
#ifndef SIG_SETMASK
@@ -96,9 +99,9 @@ struct sched_param {
int sched_priority;
}
-typedef struct {
- enum { SIGNAL, BROADCAST, NUM_EVENTS };
+enum { SIGNAL, BROADCAST, NUM_EVENTS };
+typedef struct {
/* Signal and broadcast event HANDLEs. */
HANDLE events[NUM_EVENTS];
diff --git a/windows.h b/windows.h
new file mode 100644
index 0000000..31e2d0c
--- /dev/null
+++ b/windows.h
@@ -0,0 +1,103 @@
+/*
+ * windows.h
+ *
+ * NOT THE REAL windows.h. We're not necessarily concerned
+ * that value are correct. Just that the types are defined.
+ *
+ */
+
+#define WINAPI
+
+#define CONST const
+
+#define DLL_THREAD_ATTACH 0
+
+#define DLL_THREAD_DETACH 1
+
+#define DLL_PROCESS_ATTACH 2
+
+#define DLL_PROCESS_DETACH 3
+
+/* Error numbers */
+
+enum {
+ EINVAL,
+ ENOMEM,
+ ENOSYS,
+ EAGAIN
+};
+
+typedef void VOID;
+
+typedef int BOOL;
+
+typedef unsigned long DWORD;
+
+typedef unsigned long ULONG;
+
+typedef void * LPVOID;
+
+typedef DWORD * LPDWORD;
+
+typedef char * LPCTSTR;
+
+typedef unsigned long HANDLE;
+
+typedef HANDLE HINSTANCE;
+
+typedef void * LPSECURITY_ATTRIBUTES;
+
+typedef int CRITICAL_SECTION;
+
+typedef CRITICAL_SECTION * LPCRITICAL_SECTION;
+
+HANDLE CreateEvent(LPSECURITY_ATTRIBUTES security,
+ BOOL manualReset,
+ BOOL initialState,
+ LPCTSTR name);
+
+BOOL SetEvent(HANDLE event);
+
+BOOL ResetEvent(HANDLE event);
+
+VOID EnterCriticalSection(LPCRITICAL_SECTION criticalSection);
+
+VOID LeaveCriticalSection(LPCRITICAL_SECTION criticalSection);
+
+VOID DeleteCriticalSection(LPCRITICAL_SECTION criticalSection);
+
+VOID InitializeCriticalSection(LPCRITICAL_SECTION criticalSection);
+
+VOID TryEnterCriticalSection(LPCRITICAL_SECTION criticalSection);
+
+DWORD WaitForMultipleObjects(DWORD numObjects,
+ CONST HANDLE * objectArray,
+ BOOL waitForAll,
+ DWORD timeout);
+
+DWORD WaitForSingleObject(HANDLE object,
+ DWORD timeout);
+
+DWORD TlsAlloc();
+
+BOOL TlsFree(DWORD index);
+
+BOOL TlsSetValue(DWORD index, LPVOID value);
+
+BOOL TlsSetValue(DWORD index, LPVOID value);
+
+BOOL SetThreadPriority(HANDLE threadHandle, int priority);
+
+int GetThreadPriority(HANDLE threadHandle);
+
+HANDLE _beginthreadex(LPSECURITY_ATTRIBUTES security,
+ DWORD stack,
+ unsigned (* start_routine)(void *),
+ LPVOID param,
+ DWORD flags,
+ LPDWORD threadID);
+
+VOID _endthreadex(DWORD);
+
+DWORD GetVersion(VOID);
+