473,378 Members | 1,621 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,378 software developers and data experts.

Timers run on the creating thread?

Do timers run on the same thread that creates them or (internally) a
new thread is spawned per timer?

Jul 11 '06 #1
4 1017
Water Cooler v2 wrote:
Do timers run on the same thread that creates them or (internally) a
new thread is spawned per timer?
It depends on which Timer you are referring to. If it is the Timer
within System.Windows.Forms, then it'll run on the UI thread. If it's
the Timer within System.Threading, then I believe it runs in another
thread. Whether this thread is newly created, or from the thread pool,
or from some internal pool, I'm not sure. But I'm fairly certain it
won't be the original thread. After all, the original thread has
carried on, and could be in any state when the timer elapses (e.g. it
might be in the middle of a multi-second database call)

Damien

Jul 11 '06 #2
The System.Threading timer events are executed from a Thread Pool thread.

Mike Ober.

"Damien" <Da*******************@hotmail.comwrote in message
news:11*********************@s13g2000cwa.googlegro ups.com...
Water Cooler v2 wrote:
Do timers run on the same thread that creates them or (internally) a
new thread is spawned per timer?

It depends on which Timer you are referring to. If it is the Timer
within System.Windows.Forms, then it'll run on the UI thread. If it's
the Timer within System.Threading, then I believe it runs in another
thread. Whether this thread is newly created, or from the thread pool,
or from some internal pool, I'm not sure. But I'm fairly certain it
won't be the original thread. After all, the original thread has
carried on, and could be in any state when the timer elapses (e.g. it
might be in the middle of a multi-second database call)

Damien



Jul 12 '06 #3
Which thread will receive the event then for the System.Threading timer.
--
Dennis in Houston
"Michael D. Ober" wrote:
The System.Threading timer events are executed from a Thread Pool thread.

Mike Ober.

"Damien" <Da*******************@hotmail.comwrote in message
news:11*********************@s13g2000cwa.googlegro ups.com...
Water Cooler v2 wrote:
Do timers run on the same thread that creates them or (internally) a
new thread is spawned per timer?
It depends on which Timer you are referring to. If it is the Timer
within System.Windows.Forms, then it'll run on the UI thread. If it's
the Timer within System.Threading, then I believe it runs in another
thread. Whether this thread is newly created, or from the thread pool,
or from some internal pool, I'm not sure. But I'm fairly certain it
won't be the original thread. After all, the original thread has
carried on, and could be in any state when the timer elapses (e.g. it
might be in the middle of a multi-second database call)

Damien

Jul 13 '06 #4
The callback is run on a ThreadPool thread. What event are you referring
to? tia

--
William Stacey [MVP]

"Dennis" <De****@discussions.microsoft.comwrote in message
news:1F**********************************@microsof t.com...
| Which thread will receive the event then for the System.Threading timer.
| --
| Dennis in Houston
|
|
| "Michael D. Ober" wrote:
|
| The System.Threading timer events are executed from a Thread Pool
thread.
| >
| Mike Ober.
| >
| "Damien" <Da*******************@hotmail.comwrote in message
| news:11*********************@s13g2000cwa.googlegro ups.com...
| Water Cooler v2 wrote:
| Do timers run on the same thread that creates them or (internally) a
| new thread is spawned per timer?
|
| It depends on which Timer you are referring to. If it is the Timer
| within System.Windows.Forms, then it'll run on the UI thread. If it's
| the Timer within System.Threading, then I believe it runs in another
| thread. Whether this thread is newly created, or from the thread pool,
| or from some internal pool, I'm not sure. But I'm fairly certain it
| won't be the original thread. After all, the original thread has
| carried on, and could be in any state when the timer elapses (e.g. it
| might be in the middle of a multi-second database call)
|
| Damien
|
|
| >
| >
| >
| >
Jul 14 '06 #5

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

Similar topics

9
by: Mark Rae | last post by:
Hi, I've seen several articles about using System Timers in ASP.NET solutions, specifically setting them up in Global.asax' Application_OnStart event. I'm thinking about the scenario where I...
4
by: Water Cooler v2 | last post by:
Do timers run on the same thread that creates them or (internally) a new thread is spawned per timer?
4
by: Water Cooler v2 | last post by:
Do timers run on the same thread that creates them or (internally) a new thread is spawned per timer?
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.