- Subject: Re: How to detect when stdout is closed?
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Sat, 21 Apr 2007 18:03:33 -0400
=?UTF-8?Q?J=C3=B6rg?= Sommer <joerg@xxxxxxxxxxxx> wrote:
>Not really. The functions is blocked in a fopen() so I can't check for
>this regularly.
>
>forever
>{
>    variable fifo = fopen(fifo_name, "r");
  Are you saying that it blocks here?  Or in the fgets statement?  
  If either case, you might try using the lower level functions in a
  non-blocking mode, e.g.,
     fd = open (fifo_name, O_RDONLY, O_NONBLOCK);
        .
	.
      
      variable nread;
      while (nread = read (fp, &buf, nbytes), nread == -1)
        {
	   if (errno == EAGAIN)
	     {
	        % Nothing available to read.
	        check_if_parent_is_alive ();
		  .
		  .
		sleep (1);
		continue;
	     }
	   throw IOError;
	}
	
  This requires a bit more work that is the price you pay for
  non-blocking I/O.
>BTW: What's your decision regarding the window popup problem for XJed?
>  It's not possible to bring XJed in forground, if it isn't active.
>  suspend() suspends the editor, if it hasn't the focus, but I want to
>  raise it as requested from another application.
  Would removing the "kill (0, SIGSTOP)" line in xterm.c be sufficient
to deal with the issue?
Thanks,
--John
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
  [2007 date index]
  [2007 thread index]
  
  [Thread Prev] [Thread Next]
      
  [Date Prev] [Date Next]