Hi Nicholas,
Is there some mechanism like callback that can be implemented, so that
when the secondary thread detects some kind of failure (when it makes its
method calls), it calls back a method running on the primary thread. That
callback method could set an event (Synchronization object) asking the
secondary thread to exit or perform other actions.
Can events and Delegates be used for the same? I am not sure if they can be
used in this scenario.
"Nicholas Paldino [.NET/C# MVP]" wrote:
Tim,
The only way to do things like this is to have the thread running in a
loop of some sort, and then set the state that is checked in each iteration
of the loop to see if something happened. This is what is acheived in
Windows Forms, when a call has to be made to the UI thread (through windows
messages).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com... The are 2 threads - main thread and worker thread. The main thread
creates the worker thread and then the worker thread runs in an infinite
while loop till it is asked to exit by setting an event. The worker thread
instantiates an object and calls methods of that object. If some method
call
fails, the main thread needs to be notified about the failure. What
mechanisms exist for notifying the main thread about the worker thread's
status - for example - 'a method call failed'?