aboutsummaryrefslogtreecommitdiffstats
path: root/src/systhread.h
diff options
context:
space:
mode:
authorEli Zaretskii2013-08-30 17:19:16 +0300
committerEli Zaretskii2013-08-30 17:19:16 +0300
commitdbe17fefccbff010bbbf6c4d0dccc7b2f3a5e201 (patch)
treed6844a441dc78f6a18610e9f88d82e0c8f12f6db /src/systhread.h
parent0e82377a2d9d8f815d2ef4ec09dc914f37fc87ac (diff)
downloademacs-dbe17fefccbff010bbbf6c4d0dccc7b2f3a5e201.tar.gz
emacs-dbe17fefccbff010bbbf6c4d0dccc7b2f3a5e201.zip
Enable thread support in the MS-Windows build.
src/systhread.h (w32thread_critsect, w32thread_cond_t, sys_mutex_t) (sys_cond_t, sys_thread_t) [WINDOWSNT]: New data types. src/systhread.c (sys_mutex_init, sys_mutex_lock, sys_mutex_unlock) (sys_mutex_destroy, sys_cond_init, sys_cond_wait) (sys_cond_signal, sys_cond_broadcast, sys_cond_destroy) (sys_thread_self, sys_thread_equal, w32_beginthread_wrapper) (sys_thread_create, sys_thread_yield) [WINDOWSNT]: New functions. configure.ac (THREADS_ENABLED): Enable threads for MinGW, even if pthreads is not available.
Diffstat (limited to 'src/systhread.h')
-rw-r--r--src/systhread.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/systhread.h b/src/systhread.h
index eb9cde78b61..52735449a5e 100644
--- a/src/systhread.h
+++ b/src/systhread.h
@@ -36,8 +36,42 @@ typedef pthread_t sys_thread_t;
36 36
37#else /* HAVE_PTHREAD */ 37#else /* HAVE_PTHREAD */
38 38
39#ifdef WINDOWSNT
40
41/* This header is indirectly included in every source file. We don't
42 want to include windows.h in every source file, so we repeat
43 declarations of the few necessary data types here (under different
44 names, to avoid conflicts with files that do include
45 windows.h). */
46
47typedef struct {
48 struct _CRITICAL_SECTION_DEBUG *DebugInfo;
49 long LockCount;
50 long RecursionCount;
51 void *OwningThread;
52 void *LockSemaphore;
53 unsigned long SpinCount;
54} w32thread_critsect;
55
56enum { CONDV_SIGNAL = 0, CONDV_BROADCAST = 1, CONDV_MAX = 2 };
57
58typedef struct {
59 unsigned waiters_count;
60 w32thread_critsect waiters_count_lock;
61 void *events[CONDV_MAX];
62} w32thread_cond_t;
63
64typedef w32thread_critsect sys_mutex_t;
65
66typedef w32thread_cond_t sys_cond_t;
67
68typedef unsigned long sys_thread_t;
69
70#else /* !WINDOWSNT */
71
39#error port me 72#error port me
40 73
74#endif /* WINDOWSNT */
41#endif /* HAVE_PTHREAD */ 75#endif /* HAVE_PTHREAD */
42 76
43#else /* THREADS_ENABLED */ 77#else /* THREADS_ENABLED */