I have a non-ui application which runs as a service.
Currently the application includes a web server (jServer) but this isnt required anymore so I would like to remove it from the project BUT I have a number of BackgroundWorkers configured to perform some tasks and I was considering changing these to be Timers.
Would there be any issues running Timers instead of BackgroundWorkers? The BackgroundWorkers run on different intervals but may on occasion run at the same time.
Are timers run in their own thread? I suspect not as I'd need to create them in the main thread?
I did read the thread below but it wasnt exaclty clear as the OP was asking about running 1000 timers and @Erel suggested using BackgroundWorkers.
Currently the application includes a web server (jServer) but this isnt required anymore so I would like to remove it from the project BUT I have a number of BackgroundWorkers configured to perform some tasks and I was considering changing these to be Timers.
Would there be any issues running Timers instead of BackgroundWorkers? The BackgroundWorkers run on different intervals but may on occasion run at the same time.
Are timers run in their own thread? I suspect not as I'd need to create them in the main thread?
I did read the thread below but it wasnt exaclty clear as the OP was asking about running 1000 timers and @Erel suggested using BackgroundWorkers.
B4J server & timers
Can I have problems if I start many timers (500 or 1000, I hope :)) in the main thread? I'm thinking to create a class containing a timer and I could have 1000 instances of this class. Usually the timer interval will be set to 20,000 ms. Thank you
www.b4x.com
Last edited: