How to prevent a stack from loading twice (in Linux)

Jan Schenkel janschenkel at yahoo.com
Sat May 23 08:04:23 EDT 2009


--- On Sat, 5/23/09, Peter Alcibiades <palcibiades-first at yahoo.co.uk> wrote:

> From: Peter Alcibiades <palcibiades-first at yahoo.co.uk>
> Subject: Re: How to prevent a stack from loading twice (in Linux)
> To: use-revolution at lists.runrev.com
> Date: Saturday, May 23, 2009, 2:58 AM
> 
> Jan,
> 
> Yes, I found relaunch and tried it, and the docs seem to be
> right, it does
> not seem to work in Linux.  If reload is confined to
> the stack currently
> running, then its at least clear why that too does not
> work.  
> 
> So is there no way of stopping a user from loading the app,
> and then loading
> it again, and trying to run both copies at once, maybe
> alternately, and then
> looking at you with a mixture of dismay and guilt when it
> doesn't seem to be
> working right?
> 
> If its all down to the users following instructions, we are
> indeed up the
> creek with no paddle!
> 
> Peter
> 
> 

I'm sure some Unix zealots might come and whack your fingers off if you try and take that behaviour away from them ;-)

Seriously, there's no built-in way to prevent it; but you can always employ a crude locking mechanism by writing a myapp.lk file somewhere, and refusing to open the application when that file is already present.
Or you can open a server socket on a fixed port, and quit if you fail to grab that port; the added advantage of the socket approach being that you can use the server socket to receive an 'open file' message from the second started instance.

Jan Schenkel
=====
Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)



      



More information about the use-livecode mailing list