Re: My way to check if a progam is already running



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

.



Relevant Pages

  • Re: SetPixel() / GetPixel() for Format64bppArgb in VB using LockBits
    ... A performance boost can probably be had if you only lock the one pixel of ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Historical operation of canals in Holland during the 1600s
    ... I had searched wikipedia but your link got me to articles I hadn't found. ... I've not found direct answers to my questions for Amsterdam but I have learned that canal and lock technology was very sophisticated by 1600. ... the operation is much different--there is no tidal swing at Amsterdam because the Zuiderzee is diked off and pumps are used to exchange water in the canals. ...
    (sci.geo.hydrology)
  • Re: Locking techniques
    ... > There is a MSR publication that seems to approve the use of lockin ... possibility that other code will lock on the same reference. ... I'm sure there are plenty of articles which use lock- but there ... Personally I think it was a mistake making all reference types have ...
    (microsoft.public.dotnet.languages.csharp)
  • Test with 2 Users: Button value changes automatic
    ... I have a strange behaviour. ... with articles that have to be produced today or the ... Now it can be, that the planner has ... the possiblity to lock it with a button called "lock", ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: path information
    ... > XML based config file and then read other configuration information from ... > Find great Windows Forms articles in Windows Forms Tips and Tricks ... > Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)