Re: Thread A notifying Thread B of an Event

From: Bob Day (BobDay_at_TouchTalk.net)
Date: 02/20/04


Date: Fri, 20 Feb 2004 18:26:04 -0500

Thanks for your help, but I am afraid I am going to need far more
explaination. I have played with your comments for some time now, and
cannot get them to work in any meaningful way.

I have no problem with Raising an event that is caught higher up in the call
stack. But raising an event in one thread caught by a 2nd thread handler
simply isn't working as expected.

Question: If thead A raises an event caught by thread B, I would expect the
delgate to be running on thread B . But debug inidcates that thread A is
running the delagate on thread B. Is this correct? This will present a
host of problems.

Can you reference a URL or more detailed areticles on this issue? I have
searched MSDN, and have not come up with sample code or a good explaination.
Any type of sample code the works would be appreciated.

Thanks!

Bob

"Bob Day" <BobDay@TouchTalk.net> wrote in message
news:ubnnMT%239DHA.1504@TK2MSFTNGP12.phx.gbl...
> Using VS 2003, VB, MSDE...
>
> There are two threads, A & B, that continously run and are started by Sub
> Main. They instantiationsl of identical code. Thread A handles call
> activity on telephone line 1 and Thread B handles call activity on
telephone
> line 2. They use a common SQL datasource, but all DataSets are unique to
> each thread.
>
> Is there a way for thread A to occasionally communication to thread B that
> something has happened? The ideal situation would be for thread A to
raise
> an event that a handler in thread B handles. But, I don't see how to do
> that (the raised event would be handled "up the call stack" in Sub Main,
not
> "horizontially" by the other thread).
>
> Specifically, thread A has added a row(s) to the common datasource that I
> need thread B to know about. I am currently doing it with a timer in
thread
> B that check the common datasource for changes every 15 seconds, which
works
> OK, but am looking for a simpler solution. I have looked at SQL
triggers,
> but don't see how that would alert thread B. I have looked at RaseEvents,
> but don't see any help there either.
>
> Any ideas? Do System.Timers. exert a heavy resource usage toll? If not I
> may jus stick with the timer method.
>
> Thansk!
>
> Bob
>
>


Loading