RE: FVWM: FVWM 2.0.43 on Digital Unix still eats CPU time after

From: Grant McDorman <grant_at_isgtec.com>
Date: Wed, 11 Sep 1996 10:32:16 -0400 (EDT)

I just noticed that the FvwmButtons patch is bad. The attached patch should
be used instead; or, change line 204 in the patched FvwmButtons.c from
   running = 1;
to
   running = 0;

Sorry about that.

On 11-Sep-96 19:54:10 Thomas Leitner wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
>
>
> Hi Grant,
>
> On Wed, 11 Sep 1996, Grant McDorman wrote:
>
> > This means, by the way, that the ExitFunction won't get invoked on a
server
> > shutdown, unless some way of preventing all X calls during its
operation can
> > be put in place.
> >
> > The SIGSEGV in the ExitFunction may be the same problem.
> >
> > I am attaching a patch to fvwm.c which changes the CatchFatal to call
> > ClosePipes() and exit(1), and the patch FvwmButtons which changes the
signal
> > handling.
> >
> > Chuck may have more to say on this, of course.
>
> Thanks for the patch. I'll apply it and see if it works. I hope that
> a final solution for the problem (perhaps with ExitFunction being called
> even on a server shutdown) will be in 2.1.
>
> Thanks again -- Tom
>
> -
--------------------------------------------------------------------------
> T o m L e i t n e r Dept. of Communications
> Graz University of
Technology,
> e-mail : tom_at_finwds01.tu-graz.ac.at Inffeldgasse 12
> Phone : +43-316-873-7455 A-8010 Graz / Austria / Europe
> Fax : +43-316-463-697
> Home page : http://wiis.tu-graz.ac.at/people/tom.html
> PGP public key on : ftp://wiis.tu-graz.ac.at/pgp-keys/tom.asc or send
> mail with subject "get Thomas Leitner" to pgp-public-keys_at_keys.pgp.net
> -
--------------------------------------------------------------------------
>
> -----BEGIN PGP SIGNATURE-----
> Version: 2.6.3i
> Charset: latin1
>
> iQCVAwUBMjbEhNEZPSczow+VAQHwswP/VP6VmiQrJ5l3ziEoaaGALdy7munjeteW
> QxA9riMRRFYOfTWGyWt+SbvWzQhFAxvzZ+1Ighv+M+7D3Qcz4mISjcfGrrUek5Os
> P/RIA8RXsRsG9+7RdiLt6BdhiLx/Tu8SGdB3zExsJjpaTeTY/9AzZ+2sSriJlIeQ
> Z50Ler5btbI=
> =1JUK
> -----END PGP SIGNATURE-----
>
> --
> Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
> To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
> message to majordomo_at_hpc.uh.edu.
> To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
>
Grant McDorman <grant_at_isgtec.com>
                                ISG Technologies, Inc.


*** fvwm-2.0.43/modules/FvwmButtons/FvwmButtons.c.orig Thu Jun 27 10:45:30 1996
--- fvwm-2.0.43/modules/FvwmButtons/FvwmButtons.c Wed Sep 11 10:31:58 1996
***************
*** 27,32 ****
--- 27,33 ----
  #include <string.h>
  #include <sys/wait.h>
  #include <sys/time.h>
+ #include <sys/stat.h>
  #if defined ___AIX || defined _AIX || defined __QNX__ || defined ___AIXV3 || d
efined AIXV3 || defined _SEQUENT_
  #include <sys/select.h>
  #endif
***************
*** 75,80 ****
--- 76,82 ----
  /* ------------------------------ prototypes ------------------------------- *
/
  
  void DeadPipe(int nonsense);
+ void CleanUp(void);
  void SetButtonSize(button_info*,int,int);
  /* main */
  void Loop(void);
***************
*** 123,128 ****
--- 125,132 ----
  GC NormalGC;
  int Width,Height;
  
+ int running = 1;
+
  int x= -30000,y= -30000,w= -1,h= -1,gravity = NorthWestGravity;
  int new_desk = 0;
  int ready = 0;
***************
*** 170,182 ****
  **/
  void DeadPipe(int whatever)
  {
    button_info *b,*ub=UberButton;
    int button=-1;
  
- signal(SIGPIPE, SIG_IGN);/* Xsync may cause SIGPIPE */
-
    XSync(Dpy,0); /* Wait for thing to settle down a bit */
    XGrabServer(Dpy); /* We don't want interference right now */
    while(NextButton(&ub,&b,&button,0))
      {
        /* delete swallowed windows */
--- 174,217 ----
  **/
  void DeadPipe(int whatever)
  {
+ struct stat buf;
+
+ /*
+ * If a SIGPIPE arrives during this operation, just exit.
+ * - the signal will probably because the server is shutting
+ * down. Attempting to do any further processing is useless
+ * and may in fact, on some platforms, put the process into
+ * a tight loop (if SIGPIPE is ignored).
+ * 22 July 1996 GRM.
+ *
+ * Further investigation: XSync may loop *without* causing a SIGPIPE.
+ * This may be because the connection is dead, or because of the
+ * fact that X operations in signal handlers are discouraged.
+ *
+ * In order to cover all the bases, then, this function will now
+ * set a global flag which will cause the main loop to stop.
+ *
+ * SIGPIPE is reset to DeadPipe, as well.
+ */
+ signal(SIGPIPE, DeadPipe);
+
+ /*
+ * Try to check status of X connection.
+ */
+ if (fstat(XConnectionNumber(Dpy), &buf) == -1)
+ exit(0);
+
+ running = 0;
+ }
+
+ void CleanUp(void)
+ {
    button_info *b,*ub=UberButton;
    int button=-1;
  
    XSync(Dpy,0); /* Wait for thing to settle down a bit */
    XGrabServer(Dpy); /* We don't want interference right now */
+
    while(NextButton(&ub,&b,&button,0))
      {
        /* delete swallowed windows */
***************
*** 506,512 ****
    int ex=10000,ey=10000,ex2=0,ey2=0;
  #endif
  
! while(1)
      {
        if(My_XNextEvent(Dpy,&Event))
          {
--- 541,547 ----
    int ex=10000,ey=10000,ex2=0,ey2=0;
  #endif
  
! while(running)
      {
        if(My_XNextEvent(Dpy,&Event))
          {
***************
*** 733,738 ****
--- 768,774 ----
            }
        }
      }
+ CleanUp();
  }
  
  /**

End of MIME message
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Wed Sep 11 1996 - 09:51:29 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST