dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp Display.cs,1.7,1.8


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/Xsharp Display.cs,1.7,1.8
Date: Fri, 25 Jul 2003 00:19:22 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv25839/Xsharp

Modified Files:
        Display.cs 
Log Message:


Release the display lock while waiting for an event in "XNextEvent",
so that other threads can issue X requests in the interim.


Index: Display.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Display.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Display.cs  22 Jul 2003 01:22:51 -0000      1.7
--- Display.cs  25 Jul 2003 04:19:19 -0000      1.8
***************
*** 45,48 ****
--- 45,49 ----
        private bool quit;
        private bool pendingExposes;
+       private bool inMainLoop;
        private InputOutputWidget exposeList;
        private Xlib.Cursor[] cursors;
***************
*** 478,481 ****
--- 479,483 ----
        private AppEvent HandleNextEvent(bool wait)
                        {
+                               bool isMainLoop = false;
                                try
                                {
***************
*** 484,487 ****
--- 486,497 ----
                                        int timeout;
  
+                                       // Check for re-entry from multiple 
threads.
+                                       if(inMainLoop)
+                                       {
+                                               return AppEvent.NoEvent;
+                                       }
+                                       isMainLoop = true;
+                                       inMainLoop = true;
+ 
                                        // Flush any requests that are in the 
outgoing queue.
                                        Xlib.XFlush(dpy);
***************
*** 554,561 ****
                                                if(timeout < 0)
                                                {
!                                                       Xlib.XNextEvent(dpy, 
out xevent);
                                                        Unlock();
                                                        try
                                                        {
                                                                
DispatchEvent(ref xevent);
                                                        }
--- 564,575 ----
                                                if(timeout < 0)
                                                {
!                                                       // Make sure that we 
release the display lock
!                                                       // before calling 
"XNextEvent", so that other
!                                                       // threads can issue X 
requests while we are
!                                                       // waiting for the next 
event to occur.
                                                        Unlock();
                                                        try
                                                        {
+                                                               
Xlib.XNextEvent(dpy, out xevent);
                                                                
DispatchEvent(ref xevent);
                                                        }
***************
*** 568,584 ****
                                                else
                                                {
!                                                       
if(Xlib.XNextEventWithTimeout
!                                                               (dpy, out 
xevent, timeout) > 0)
                                                        {
!                                                               Unlock();
!                                                               try
                                                                {
                                                                        
DispatchEvent(ref xevent);
                                                                }
!                                                               finally
!                                                               {
!                                                                       dpy = 
Lock();
!                                                               }
!                                                               return 
AppEvent.Regular;
                                                        }
                                                }
--- 582,598 ----
                                                else
                                                {
!                                                       Unlock();
!                                                       try
                                                        {
!                                                               
if(Xlib.XNextEventWithTimeout
!                                                                       (dpy, 
out xevent, timeout) > 0)
                                                                {
                                                                        
DispatchEvent(ref xevent);
+                                                                       return 
AppEvent.Regular;
                                                                }
!                                                       }
!                                                       finally
!                                                       {
!                                                               dpy = Lock();
                                                        }
                                                }
***************
*** 587,590 ****
--- 601,608 ----
                                finally
                                {
+                                       if(isMainLoop)
+                                       {
+                                               inMainLoop = false;
+                                       }
                                        Unlock();
                                }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]