Re: My way to check if a progam is already running
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Thu, 21 Jun 2007 11:52:13 -0700
On Jun 21, 4:17 am, Jan Panteltje <pNaonStpealm...@xxxxxxxxx> wrote:
That will prevent _that_ problem,
I thought that was 'the problem'.
but not the problem that you still have 2
the same applications running where the user is supposed to use one.
Why not?
No way does it solve some practical problem where data is dynamically updated.
Sure it does.
A typical example is this newsreader, if one instance is used and newsgroups are
read, it updates article numbers and writes these immediately back to a config file.
If there was an old instance hanging around, and a user starts using that to
get new articles, it will use its own counter in RAM (set to when it last
started or did something) and get the same articles again.
No it won't. If it has a counter in RAM, it also has a lock on the
file. (Remember, the whole point of the lock was to prevent the file
from changing when we needed its contents not to change.) The second
instance would see that the file is locked and abort.
It does not first 'read' all configs before it goes online, it only reads
those at startup.
If it needs those configs not to change, it needs to keep them locked.
This happened a couple of times (old version was hidden behind some other
application) that is why I came up with my solution.
Preventing 2 from running is a better way then a lot of overhead locking
files and loading everything on every keystroke...
It is really easy to start a new instance by accident, as it is under a special
function key.
Hold the lock the whole time the program is running.
DS
.
- Follow-Ups:
- Re: My way to check if a progam is already running
- From: Jan Panteltje
- Re: My way to check if a progam is already running
- References:
- My way to check if a progam is already running
- From: Jan Panteltje
- Re: My way to check if a progam is already running
- From: David Schwartz
- Re: My way to check if a progam is already running
- From: Jan Panteltje
- Re: My way to check if a progam is already running
- From: David Schwartz
- Re: My way to check if a progam is already running
- From: Jan Panteltje
- My way to check if a progam is already running
- Prev by Date: Re: Writing in .text section
- Next by Date: Re: My way to check if a progam is already running
- Previous by thread: Re: My way to check if a progam is already running
- Next by thread: Re: My way to check if a progam is already running
- Index(es):
Relevant Pages
|