Folks,
Im reading through MSDN on threading and timers. Looking at the System.Timers.Timer it has a synchronizationObject and says
"Gets or sets the object used to marshal event-handler calls that are issued when an interval has elapsed."
and
"If you use the Timer with a user interface element, such as a form or control, without placing the timer on that user interface element, assign the form or control that contains the Timer to the SynchronizingObject property, so that the event is marshaled to the user interface thread."
But I do not understand if or how it should be set when interacting with other, non-UI, things, such as other threads or objects
A) In the case described in the quote would a correct example be the following?
B) How should I set it if the timer elapsed event creates a new thread or performs some action with another thread or with some (non-UI) object?
Basically Im not really understanding what is meant by the phrase "the object used to marshal event-handler calls that are issued".... Im going back to read up on marshalling now but any help would be good as MSDN is not the best place to learn from scratch.
C) What type of thread is the timer or its elapsed event run on? ThreadPool?
Thanks
Im reading through MSDN on threading and timers. Looking at the System.Timers.Timer it has a synchronizationObject and says
"Gets or sets the object used to marshal event-handler calls that are issued when an interval has elapsed."
and
"If you use the Timer with a user interface element, such as a form or control, without placing the timer on that user interface element, assign the form or control that contains the Timer to the SynchronizingObject property, so that the event is marshaled to the user interface thread."
But I do not understand if or how it should be set when interacting with other, non-UI, things, such as other threads or objects
A) In the case described in the quote would a correct example be the following?
vb Code:
Sub CreateTimer () '.... aTimer = New System.Timers.Timer(10000) aTimer.SynchronizingObject = myForm1 '... End Sub
B) How should I set it if the timer elapsed event creates a new thread or performs some action with another thread or with some (non-UI) object?
Basically Im not really understanding what is meant by the phrase "the object used to marshal event-handler calls that are issued".... Im going back to read up on marshalling now but any help would be good as MSDN is not the best place to learn from scratch.
C) What type of thread is the timer or its elapsed event run on? ThreadPool?
Thanks