all groups > dotnet myservices > october 2004 >
You're in the

dotnet myservices

group:

timed operation in a service


timed operation in a service uri NO[at]SPAM ebeat.co.il
10/31/2004 7:06:59 AM
dotnet myservices:
Hi,
i have an operation which i need to do every x minutes.
i thought about 2 options:

the first is to do a loop, in the loop do the operation and then sleep
for x minutes.

the second option is to create a timer with a callback function so
that the function will be called every x minutes.

which option is bettr ?

Re: timed operation in a service Lee Gillie
11/2/2004 12:45:54 PM
I've done it both ways and see no clear generic advantage.
With the callback, if there is any chance you can not complete
processing in x minutes, then you run a risk of multiple threads
executing, but then you get more regular event triggering, whereas with
the sleep it occurs x minutes + y minutes where y is the amount of time
to process. Got a coin to flip?

Lee

[quoted text, click to view]
AddThis Social Bookmark Button