Re: reset/terminate problems; preventing multiple XWin instance

2004-03-04 Thread cygwinx2eran
On 2004-03-04 13:12, Alexander Gottwald wrote:

> if ! xdpyinfo >/dev/null 2>&1; then

Cygwin's xdpyinfo waits for 6 second before giving up. A couple of days
ago I posted an alternative solution using netstat, which doesn't have
this delay. Both suffer from race conditions, which are quite likely to
occur in practice -- say, a user clicks his "Cygwin xterm" icon twice in
succession to open two xterms, and as a result gets two XWin instances.

  Eran


Re: reset/terminate problems; preventing multiple XWin instance

2004-03-04 Thread cygwinx2eran
On 2004-03-04 18:02, Takuma Murakami wrote:

> > Perhaps there should be a switch that says "if the display already
> > exists, exit silently".
> I agree.  We should have an option like "-silent" or "-quiet".

That's not quite it -- I want to ignore a "display already exists"
error, but if some other fatal error prevents XWin from loading I want
to know about it (say, via the dialog box).


> Let's suppose Cygwin/X has -silent option as above: then I
> think startxwin.bat with -silent option is sufficient for your
> purpose.  It will start a server (which silently fails if there
> is the other) and then start some favorite applications.

This would spawn new instances of my favorite applications every time I
open an xterm. Not a pretty sight.

  Eran


Re: reset/terminate problems; preventing multiple XWin instances

2004-03-03 Thread cygwinx2eran
Hi,

On 29-02-2004 14:11, Takuma Murakami wrote:

>> As for preventing multiple instances of XWin
> This feature is already implemented in my local tree (not
> port based but mutex based detection).
I see that it's in 4.3.0-50 and working well, but I don't see how the 
current implementation addresses the common task I mentioned:
  "open an xterm; run XWin first if needed"
If I use a batchfile that always runs XWin and then xterm, from the 2nd 
invocation onwards it will produce the error popup reporting a "Fatal 
error" and directing me a to log file... Not quite what's needed here.[1]

Perhaps there should be a switch that says "if the display already 
exists, exit silently".

But that doesn't solve the case where I want to run additional programs 
(say, twm and xeyes) whenever a new display is created -- again a common 
scenario, I believe. One way to solve this is to add an option for 
checking the presence of an XWin instance on the given display number 
and exiting immediately with a corresponding errorcode; a batchfile can 
then check for the existance of an XWin instance, and if negative spawn 
XWin and related stuff. But this could lead to a race condition if two 
batchfiles do the check simultaneously. An alternative is to add an 
option for XWin to run some executable iff its startup succeeded.

Yes, I realize this is getting somewhat convoluted, but I think it's an 
important and common use case. I'm trying to move a certain large group 
of people to Cygwin/X, and the issue of "transparently" invoking 
Cygwin/X is one of the two major issues holding things back (the other 
one is multiwindow mode performance).

Regards,
  Eran
[1] For extra helpfulness, perhaps you could specify the nature of the 
fatal error at a prominent location inside the dialog box and not just 
inside the log file?


reset/terminate problems; preventing multiple XWin instances

2004-02-28 Thread cygwinx2eran
Hi,

First, I'd like to extend my gratitude and appreciation to the Cygwin/X 
developers. Your hard work has improved Cygwin/X by bounds and leaps, 
making it an increasingly attractive alternative to bloated and 
expensive commercial offerings. (Now if only multiwindow mode had decent 
performance, like the other two modes...)

A few issues I've encountered with Cygwin/X 4.3.0-47:

Issue #1:
In multiwindow mode, XWin doesn't reset when the last client exists.
Example:
  XWin :9 -terminate -multiwindow & sleep 5; DISPLAY=:9 xhost
XWin should terminate after 5 seconds, but it remains running.
Issue #2:
In the default mode, XWin sometimes terminates instead of resetting.
Example:
  XWin :9& sleep 5; DISPLAY=:9 xhost; sleep 5; DISPLAY=:9 xhost
XWin should reset after 5 seconds and again after 5 more seconds.
The first reset goes well, but on the second reset XWin usually terminates.
Issue #3:
Hoe does one write a batchfile that does "open an xterm window; run XWin 
first if necessary"? Being perhaps the most common usage case, such a 
batchfile should be bundled in the Cygwin/X package and mentioned in the 
documentation.
Note that /usr/X11R6/bin/startxwin.bat always runs a new instance of 
XWin, even if one is already running. This can result in inefficiency 
and confusion when the script is executed several times to open several 
xterm windows (a natural thing to do). It's made even worse by issue #1 
above.
Also, startxwin.bat doesn't use -clipboard.

  Eran