Re: WaitForSingleObject() failing?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Fri, 06 Jan 2006 10:39:11 -0500
Not really. I have eliminated any need to wait for threads by handling app exit
asynchronously. I rarely keep track of CWinThread objects, using other means of doing
shutdowns.
joe
On Thu, 5 Jan 2006 20:40:27 -0800, "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx> wrote:
>You may have to wait for the thread if you want to exit the app (or delete
>the objects it uses) before the thread finishes by itself.
>It's always a good idea to keep track of the thread(s), to allow graceful
>shutdown of those.
>
>"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
>news:j39rr152gtuhr11jv36fevc1stdfu0l2fc@xxxxxxxxxx
>> ****
>> And how does this change the fundamental problem? The fundamental problem
>> is that to do
>> what you are trying to do, you MUST create the thread suspended, set its
>> m_bAutoDelete
>> flag to FALSE, and then resume the thread. However, a simpler solution is
>> to ignore this
>> entirely. You don't need to save the CWinThread object for the first
>> thread; just do as I
>> suggested, and have the termination of the thread PostMessage a request to
>> start the
>> second thread. Lose the WaitForSingleObject *entirely*, as it represents
>> an untenable
>> programming style.
>> *****
>
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: WaitForSingleObject() failing?
- From: Doug Harrison [MVP]
- Re: WaitForSingleObject() failing?
- References:
- WaitForSingleObject() failing?
- From: Davinder
- Re: WaitForSingleObject() failing?
- From: Davinder
- Re: WaitForSingleObject() failing?
- From: Joseph M . Newcomer
- Re: WaitForSingleObject() failing?
- From: Alexander Grigoriev
- WaitForSingleObject() failing?
- Prev by Date: Re: make process invisible
- Next by Date: Re: How to change the font while window is loaded.. ??
- Previous by thread: Re: WaitForSingleObject() failing?
- Next by thread: Re: WaitForSingleObject() failing?
- Index(es):
Loading