On Thu, 26 Sep 2019 23:25:45 +0200, Bart via lazarus
<lazarus@lists.lazarus-ide.org> wrote:

>On Thu, Sep 26, 2019 at 11:16 PM Bo Berglund via lazarus
><lazarus@lists.lazarus-ide.org> wrote:
>
>> If the measure process takes longer than until the next cron
>> invocation due to some extra delays in that particular process, then I
>> don't want the new instance of the scheduler to start another task.
>> The reason is that the hardware is occupied.
>>
>> Instead I want the new instance to just exit or else go into some wait
>> loop until the first instance quits.
>
>UniqueInstance?
>https://wiki.freepascal.org/UniqueInstance

Hi Bart,
thanks, this seems like a good solution!
I have now tested it on a GUI app by putting it into the lpr file at
the very beginning:

uses
  ....
  uniqueinstanceraw;

{$R *.res}

begin
  if InstanceRunning('myidentifier') then exit;
  Application.Initialize;

Worked straight out of the box!

Now I just have to check that it works also for a console program,
which means I have to create two terminals and start it in one and
then try to start also in the other.


-- 
Bo Berglund
Developer in Sweden

-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to