[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/gc/win32_threads.c [Boehm-GC]
From: |
Dave Love |
Subject: |
[Emacs-diffs] Changes to emacs/gc/win32_threads.c [Boehm-GC] |
Date: |
Mon, 16 Jun 2003 11:41:54 -0400 |
Index: emacs/gc/win32_threads.c
diff -c emacs/gc/win32_threads.c:1.2.2.1 emacs/gc/win32_threads.c:1.2.2.2
*** emacs/gc/win32_threads.c:1.2.2.1 Thu Jun 5 14:23:04 2003
--- emacs/gc/win32_threads.c Mon Jun 16 11:41:51 2003
***************
*** 1,6 ****
--- 1,7 ----
#if defined(GC_WIN32_THREADS)
#include "private/gc_priv.h"
+ #include <windows.h>
#ifdef CYGWIN32
# include <errno.h>
***************
*** 19,32 ****
#endif
!
! #if 0
! #define STRICT
! #include <windows.h>
#endif
- #define MAX_THREADS 64
-
struct thread_entry {
LONG in_use;
DWORD id;
--- 20,29 ----
#endif
! #ifndef MAX_THREADS
! # define MAX_THREADS 64
#endif
struct thread_entry {
LONG in_use;
DWORD id;
***************
*** 373,381 ****
if (*lo < start) *lo = start;
}
! #if !defined(MSWINCE) && !(defined(__MINGW32__) && !defined(_DLL))
! HANDLE WINAPI GC_CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId )
--- 370,382 ----
if (*lo < start) *lo = start;
}
! #if !defined(CYGWIN32)
! #if !defined(MSWINCE) && defined(GC_DLL)
!
! /* We register threads from DllMain */
!
! GC_API HANDLE GC_CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId )
***************
*** 384,390 ****
lpParameter, dwCreationFlags, lpThreadId);
}
! #else /* !defined(MSWINCE) && !(defined(__MINGW32__) && !defined(_DLL)) */
typedef struct {
HANDLE child_ready_h, parent_ready_h;
--- 385,394 ----
lpParameter, dwCreationFlags, lpThreadId);
}
! #else /* defined(MSWINCE) || !defined(GC_DLL)) */
!
! /* We have no DllMain to take care of new threads. Thus we */
! /* must properly intercept thread creation. */
typedef struct {
HANDLE child_ready_h, parent_ready_h;
***************
*** 510,515 ****
--- 514,521 ----
}
#endif /* !defined(MSWINCE) && !(defined(__MINGW32__) && !defined(_DLL)) */
+ #endif /* !CYGWIN32 */
+
#ifdef MSWINCE
typedef struct {
***************
*** 565,574 ****
LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info);
! /* threadAttach/threadDetach routines used by both CYGWIN and DLL
implementation,
! since both recieve explicit notification on thread creation/destruction
*/
! void threadAttach() {
int i;
/* It appears to be unsafe to acquire a lock here, since this */
/* code is apparently not preeemptible on some systems. */
--- 571,581 ----
LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info);
! /* threadAttach/threadDetach routines used by both CYGWIN and DLL
! * implementation, since both recieve explicit notification on thread
! * creation/destruction.
*/
! static void threadAttach() {
int i;
/* It appears to be unsafe to acquire a lock here, since this */
/* code is apparently not preeemptible on some systems. */
***************
*** 617,623 ****
while (GC_please_stop) Sleep(20);
}
! void threadDetach(DWORD thread_id) {
int i;
LOCK();
--- 624,630 ----
while (GC_please_stop) Sleep(20);
}
! static void threadDetach(DWORD thread_id) {
int i;
LOCK();
***************
*** 783,789 ****
int i;
# if DEBUG_CYGWIN_THREADS
! GC_printf2("thread 0x%x(0x%x) called
pthread_exit().\n",(int)pthread_self(),GetCurrentThreadId());
# endif
LOCK();
--- 790,797 ----
int i;
# if DEBUG_CYGWIN_THREADS
! GC_printf2("thread 0x%x(0x%x) called pthread_exit().\n",
! (int)pthread_self(),GetCurrentThreadId());
# endif
LOCK();
***************
*** 806,817 ****
int GC_pthread_detach(pthread_t thread) {
return pthread_detach(thread);
}
! #else
/*
* We avoid acquiring locks here, since this doesn't seem to be preemptable.
* Pontus Rydin suggests wrapping the thread start routine instead.
*/
BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved)
{
switch (reason) {
--- 814,826 ----
int GC_pthread_detach(pthread_t thread) {
return pthread_detach(thread);
}
! #else /* !CYGWIN32 */
/*
* We avoid acquiring locks here, since this doesn't seem to be preemptable.
* Pontus Rydin suggests wrapping the thread start routine instead.
*/
+ #ifdef GC_DLL
BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved)
{
switch (reason) {
***************
*** 852,858 ****
}
return TRUE;
}
! #endif /* CYGWIN32 */
# endif /* !MSWINCE */
--- 861,868 ----
}
return TRUE;
}
! #endif /* GC_DLL */
! #endif /* !CYGWIN32 */
# endif /* !MSWINCE */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/gc/win32_threads.c [Boehm-GC],
Dave Love <=