c# - How many threads (timers) can I launch using System.Threading.Timer from one thread? -


i in c# .net 3.5. seems, registering more 10 system.threading.timers same thread causes first ones die off somehow... can't believe though. if true, i'd more shocked.

here line, start timer, each time new message arrives:

system.threading.timer tmr = new system.threading.timer(waitackelapsedtmrhandler, msgid, constants.time_to_wait_for_ack, timeout.infinite); 

what else problem ? believe have locked thread shared resources , log in , outs to/from locked zones -> can't see deadlocks.

how can detect deadlock in such case ?

system.threading.timer can garbage collected if not keep reference alive. after 10 messages appears gc kicks in , kills off timers.

switch different timer not garbage collected system.timers.timer or keep kind of reference timer instead of letting variable go out of scope , program should work.

see this question more in-depth explanation why system.timers.timer survive gc system.threading.timer not.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -