thew00d
asked on
When is multi-threading not multi-threading
I have a VB.NET console application that uses a System.Timers.Timer and monitors a folder using a System.IO.FileSystemWatche r. The timer works fine but stops after having run 25 times or 50 on a multi processor server. This suggests to me that it is hitting the maximum number of threads and then giving up. I'm don't really know anything about multi-threading applications and haven't coded this as multi-threaded but I do use System.Threading.Thread.Sl eep to get the app to pause in several places.
I have also tried swapping the timer to use the System.Threading.Timer but I get the same issue of it stopping after 25 goes.
Anyone out there that can help me sort out me timers?
Thanks, Stu
I have also tried swapping the timer to use the System.Threading.Timer but I get the same issue of it stopping after 25 goes.
Anyone out there that can help me sort out me timers?
Thanks, Stu
ASKER
I realise it would be quite difficult to "accidently" code something multi-threaded :-)
As for the timer, it checks for Zetafax status messages and runs a couple of stored procedures - nothing really
Is there a way to increase or decrease the maximum number of threads per processor - this would then confirm that it is in fact this limit it is hitting for some reason.
What else might cause it to stop firing after 25 runs?
As for the timer, it checks for Zetafax status messages and runs a couple of stored procedures - nothing really
Is there a way to increase or decrease the maximum number of threads per processor - this would then confirm that it is in fact this limit it is hitting for some reason.
What else might cause it to stop firing after 25 runs?
This might sound a little anoying, but you're sure it not you who is disabling the timer?
ASKER
I am definately not disabling the timer - Its absolutely valid to ask - I've checked the code and rechecked for anywhere I may accidently be doing that. That wouldnt explain why it stops after 25 times on my PC and 50 times on a multi-processor PC though...............
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That appears to have worked. Tried it on my PC and it happily went past 25 Timer fires. During each Timer event I had been Disabling and Re-enabling the timer rather than using Stop and Start. Once I've tried the changes on the server I will get back. Thanks to Idle_Mind and RikeR for the comments so far. This problem has been annoying me for months and I've only just had time to try to sort it out.
ASKER
Spot on. Nice one.
If you have not programmed your application to use several threads, it's not multithreaded.
The System.Threading.Thread.Cu
What this timer doind anyway