John,

  I've used option #1 as a more simplistic approach to this type of thing.
To avoid the problem you mentioned, I use an OS semaphore to indicate that
the program is running.  It sets the semaphore, pauses, then checks that it
has the only semaphore set.  If so, it continues.  If not, execution ends.
I got this code from a Fox Talk issue. Pretty handy - even ported it to VBA
for my Access apps.  It lets me control whether or not I want multiple
instances of an application running on a station, alerting the user, and
switching to the already running instance if only one instance is allowed.

  I then use the MS scheduler to launch the app.  This allows the app to be
launched on a schedule or manually if need be with different command line
arguments.

  Drawback of course is that your continually starting/stopping the app so
there is some overhead there. Of course it also wipes the slate clean each
time, which on occasion has worked in my favor<g>.

Jim.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John Weller
Sent: Monday, December 18, 2006 5:43 PM
To: [EMAIL PROTECTED]
Subject: Polling App

Hi Guys,

I have to write a small utility that will check for the presence of a file
or files in a particular folder every 5 minutes or so.  If any are there it
does some processing on them.  It will probably run on the server.  As I see
it there are two ways I can go:

1.      Have a program that runs every 5 minutes triggered by scheduler.
Snag
arises if the processing takes more than 5 minutes (which could possibly
happen in the future).

2.      Run the program continuously in a loop which will process the files
then
go to sleep for 5 minutes (using the API Sleep function).  Question - will
this absorb much in the way of resources?  I've found the Fox to be very
fast but a resource hog.

Any comments or suggestions of a better way will be gratefully received - I
see no benefit in re-inventing the wheel if someone has already tried
something similar.

TIA

John Weller
01380 723235
07976 393631



[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to