Re: WaitForSingleObject() failing?
- From: Walter Eicher <walter.eicher@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 04 Jan 2006 15:26:42 +0100
Hi Scott,
On Wed, 04 Jan 2006 08:22:45 -0500, "Scott McPhillips [MVP]"
<org-dot-mvps-at-scottmcp> wrote:
> It is safer to create the thread with CREATE_SUSPENDED, then
>do pWorkerThread->m_bAutoDelete = FALSE, then
>pWorkerThread->ResumeThread().
Always when a problem with the lifetime of a thread comes up, these
three lines of code are posted as THE solution.
Why not simple and easy, and only one line of code?
UINT xy::ThreadProc (LPVOID foo)
{
AfxGetThread()->m_bAutoDelete = FALSE;
while (true)
{
// thread code
}
return 0;
}
I always use this solution and never had any problems.
I feel like walking on thin ice, because I never see my code as a
possible solution ;-)
Best Regards
Walter
.
- Follow-Ups:
- Re: WaitForSingleObject() failing?
- From: Scott McPhillips [MVP]
- Re: WaitForSingleObject() failing?
- From: Doug Harrison [MVP]
- Re: WaitForSingleObject() failing?
- From: Michael K. O'Neill
- Re: WaitForSingleObject() failing?
- References:
- WaitForSingleObject() failing?
- From: Davinder
- Re: WaitForSingleObject() failing?
- From: Scott McPhillips [MVP]
- WaitForSingleObject() failing?
- Prev by Date: What's the most efficient testing of variables?
- Next by Date: How to get flat button in CPropertySheet(C++V6).
- Previous by thread: Re: WaitForSingleObject() failing?
- Next by thread: Re: WaitForSingleObject() failing?
- Index(es):
Relevant Pages
|