On Thu, 4 Apr 2013, Riccardo (Jack) Lucchetti wrote:
On Thu, 4 Apr 2013, Allin Cottrell wrote:
> A follow-up to Jack's posting at
>
http://lists.wfu.edu/pipermail/gretl-devel/2013-March/004371.html
[...]
> Now on Linux and Windows I've added some functionality to
> support choice. If you double-click on a gretl-type file this
> will launch a new gretl instance, but that instance will now,
> before showing itself, look around to see if gretl is already
> running. If so, it'll put up a dialog box asking if you want a
> new instance. And if you say "No" it'll pass a message to the
> prior instance requesting that the file be opened, then exit.
> Thi is implemented via the POSIX signals API on Linux, and the
> Windows Messages API on win32.
>
> This is in CVS and the Windows snapshot. Please test, and
> report any breakage! Thanks.
I just tested it on my laptop, and it works very nicely (Linux Mint/Mate). I
only have one question: on subsequent instances, the PID for that instance
(instead of a progressive number) is used to identify it on the window title
and in the taskbar. I like it, but couldn't this choice be misleading for
less POSIX-inclined users ("Wow! I don't remember opening 8,000 instances of
gretl!")?
Granted, showing the PID (process ID number) in the gretl title may
not be super-intuitive. I started out by showing a simple "instance
number" but actually that can go wrong quite quickly. Here's a
scenario:
1) Start gretl from scratch: it's instance 0 so we just title the
window "gretl".
2) Start a second instance of gretl: we notice that there's already
one running instance of gretl so we title this one "gretl (2)".
3) Close the first instance.
4) Start another instance: we notice that there's already one gretl
instance running so we show "gretl (2)". Problem: we now we have two
gretl top-level windows titled "gretl (2)".
Avoiding the problem at 4) is not easy. We'd not only have to count
the number of running gretl instances but also track down their
top-level windows and query and parse their window titles. And even
then it's not clear what we ought to do. Should we retitle the
existing "gretl (2)" as plain "gretl" (not a straightforward thing
to do) and call the new one "gretl (2)", or call the new one "gretl
(3)", or what?
Sadly, it turns into an imponderable mess. PIDs are at least unique.
Allin