summaryrefslogtreecommitdiff
path: root/PACE/pace
diff options
context:
space:
mode:
authorluther <luther@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-08-22 17:53:57 +0000
committerluther <luther@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-08-22 17:53:57 +0000
commit499fdc8ea402db939245e27df2422941844af527 (patch)
tree14c257b326e283b553078b6c4ec9d7b266ffa7dc /PACE/pace
parentc16f8c73dfb06e2b16f6aee34aa71b5f103ba492 (diff)
downloadATCD-499fdc8ea402db939245e27df2422941844af527.tar.gz
Tue Aug 22 12:44:09 2000 Luther J Baker <luther@cs.wustl.edu>
Diffstat (limited to 'PACE/pace')
-rw-r--r--PACE/pace/config/features.h5
-rw-r--r--PACE/pace/win32/TODO16
-rw-r--r--PACE/pace/win32/pthread.c32
3 files changed, 51 insertions, 2 deletions
diff --git a/PACE/pace/config/features.h b/PACE/pace/config/features.h
index d9b3d56040a..21819d51b76 100644
--- a/PACE/pace/config/features.h
+++ b/PACE/pace/config/features.h
@@ -39,6 +39,11 @@
# define PACE_MT_SAFE 1
# endif /* PACE_MT_SAFE */
+/* Turn on multithreading. */
+# if !defined (_MT)
+# define _MT
+# endif /* _MT */
+
#endif /* WIN32 */
#endif /* PACE_CONFIG_FEATURES_H */
diff --git a/PACE/pace/win32/TODO b/PACE/pace/win32/TODO
index 8766147594a..26fa394981c 100644
--- a/PACE/pace/win32/TODO
+++ b/PACE/pace/win32/TODO
@@ -1,3 +1,5 @@
+----------------------------------------------------------------------
+
* Emulation:
- pthreads
- dirent
@@ -16,3 +18,17 @@
OS.cpp:2798 => PACE_PTHREAD_CREATE_JOINABLE
OS.cpp:2801 => PACE_PTHREAD_CREATE_DETACHED
+----------------------------------------------------------------------
+
+ * if we fail to build thread correctly, return -1
+ PACE_RETURN_FAILURE ???
+
+----------------------------------------------------------------------
+
+ * get rid of the temp macros / junk in config/constants.h
+
+----------------------------------------------------------------------
+
+ * add MFC support to pthread.c
+
+----------------------------------------------------------------------
diff --git a/PACE/pace/win32/pthread.c b/PACE/pace/win32/pthread.c
index 06a4ad3d64d..b28c6500056 100644
--- a/PACE/pace/win32/pthread.c
+++ b/PACE/pace/win32/pthread.c
@@ -14,6 +14,7 @@
* ============================================================================= */
#include "pace/pthread.h"
+#include <process.h>
#if !defined (PACE_HAS_INLINE)
# include "pace/win32/pthread.inl"
@@ -168,8 +169,35 @@ pthread_create (pace_pthread_t * thread,
void * (*start_routine) (void*),
void * arg)
{
- /* not working yet .. fill me in */
- return -1;
+ unsigned flags = 0x0, thr_addr = 0x0;
+ if (attr->sparam_.priority_ != THREAD_PRIORITY_NORMAL)
+ {
+ // CREATE_SUSPENDED is the only flag win32 currently supports
+ flags = CREATE_SUSPENDED;
+ }
+
+ thread = (pace_pthread_t) _beginthreadex (0,
+ attr->stack_size_,
+ (unsigned (__stdcall *)(void*))start_routine,
+ arg,
+ flags,
+ &thr_addr);
+
+ if (flags == CREATE_SUSPENDED && thread != 0)
+ {
+ SetThreadPriority (thread, attr->sparam_.priority_);
+ ResumeThread (thread);
+ }
+
+ if (thread == 0)
+ {
+ return 0;
+ }
+ else
+ {
+ PACE_FAIL_RETURN (-1);
+ }
+
}
#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */