By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,566 Members | 1,734 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,566 IT Pros & Developers. It's quick & easy.

Forms.Timer - multithreaded?

P: n/a
Hi,

Does the System.Windows.Forms.Timer invoke the main form thread? Or does it
start another thread so that I need to lock my objects on which it operates
in case the user of the program saves data while the Timer updates data.

regards Jesper.
Jul 13 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Sun, 13 Jul 2008 05:51:00 -0700, Jesper, Denmark
<Je***********@discussions.microsoft.comwrote:
Does the System.Windows.Forms.Timer invoke the main form thread? Or does
it
start another thread so that I need to lock my objects on which it
operates
in case the user of the program saves data while the Timer updates data.
From the main documentation page for the class: "This Windows timer is
designed for a single-threaded environment where UI threads are used to
perform processing"
Jul 13 '08 #2

P: n/a
Works on the form's thread.

Pete
Jul 13 '08 #3

P: n/a
Peter Morris wrote:
Works on the form's thread.
.... in contrast to System.Threading.Timer or System.Timers.Timer which both
raise their timing events on a worker thread. Getting the timing events in
the UI thread is the sole reason for the existence of
System.Windows.Forms.Timer.

-cd
Jul 14 '08 #4

P: n/a
Jesper,

First things first, you are violating the concept of timer by thinking to
execute that on a multi thread. thus it is not at all a practice to run the
timer on multi thread

Think once again.
"Jesper, Denmark" <Je***********@discussions.microsoft.comwrote in message
news:0E**********************************@microsof t.com...
Hi,

Does the System.Windows.Forms.Timer invoke the main form thread? Or does
it
start another thread so that I need to lock my objects on which it
operates
in case the user of the program saves data while the Timer updates data.

regards Jesper.

Jul 14 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.