Re: Restarting a CWinThread when it is running halfway.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I gave you my suggestions. You could be more-aggressive about killing the
thread, then restarting it on resume, or less-aggressive and doing something
like what I described (suspend the thread, then set the
start-at-the-beginning event/variable, then suspend the device; on restart,
resume the thread and it should, shortly, check the event/variable and start
over). You should know that nothing *every* happens instantaneously....

Paul T.

"Jimmy Lim" <JimmyLim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CB50849E-2C0A-4DCA-9BD5-E4978D2F9D20@xxxxxxxxxxxxxxxx
Hi Paul,

the triggers comes from an interrupt. When this interrupt occurs, i need
to suspend immediately. Before it goes to suspend mode i will suspend my
thread first, Thread A.

After my target has wake up from suspend mode, my monitoring thread will
need to restart Thread A because the operation it is doing half way will
be
invalid.

Do you have any good suggestion?

"Paul G. Tobey [eMVP]" wrote:

No built-in way. I suppose that you could check the value of a global
variable (restartNow), and do something, use an event to trigger this
behavior, etc. You haven't told us *who* is supposed to be triggering
this
restart, so it's a little hard to suggest a very specific approach.

DWORD threadproc( LPVOID param )
{
while ( 1 )
{
WaitForSingleObject( event, INFINITE );
if ( restartNow )
continue;
<do whatever>
}
}

Paul T.


"Jimmy Lim" <JimmyLim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4A979FAA-4ECD-4D5E-B946-499E7B312881@xxxxxxxxxxxxxxxx
Hi All,

I'm currently using WINCE 5.0 for my target device.

In my current application design i have a CWinThread running.

I have a trigger event via interrupt. When the event is trigger, I
need
the CWinThread to stop runnning, initialised and re-start. But i do not
wish
to kill the thread and restart it. Is there anyway to stop the thread
from
running and restart again?





.



Relevant Pages

  • Re: Modifying application folder structure results in application rest
    ... After 15th, application will restart. ... Actually from my experience it does recycle on create/rename sub folder ... aren't supposed to trigger filesystemwatcher behavior...but you're right, ... modifying or deleting global.asax or web.config. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Modifying application folder structure results in application rest
    ... the application will restart. ... Actually from my experience it does recycle on create/rename sub folder event in app_data. ... aren't supposed to trigger filesystemwatcher behavior...but you're right, ... modifying or deleting global.asax or web.config. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Restarting a CWinThread when it is running halfway.
    ... the triggers comes from an interrupt. ... After my target has wake up from suspend mode, ... restart, so it's a little hard to suggest a very specific approach. ... I have a trigger event via interrupt. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Restarting a CWinThread when it is running halfway.
    ... No built-in way. ... restart, so it's a little hard to suggest a very specific approach. ... In my current application design i have a CWinThread running. ... I have a trigger event via interrupt. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Packet loss every 30.999 seconds
    ... adding a few counters there should ... to mind will all significantly increase the overhead of the loop. ... not trigger the problem, but also be high enough to not significantly ... Can you use a placeholder vnode as a place to restart the scan? ...
    (freebsd-stable)