System.Threading.Timer - A few questions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Since System.Threading.Timer uses the threadpool to do its stuff what happens
when

(a) You try to create a timer and the thread pool is *exhausted*
(b) The timer is due to fire AND all threads in the threadpool are blocked
(deadlocked maybe)?

As a followup qn to this.. (please excuse my ignorance here) Is there one
threadpool per process or one threadpool for the *virtual machine* (ie
runtime environment, sorry haven't got a diploma in .net three letter
acronyms ; )

Cheers,

-- Steve
 
Steve,

When you create a timer, it doesn't actually do anything. The
threadpool is used only when the timer is calling back

When you say the thread pool is exhausted, do you mean all the threads
are currently running or they are all in deadlock? Like any other task that
gets put into the thread pool when all available threads are running, the
task is queued, and it waits for an open thread before it is processed.

If the timer is due to fire, and all of the threads are deadlocked, then
you have bigger issues.

What are you trying to acheive here?
 
Thanks Nicholas,

The motivation behind the question is..

If I use a threading.timer for regular short repetitive actions (ie reading
a FIFO exposed by and FPGA on USB connected hardware), are there any
circumstances when the timer will not fire.

(a) Is it possible for a threading.timer NOT to fire? (ans. yes ==> all
threadpool threads deadlocked)
(b) What happens if it doesn't fire? Don't know. Exceptions?
(c) Are there any metrics on timing jitter as a function of threadpool
loading?

Cheers

-- Steve

Nicholas Paldino said:
Steve,

When you create a timer, it doesn't actually do anything. The
threadpool is used only when the timer is calling back

When you say the thread pool is exhausted, do you mean all the threads
are currently running or they are all in deadlock? Like any other task that
gets put into the thread pool when all available threads are running, the
task is queued, and it waits for an open thread before it is processed.

If the timer is due to fire, and all of the threads are deadlocked, then
you have bigger issues.

What are you trying to acheive here?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

steve said:
Since System.Threading.Timer uses the threadpool to do its stuff what
happens
when

(a) You try to create a timer and the thread pool is *exhausted*
(b) The timer is due to fire AND all threads in the threadpool are blocked
(deadlocked maybe)?

As a followup qn to this.. (please excuse my ignorance here) Is there one
threadpool per process or one threadpool for the *virtual machine* (ie
runtime environment, sorry haven't got a diploma in .net three letter
acronyms ; )

Cheers,

-- Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top