[Starkit] corruption of starkits by double access
Jean-Claude Wippler
jcw at equi4.com
Mon Feb 27 12:32:02 CET 2006
Steve Landers wrote:
> Steve Blinkhorn wrote:
>
>> How can I prevent write-enabled starkits from being corrupted by
>> being
>> accessed a second time whilst already being accessed? We are seeing
>> this as an occasional problem on Windows, where a user "loses" an
>> open
>> window behind another application, and blithely double-clicks again.
>>
>> We can't find what sort of corruption is going on, because the
>> starkit
>> then will not unwrap.
>
> This is a topic I'm also very interested in - for the very same
> reasons.
>
> From the reading I've done on the topic, cross-platform locking
> seems to be a minefield (or perhaps a cesspit - depending on your
> point of view).
>
> I'm wondering if the 80/20 solution might be to create a small
> Critcl extension that tries to create a Windows exclusive advisory
> lock on the kit / metakit file?
>
> Does anyone have an opinion on whether this is an approach worth
> investigating further?
There's a page on this on the wiki - http://wiki.tcl.tk/593
But if you drop x-platform, i.e. a plain Windows solution, then it's
probably all quite easy to solve. A lockfile opened in exclusive
mode, or opening a socket on a fixed port number (which one is the
big Q!), or perhaps actually solve the *real* problem: when launched
again, look for another instance and bring it to the front / exit if
it exists. Much friendlier than exiting with some error. Can a top-
level window be found by name on Windows? I don't remember. With
Critcl, I would think that it should be possible to do this in the
same way as non-Tcl single-launch Windows apps do it. DDE can also
be used for this IIRC, you can probably find more good info on these
approaches with Google.
-jcw
More information about the Starkit
mailing list