I have had this issue before and a check around the groups shows a few other
people have had this problem too with no real resolution.

I have a class that performs actions. These actions are performed
multi-threaded via a ThreadStart in the Main Form.
The method that performs this is in a while loop that never exits unless the
form exits. It will sleep for 30 seconds after it has performed its action
and then it will cycle through the loop again.

This works fine and dandy but it seems that if the application does not have
focus after multiple executions the thread goes to sleep and never wakes up.
This randomly happens after about 30-60 minutes of running in the
background.
I am wondering if anybody else has ever experienced this problem and
whether there were any fixes that they had come up with.

Re: Thread never wakes up again if Application does not have focus by Calvin

Calvin
Sat Mar 05 11:22:43 CST 2005

This is a multi-part message in MIME format.

------=_NextPart_000_00A0_01C52164.E310C360
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Dear Recoil,

How many threads are we talking about? I would suggest using a thread =
pool which sounds like you are ultimately trying to do.=20

=20
-Calvin Luttrell
ProjectThunder.com, Inc.
nothing is impossible


>I have had this issue before and a check around the groups shows a few =
other=20
> people have had this problem too with no real resolution.
>=20
> I have a class that performs actions. These actions are performed=20
> multi-threaded via a ThreadStart in the Main Form.
> The method that performs this is in a while loop that never exits =
unless the=20
> form exits. It will sleep for 30 seconds after it has performed its =
action=20
> and then it will cycle through the loop again.
>=20
> This works fine and dandy but it seems that if the application does =
not have=20
> focus after multiple executions the thread goes to sleep and never =
wakes up.=20
> This randomly happens after about 30-60 minutes of running in the=20
> background.
> I am wondering if anybody else has ever experienced this problem =
and=20
> whether there were any fixes that they had come up with.=20

------=_NextPart_000_00A0_01C52164.E310C360
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2604" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Dear Recoil,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>How many threads are we talking about? =
I would=20
suggest using a thread pool which sounds like you are ultimately trying =
to do.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</FONT>
<DIV><FONT face=3DArial size=3D2>-Calvin Luttrell</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.projectthunder.com">ProjectThunder.com</A>, =
Inc.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.projectthunder.com/dotnetforums/">nothing is=20
impossible</A></FONT></DIV></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV><FONT face=3DArial =
size=3D2>&gt;I=20
have had this issue before and a check around the groups shows a few =
other=20
<BR>&gt; people have had this problem too with no real =
resolution.<BR>&gt;=20
<BR>&gt; I have a class that performs actions. These actions are =
performed=20
<BR>&gt; multi-threaded via a ThreadStart in the Main Form.<BR>&gt; The =
method=20
that performs this is in a while loop that never exits unless the =
<BR>&gt; form=20
exits. It will sleep for 30 seconds after it has performed its action =
<BR>&gt;=20
and then it will cycle through the loop again.<BR>&gt; <BR>&gt; This =
works fine=20
and dandy but it seems that if the application does not have <BR>&gt; =
focus=20
after multiple executions the thread goes to sleep and never wakes up. =
<BR>&gt;=20
This randomly happens after about 30-60 minutes of running in the =
<BR>&gt;=20
background.<BR>&gt;&nbsp;&nbsp;&nbsp; I am wondering if anybody else has =
ever=20
experienced this problem and <BR>&gt; whether there were any fixes that =
they had=20
come up with. <BR></FONT></BODY></HTML>

------=_NextPart_000_00A0_01C52164.E310C360--


RE: Thread never wakes up again if Application does not have focus by v-phuang

v-phuang
Mon Mar 07 03:54:10 CST 2005

Hi

In addition to Calvin's suggestion, can you post a simple reproduce sample,
so that we can investigate the issue.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.