Re: Raise event inside a thread



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
.



Relevant Pages

  • Re: get the actual size of a file
    ... saying for certain either way:) ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Threading/Locking
    ... Then you stash the data in an ordered list which is then processed by ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to trigger other thread
    ... updates are "seen" or not. ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: MemoryStream.Write() Offset cannot be zero
    ... a file - it's just like that, except it all stays in memory. ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.framework)
  • Re: read text file
    ... You've provided some code which doesn't quite compile and isn't ... but which looks like it's a reasonable stab at a solution. ... Jon Skeet - ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.languages.csharp)