RE: Thread handle & synchronization
- From: John <aacdio@xxxxxxxxxxxxx>
- Date: Mon, 5 Nov 2007 09:05:05 -0800
Hi Jeffrey,
I want to creat custom thread pool so I can start next thread when some
active thread from pool goes sleep or finishes its execution - I can not
modify logic in threads which will be added to thread pool.
There has to be some way how to know that thread sleeps because Windows
switch execution to new thread when active thread fall asleep ... - or this
is not possible to find out in C# ?
Thank you.
""Jeffrey Tan[MSFT]"" wrote:
Hi,.
Can you tell me why do you want to wait on the thread handle? The thread
handle will only signal when the thread terminates. If this is what you
wanted to know, why don't you call Thread.Join() method to wait on the
thread object until the thread terminates?
Thread handle will not signal while enterring sleep state. Also, I do not
think there is any notification for Thread.Sleep(). I would recommend you
to use AutoResetEvent for this notification/synchronization task. That is,
you may set AutoResetEvent before calling Thread.Sleep(). This will notify
other threads of the Thread.Sleep() calling. Another solution is polling
the thread state as Pete stated.
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- Re: Thread handle & synchronization
- From: Peter Duniho
- Re: Thread handle & synchronization
- References:
- Thread handle & synchronization
- From: John
- RE: Thread handle & synchronization
- From: "Jeffrey Tan[MSFT]"
- Thread handle & synchronization
- Prev by Date: Re: process exit event and thread synchronization
- Next by Date: Re: Thread handle & synchronization
- Previous by thread: RE: Thread handle & synchronization
- Next by thread: Re: Thread handle & synchronization
- Index(es):
Relevant Pages
|