Bugzilla bug #17093: made plevent.c independent of any internal NSPR
authorwtc%netscape.com
Mon, 25 Oct 1999 19:20:58 +0000
changeset 907 d5faffb95469be5728f8150351c7d8c3ccd5c086
parent 906 760c11b4f7c29791760397e247cac80f4fe0ffb6
child 908 3d69ce988e49eb2b02e11ad15476d1fe74ff3f2b
push idunknown
push userunknown
push dateunknown
bugs17093
Bugzilla bug #17093: made plevent.c independent of any internal NSPR headers (primpl.h in particular). Tested on Linux, Solaris, Win32, and Mac. r=srinivas@netscape.com Modified files: lib/ds/Makefile, lib/ds/Makefile.in, lib/ds/plevent.c
lib/ds/Makefile
lib/ds/Makefile.in
lib/ds/plevent.c
--- a/lib/ds/Makefile
+++ b/lib/ds/Makefile
@@ -23,17 +23,17 @@ include $(MOD_DEPTH)/config/config.mk
 
 # Disable optimization of the nspr on SunOS4.1.3
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
 endif
 endif
 
-INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private
+INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include
 
 CSRCS = \
 	plarena.c \
 	plevent.c \
 	plhash.c \
 	plvrsion.c \
 	$(NULL)
 
--- a/lib/ds/Makefile.in
+++ b/lib/ds/Makefile.in
@@ -30,17 +30,17 @@ ifndef USE_AUTOCONF
 # Disable optimization of the nspr on SunOS4.1.3
 ifeq ($(OS_ARCH),SunOS)
 ifeq ($(OS_RELEASE),4.1.3_U1)
 OPTIMIZER =
 endif
 endif
 endif #!USE_AUTOCONF
 
-INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
+INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include
 
 CSRCS = \
 	plarena.c \
 	plevent.c \
 	plhash.c \
 	plvrsion.c \
 	$(NULL)
 
--- a/lib/ds/plevent.c
+++ b/lib/ds/plevent.c
@@ -10,24 +10,29 @@
  * for the specific language governing rights and limitations under the
  * NPL.
  * 
  * The Initial Developer of this code under the NPL is Netscape
  * Communications Corporation.  Portions created by Netscape are
  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  * Reserved.
  */
+
+#if defined(_WIN32) || defined(WIN16)
+#include <windows.h>
+#endif
+
 #if defined(XP_OS2)
 #define INCL_WIN
 #include <os2.h>
 #define DefWindowProc WinDefWindowProc
 typedef MPARAM WPARAM,LPARAM;
 #endif /* XP_OS2 */
 
-#include "primpl.h"
+#include "nspr.h"
 #include "plevent.h"
 
 #if !defined(WIN32)
 #include <errno.h>
 #include <stddef.h>
 #if !defined(XP_OS2)
 #include <unistd.h>
 #endif /* !XP_OS2 */
@@ -36,16 +41,19 @@ typedef MPARAM WPARAM,LPARAM;
 #if defined(XP_UNIX)
 /* for fcntl */
 #include <sys/types.h>
 #include <fcntl.h>
 #endif
 
 #if defined(XP_MAC)
 #include <AppleEvents.h>
+#include "pprthred.h"
+#else
+#include "private/pprthred.h"
 #endif /* XP_MAC */
 
 #if defined(VMS)
 /*
 ** If MOTIF is being used then XtAppAddInput is used as the notification
 ** method and so event flags must be used, so you need to define
 ** VMS_EVENTS_USE_EF. If gdk is being used then select is used for
 ** notification, and then VMS_EVENTS_USE_SOCKETS should be defined.
@@ -285,31 +293,30 @@ PL_PostSynchronousEvent(PLEventQueue* se
     PR_CEnterMonitor(event);
 
     if (PR_CurrentThread() == self->handlerThread) {
 	/* Handle the case where the thread requesting the event handling
 	   is also the thread that's supposed to do the handling. */
 	result = event->handler(event);
     }
     else {
-	int inEventQueueMon = PR_GetMonitorEntryCount(self->monitor);
-	int i, entryCount = self->monitor->entryCount;
+	int i, entryCount = PR_GetMonitorEntryCount(self->monitor);
 
 	event->synchronousResult = (void*)PR_TRUE;
 	PL_PostEvent(self, event);
 	/* We need to temporarily give up our event queue monitor if
 	   we're holding it, otherwise, the thread we're going to wait
 	   for notification from won't be able to enter it to process
 	   the event. */
-	if (inEventQueueMon) {
+	if (entryCount) {
 	    for (i = 0; i < entryCount; i++)
 		PR_ExitMonitor(self->monitor);
 	}
 	PR_CWait(event, PR_INTERVAL_NO_TIMEOUT);	/* wait for event to be handled or destroyed */
-	if (inEventQueueMon) {
+	if (entryCount) {
 	    for (i = 0; i < entryCount; i++)
 		PR_EnterMonitor(self->monitor);
 	}
     	result = event->synchronousResult;
 	event->synchronousResult = NULL;
     }
 
     PR_CExitMonitor(event);