creating delphi timers dynamically at runtime (performance, cpu consuming) -


in current project have structure this:

main thread (gui): ->parser thread ->healer thread ->scripts thread 

the problem healer & scripts threads have create childthreads appropiate timer, this:

->parser thread ->healer thread: -->healer 1 -->healer 2 --> (...)  ->scripts thread: -->script 1 --> (...) 

for doing have thought coding dynamically timer created @ runtime when new heal/script added.

now problem/question is: maybe have 20 timers runing @ same time because of this, wouldn't problem program performance (cpu consuming, etc)? best way achieve i'm looking for?

thanks in advance

there's no problem having 20 timers active @ 1 time in application. modern hardware more capable of handling that.

remember timer messages low priority messages , synthesised when message queue empty. so, need keep message queues of threads serviced promptly in order messages delivered in timely manner.

a bigger problem you cannot create ttimer instances outside gui/vcl thread. that's because timer component calls allocatehwnd not thread safe , can called gui/vcl thread. so, you'll need interact raw win32 timer api directly , not use vcl ttimer wrapper.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -