diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-08-30 17:19:16 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-08-30 17:19:16 +0300 |
commit | dbe17fefccbff010bbbf6c4d0dccc7b2f3a5e201 (patch) | |
tree | d6844a441dc78f6a18610e9f88d82e0c8f12f6db /src/systhread.h | |
parent | 0e82377a2d9d8f815d2ef4ec09dc914f37fc87ac (diff) | |
download | emacs-dbe17fefccbff010bbbf6c4d0dccc7b2f3a5e201.tar.gz |
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.h | 34 |
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; #else /* HAVE_PTHREAD */ +#ifdef WINDOWSNT + +/* This header is indirectly included in every source file. We don't + want to include windows.h in every source file, so we repeat + declarations of the few necessary data types here (under different + names, to avoid conflicts with files that do include + windows.h). */ + +typedef struct { + struct _CRITICAL_SECTION_DEBUG *DebugInfo; + long LockCount; + long RecursionCount; + void *OwningThread; + void *LockSemaphore; + unsigned long SpinCount; +} w32thread_critsect; + +enum { CONDV_SIGNAL = 0, CONDV_BROADCAST = 1, CONDV_MAX = 2 }; + +typedef struct { + unsigned waiters_count; + w32thread_critsect waiters_count_lock; + void *events[CONDV_MAX]; +} w32thread_cond_t; + +typedef w32thread_critsect sys_mutex_t; + +typedef w32thread_cond_t sys_cond_t; + +typedef unsigned long sys_thread_t; + +#else /* !WINDOWSNT */ + #error port me +#endif /* WINDOWSNT */ #endif /* HAVE_PTHREAD */ #else /* THREADS_ENABLED */ |