473,385 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

System.Threading.Timer - A few questions

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

Nov 17 '05 #1
2 2161
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]
- mv*@spam.guard.caspershouse.com

"steve" <st***@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
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

Nov 17 '05 #2
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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"steve" <st***@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
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


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ELO | last post by:
Hi all Every week, I need to get two files on a remote server. I have developped a C# Windows Service with two System.Threading.Timer to do this task For the first one, the delay (TimeSpan...
4
by: Hagay Lupesko | last post by:
Hi, I've encountered a strange phenomena which appears to me as a bug: I have an engine that uses a System.Threading.Timer to invoke a delegate every X minutes. The code looks something...
1
by: Can Balioglu | last post by:
Hi, I don't know if it's already known but I found a bug in System.Timers.Timer class. The 'Interval' property accepts a double which specifies the interval between two 'Elapsed' events. The...
1
by: Tom | last post by:
I've googled, and read, and stripped out code, and rewritten code, and still can't get a System.Threading.Timer to work. (I hereby publicly admit that I'm a failure here...) Could someone please...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
2
by: linesh.gajera | last post by:
Hi Guys, I am creating a Windows service that call a routine at given interval. Once routine is complete, windows service should wait for 5 minutes and then call the routine again. I was using...
2
by: User | last post by:
Hi, What is the best way to release all resources holded by the Timer (myTimer from class System.Timers.Timer)? Is it: 1- myTimer.dispose 2- myTimer.enabled = false 3- myTimer.close
4
by: Lauren Quantrell | last post by:
I have just put together a vb.net app and now need to provide it to users. This application needs to run the code in a sub every 60 seconds from a Windows Service application. I have the...
4
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.