The thread is a shared method and to resolve this issue I have added a
shared variable that holds the callback address. In the design of my
application this works just fine since there is only a single thread
instance running at once.
Thanks to those who replied,
Sid.
"TrtnJohn" <Tr******@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
Threads can Raise Events. Just be aware that the event handler in the
monitoring class will be running in the secondary thread so it should only
do
thread-safe operations. If you need to access UI elements from the
secondary
thread or in the event handler, you will need to marshal the call back to
the
UI thread using the Control.Invoke method of the UI element you wish to
update.
"si******@softtools.com" wrote:
Hello,
I have a worker thread ( a shared method in a class) that needs to
callback
to another (monitoring) class on certain events. I have been unable to
figure out how to pass the callback address of a delegate in the
monitoring
class to the thread. Could someone please point me to a sample or give a
few
clues. I have tried to use TLS but can't figure out how to send the
result
of the "address of" operator and then recover it by using SetData and
GetData.
Thanks,
Sid.