Re: Restarting a CWinThread when it is running halfway.
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Wed, 5 Nov 2008 08:29:38 -0700
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?
.
- References:
- Restarting a CWinThread when it is running halfway.
- From: Jimmy Lim
- Re: Restarting a CWinThread when it is running halfway.
- From: Paul G. Tobey [eMVP]
- Re: Restarting a CWinThread when it is running halfway.
- From: Jimmy Lim
- Restarting a CWinThread when it is running halfway.
- Prev by Date: Re: Call DLL without knowing arguments
- Next by Date: Speed of DrawText()
- Previous by thread: Re: Restarting a CWinThread when it is running halfway.
- Next by thread: IOCTL_DISK_READ please help how to call this
- Index(es):
Relevant Pages
|