Hi Jeroen
Thx for your answer. It sounds logic and it seems to work. All four timers
now working for above 15 minutes.
Can I remove the Lock statement from my OnTimedEvent method? All four timers
are running nearly at the same time. Every minute with a few milliseconds
difference.
thx
Björn
> > Hi,
> > I have problems using the timer object in a C# Windows Service
[quoted text clipped - 29 lines]
>
> Jeroen Vandezande
Jeroen Vandezande - 17 Jan 2006 13:52 GMT
> Hi Jeroen
>
[quoted text clipped - 5 lines]
> are running nearly at the same time. Every minute with a few milliseconds
> difference.
I don't really know... As far as I know the Event of the timers is fired in
the main thread...
So I am not sure if they can run at the same time, I think he does them one
at a time...
Maybe someone else can help out here... I would like to know too.
Best Regards,
Jeroen Vandezande
Daniel O'Connell [C# MVP] - 17 Jan 2006 14:00 GMT
> Hi Jeroen
>
[quoted text clipped - 5 lines]
> are running nearly at the same time. Every minute with a few milliseconds
> difference.
What does the code inside of the lock do? If the code isn't writing to any
common fields or properties and not calling methods that do so, you don't
need the lock. If you are doing writes to anything that isn't private to the
method you will probably have to use a lock, although perhaps not at the
granularity you are currently using.
> thx
>
[quoted text clipped - 36 lines]
>>
>> Jeroen Vandezande
Björn - 17 Jan 2006 14:08 GMT
Hi
The code inside the lock search a private static collection for data, than
calls another method which makes a select to a ms sql server. If the select
returns data a Webservice is called by a Proxy class which is loaded
dynamical.
I believe I will continue using the lock statement, so I can´t run in
trouble.
Björn
> > Hi Jeroen
> >
[quoted text clipped - 52 lines]
> >>
> >> Jeroen Vandezande