> QQ: Can you fix the patch? I'm done till Monday.
>
Sure, thanks for testing it. Below is the revised version.
Regards,
Qingqing
---
Index: backend/port/win32/signal.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/port/win32/signal.c,v
retrieving revision 1.12
diff -u -r1.12 signal.c
--- backend/port/win32/signal.c 15 Oct 2005 02:49:23 -0000 1.12
+++ backend/port/win32/signal.c 21 Oct 2005 05:32:52 -0000
@@ -19,11 +19,12 @@/* pg_signal_crit_sec is used to protect only pg_signal_queue. That is the only * variable that can
beaccessed from the signal sending threads! */static CRITICAL_SECTION pg_signal_crit_sec;
-static int pg_signal_queue;
static pqsigfunc pg_signal_array[PG_SIGNAL_COUNT];static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];
-static int pg_signal_mask;
+
+DLLIMPORT volatile int pg_signal_queue;
+DLLIMPORT int pg_signal_mask;
DLLIMPORT HANDLE pgwin32_signal_event;HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
@@ -91,11 +92,10 @@ int i;
EnterCriticalSection(&pg_signal_crit_sec);
- while (pg_signal_queue & ~pg_signal_mask)
+ while (UNBLOCKED_SIGNAL_QUEUE()) { /* One or more unblocked signals queued for execution */
-
- int exec_mask = pg_signal_queue & ~pg_signal_mask;
+ int exec_mask = UNBLOCKED_SIGNAL_QUEUE();
for (i = 0; i < PG_SIGNAL_COUNT; i++) {
Index: include/port/win32.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port/win32.h,v
retrieving revision 1.47
diff -u -r1.47 win32.h
--- include/port/win32.h 15 Oct 2005 02:49:45 -0000 1.47
+++ include/port/win32.h 21 Oct 2005 05:33:26 -0000
@@ -214,6 +214,12 @@
/* In backend/port/win32/signal.c */
+extern DLLIMPORT volatile int pg_signal_queue;
+extern DLLIMPORT int pg_signal_mask;
+
+#define UNBLOCKED_SIGNAL_QUEUE() \
+ (pg_signal_queue & ~pg_signal_mask)
+extern DLLIMPORT HANDLE pgwin32_signal_event;extern HANDLE pgwin32_initial_signal_pipe;
Index: include/miscadmin.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/miscadmin.h,v
retrieving revision 1.180
diff -u -r1.180 miscadmin.h
--- include/miscadmin.h 15 Oct 2005 02:49:41 -0000 1.180
+++ include/miscadmin.h 21 Oct 2005 05:33:56 -0000
@@ -87,8 +87,10 @@
#define CHECK_FOR_INTERRUPTS() \do { \
- if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE) == WAIT_OBJECT_0) \
- pgwin32_dispatch_queued_signals(); \
+ if (UNBLOCKED_SIGNAL_QUEUE()) { \
+ if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE) == WAIT_OBJECT_0) \
+ pgwin32_dispatch_queued_signals(); \
+ } \ if (InterruptPending) \ ProcessInterrupts(); \} while(0)