[Starkit] corruption of starkits by double access
Steve Blinkhorn
steve at prd.co.uk
Mon Feb 27 12:30:55 CET 2006
>
> > A lockfile opened in exclusive mode, or opening a socket on a fixed
> > port number (which one is the big Q!),
>
> A lockfile has two problems - one is the extra file which (in some
> circumstances) is not ideal.
>
Lockfiles sound nice and simple, but if, for some reason, an
application crashes and the lockfile is left in place you have created
a user support problem.
>
> A port number has the problem that it might trigger the windows
> firewall (no big deal, but could surprise end-users and require
> documentation).
>
Thanks for that warning - firewalls and proxies are the source of many
unwelcome surprises. Our "users" are mostly one-trip even when our
customer isn't.
> > or perhaps actually solve the *real* problem: when launched again,
> > look for another instance and bring it to the front / exit if it
> > exists.
>
> The situation I need to cope with isn't restricted to one user
> unfortunately. Steve's situation might be different.
>
> > Much friendlier than exiting with some error. Can a top-level
> > window be found by name on Windows?
>
> Yes - TWAPI does it. Ffidl almost certainly will let you. I'm not
> sure this approach guarantees uniqueness although I suspect you'd get
> a close approximation ;-)
>
Much the nicest solution in principle. The problem I see is the
overhead: TWAPI is nearly half a megabyte compressed. That would add
an extra 50% to our download. Does anyone know off-hand, i.e.
without delving into the TWAPI sources or going off to a Microsoft
site for the documentation, whether finding a window by name is just a
call to a dll function? That would be much more lightweight, if
fiddly.
One thing I *thought* might be raised would be the limitation of
Metakit files to only one client for writing. I half-expected
someone to point to a non-fatal error that might be raised if a second
client attempted to write to it, and using an error trap as a
detection mechanism with a graceful exit. But I am underinformed
about these things.
--
Steve Blinkhorn <steve at prd.co.uk>
More information about the Starkit
mailing list