Re: Raise event inside a thread
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Tue, 5 Jul 2005 06:31:57 +0100
Waleed AlRashoud <WaleedAlRashoud@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> I tested ur work with this addition, to chcek if event is cathed by main
> thread [ as 'A' ] or in other new thread [ as 'X' ].
> in [Test.cs] , I added these lines inside [static void TestThreadPool() ]
> /// Start
> pool.AfterWorkItem += new AfterWorkItmeHandler(Pool_After);
> Console.WriteLine("Main Thread ID " +
> Thread.currentThread.ManagedThreadId.ToString();
> /// End
>
> Then I created new static void method [Pool_After(... ,...) ] and wrote:
> ///Start
> Console.WriteLine("Event Catched By " +
> Thread.currentThread.ManagedThreadId.ToString());
> ///End
>
> This is Output:
> /// Start Output
> Main Thread ID 9
> Event Catched By 11
> /// End output
>
> So! event not catched by main Thread!
No.
> Is it a mistake I did using CustomThreadPool , Or threads not raiseing
> events inside main thread?
No, they can't be. The point was that you can signal to the main thread
within the event, using monitors or a ManualResetEvent.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
- References:
- Raise event inside a thread
- From: Waleed AlRashoud
- Re: Raise event inside a thread
- From: Jon Skeet [C# MVP]
- Re: Raise event inside a thread
- From: Waleed AlRashoud
- Re: Raise event inside a thread
- From: Jon Skeet [C# MVP]
- Re: Raise event inside a thread
- From: Waleed AlRashoud
- Raise event inside a thread
- Prev by Date: RE: Ole DB Update failing - Solved
- Next by Date: Re: New versions vs. serialization
- Previous by thread: Re: Raise event inside a thread
- Next by thread: Not too hapy with this code snippet
- Index(es):
Relevant Pages
|