Saw this on the berlin list.

---
'Cloning and the reprogramming of DNA is the first serious step in 
becoming one with God.'
        - Scientist G. Richard Seed

---------- Forwarded message ----------
Date: 22 Oct 2000 02:24:13 +0300
From: Momchil Velikov <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [Berlin-design] [RFA] interrupted select() again

Hi,

There are still problems in GGIConsole::next_event(). When
ggiEventSelect() is interrupted, `mask' and `rfdset' variables are
cleared, so the next invocation of ggiEventSelect() deadlocks. This
patch initializes the variables `mask' and `rfdset' inside the
ggiEventSelect() loop.

Regards,
-velco
Index: GGI.cc
===================================================================
RCS file: /cvsroot/berlin/Berlin/src/Berlin/GGI.cc,v
retrieving revision 1.20
diff -u -r1.20 GGI.cc
--- GGI.cc      2000/09/30 00:24:43     1.20
+++ GGI.cc      2000/10/21 22:54:53
@@ -158,16 +158,23 @@
 {
   Prague::Trace trace("GGI::Console::next_event");
   ggi_event event;
-  ggi_event_mask mask = ggi_event_mask (emKeyboard | emPtrMove | emPtrButtonPress | 
emPtrButtonRelease);
+  ggi_event_mask mask;
   ggi_event_mask move_mask = ggi_event_mask (emPtrMove);
 
   int input = fileno(stdin);
   Prague::FdSet rfdset;
-  rfdset.set(_wakeupPipe[0]);
-  if (_autoplay) rfdset.set(input);
+
   int nfds = -1;
-  do nfds = ggiEventSelect(_visual, &mask, rfdset.max() + 1, rfdset, 0, 0, 0);
+  do
+    {
+      mask = ggi_event_mask (emKeyboard | emPtrMove | emPtrButtonPress | 
+emPtrButtonRelease);
+      rfdset.set (_wakeupPipe [0]);
+      if (_autoplay)
+       rfdset.set (input);
+      nfds = ggiEventSelect (_visual, &mask, rfdset.max() + 1, rfdset, 0, 0, 0);
+    }
   while (nfds == -1 && errno == EINTR);
+
   if (nfds == 0)
     {
       // no input from the outside world

Reply via email to