External for running one instance on windows
Trevor DeVore
lists at mangomultimedia.com
Tue Jul 19 15:24:47 EDT 2005
On Jul 19, 2005, at 11:35 AM, Matthew wrote:
> There is another way to check if an instance is running that will
> work on all OS. When you start the program you create a file if it
> is not already there. If it is there then you close the program.
>
> I hope this helps.
Unfortunately you will run into problems if your application
crashes. The file will stay around and when you try to launch your
app again it thinks it is already running. You can come up with
schemes to work around this but using a mutex is much more reliable
and easier on Windows. On Mac you don't have to worry about multiple
instances for each user. I don't do any Linux development right now
so I can't comment on that.
The file method would work better if Revolution would allow you to
get a lock on a file so that nobody else can access it. I didn't see
a way to do this with open file. If this were the case then I think
you could open the file and lock anybody else out from reading it.
Then if another instance of your app launched and tried to open the
file an error would be returned. If the app crashed then I think the
lock on the file would be released.
--
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com
More information about the use-livecode
mailing list