How to let Timer skip tick if the previous thread is still busy

后端 未结 8 1681
攒了一身酷
攒了一身酷 2020-12-01 11:28

I created a windows service, that is supposed to check a certain table in the db for new rows every 60 seconds. For every new row that was added, I need to do some heavy pro

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 11:39

    I recommend you don't let the timer tick at all while its processing.

    Set the Timers AutoReset to false. And start it at the end. Here's a full answer you might be interested in Needed: A Windows Service That Executes Jobs from a Job Queue in a DB; Wanted: Example Code

提交回复
热议问题