471,342 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Forms.Timer - multithreaded?

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
4 1518
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
Works on the form's thread.

Pete
Jul 13 '08 #3
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
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.

Similar topics

2 posts views Thread by Michael Evans | last post: by
15 posts views Thread by Joshua Kendall | last post: by
14 posts views Thread by Mathieu | last post: by
8 posts views Thread by =?Utf-8?B?RGF2ZQ==?= | last post: by
4 posts views Thread by =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post: by
reply views Thread by rosydwin | last post: by

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.