0

I am developing a windows service that takes some invoices from and database and process them.. The service is scheduled to run every 10 minutes.

But the problem is that it starts a new thread after every 10 minutes even though previous process has not completed yet.

Is it possible to schedule windows service in a way that it runs after every few minutes but only if it is NOT running already (like in windows task scheduler)?

I have scheduled my windows service as shown in following link: https://www.aspsnippets.com/Articles/Repeat-Task-every-N-interval-using-Windows-Service-in-C-and-VBNet.aspx

mrd
  • 2,095
  • 6
  • 23
  • 48
  • Use process class to see if executable is running. – jdweng Nov 30 '18 at 13:39
  • Do you want the task to be deferred until the previous task is complete, or just skip an occurrence? – Nathan Werry Nov 30 '18 at 13:40
  • @NathanWerry: I want to run the process if it is NOT running already. – mrd Nov 30 '18 at 13:42
  • Just add a flag that task is running and do not schedule next task until it is running? – Renatas M. Nov 30 '18 at 13:45
  • Possible duplicate of [How to check if another instance of the application is running](https://stackoverflow.com/questions/6392031/how-to-check-if-another-instance-of-the-application-is-running) – Nathan Werry Nov 30 '18 at 14:43
  • Does right-clicking on the project name to bring up a window and then clicking on `Make a single instance application` not work? – David Wilson Dec 06 '18 at 13:30

0 Answers0