From: Dmitry Y. <di...@us...> - 2008-02-11 17:35:06
|
Build Version : T2.5.0.18313 Firebird 2.5 Unstable (writeBuildNum.sh,v 1.18473 2008/02/11 17:35:04 dimitr Exp ) Update of /cvsroot/firebird/firebird2/src/jrd In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv15035 Modified Files: isc.h isc_signal.h isc_sync.cpp Log Message: Allow mixed in-process/cross-process events on Windows (like they work in POSIX). Index: isc.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/isc.h,v retrieving revision 1.33 retrieving revision 1.34 diff -b -U3 -r1.33 -r1.34 --- isc.h 26 Jan 2008 13:06:10 -0000 1.33 +++ isc.h 11 Feb 2008 17:34:58 -0000 1.34 @@ -125,7 +125,7 @@ struct event_t { SLONG event_pid; - SLONG event_type; + SLONG event_id; SLONG event_count; void* event_handle; }; Index: isc_signal.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/isc_signal.h,v retrieving revision 1.6 retrieving revision 1.7 diff -b -U3 -r1.6 -r1.7 --- isc_signal.h 16 Jan 2008 09:07:24 -0000 1.6 +++ isc_signal.h 11 Feb 2008 17:34:58 -0000 1.7 @@ -26,31 +26,22 @@ #ifdef SUPERSERVER -// On all platforms, value of zero means in-process signals. +// In-process signals const int BLOCKING_SIGNAL = 0; const int WAKEUP_SIGNAL = 0; const int STALL_SIGNAL = 0; const int EVENT_SIGNAL = 0; -#else // Classic - -// On Windows, all cross-process signal numbers must be unique, -// as they're used as a part of the shared kernel objects names. -// On POSIX, the only requirement is being non-zero. - -#ifdef WIN_NT -const int BLOCKING_SIGNAL = 1000; -const int WAKEUP_SIGNAL = 1100; -const int STALL_SIGNAL = 1200; -const int EVENT_SIGNAL = 1300; #else + +// Cross-process signals + const int BLOCKING_SIGNAL = 1; const int WAKEUP_SIGNAL = 1; const int STALL_SIGNAL = 1; const int EVENT_SIGNAL = 1; -#endif -#endif // SUPERSERVER +#endif #endif // JRD_ISC_SIGNAL_H Index: isc_sync.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/isc_sync.cpp,v retrieving revision 1.124 retrieving revision 1.125 diff -b -U3 -r1.124 -r1.125 --- isc_sync.cpp 4 Feb 2008 15:00:26 -0000 1.124 +++ isc_sync.cpp 11 Feb 2008 17:34:58 -0000 1.125 @@ -702,7 +702,10 @@ * **************************************/ + if (event->event_pid == process_id) + { CloseHandle((HANDLE) event->event_handle); + } } @@ -719,11 +722,15 @@ * **************************************/ + static int idCounter = 0; + + const int id = type ? ++idCounter : 0; + event->event_pid = process_id = getpid(); event->event_count = 0; - event->event_type = type; + event->event_id = id; - event->event_handle = ISC_make_signal(true, true, process_id, type); + event->event_handle = ISC_make_signal(true, true, process_id, id); return (event->event_handle) ? TRUE : FALSE; } @@ -745,11 +752,9 @@ ++event->event_count; if (event->event_pid != process_id) - ISC_kill(event->event_pid, event->event_type, event->event_handle); + return ISC_kill(event->event_pid, event->event_id, event->event_handle); else - SetEvent((HANDLE) event->event_handle); - - return 0; + return SetEvent((HANDLE) event->event_handle) ? 0 : -1; } @@ -1097,13 +1102,13 @@ TEXT event_name[BUFFER_TINY]; sprintf(event_name, "_firebird_process%u_signal%d", process_idL, signal_number); - HANDLE hEvent; + HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, TRUE, event_name); + if (create_flag) { + fb_assert(!hEvent); hEvent = CreateEvent(ISC_get_security_desc(), man_rst, FALSE, event_name); } - else { - hEvent = OpenEvent(EVENT_ALL_ACCESS, TRUE, event_name); - } + return hEvent; } #endif |