Re: problem with WaitForSingleObject on WM5
- From: rijumreghunath@xxxxxxxxxxxxxx
- Date: 17 Oct 2006 05:51:05 -0700
Hi Michael/Bruce,
I am sure that child process is exiting, I also tried without
ExitThread/ExitProcess, by simply just returing the main WinMain
thread. But the result is same. The parent waitForSingleObject is not
signaled after child exit and it wait for long until new child create.
BTW is there other way for parent process to know about child exit ?
regards,
Riju
Bruce Eitman [eMVP] wrote:
ExitThread is not the way to have a thread shut down. This has been covered
several times in these newsgroups. You are much better off just returning
from the thread function. ExitThread does not give the thread a chance to
clean up after itself.
--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net
Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member
<rijumreghunath@xxxxxxxxxxxxxx> wrote in message
news:1161008448.534701.200820@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
I have a problem with WaitForSingleObject on Windows mobile 5.
I have a parent process in which I am creating child processes using
CreateProcess and I remember the child handle in the parent.
CreateProcess(programName, command, NULL, NULL, FALSE, 0, NULL, NULL,
&startupInfo, &processInfo);
I want to wait for child process shutdown, to make sure that all
resources are completely freed by the child. So before the child
process exit (ExitThread()), I am calling
WaitForSingleObject(childProcessHandle, INFINITE) on the parent
process. But interestingly I saw the WaitForSingleObject() hangs when
a child process exits. The hanged WaitForSingleObject() is seen to be
signaled I if launch a new child process from the parents (seems like a
timing issue).
Below is the code that I am using in parent process
DWORD result=0;
HANDLE handle;
handle = OpenProcess(SYNCHRONIZE, FALSE, contextID);
result = WaitForSingleObject(handle, INFINITE);
CloseHandle(handle);
The same piece of code is working finely with WM 2003 and WM 2003 SE.
Please let me know the reason for this platform difference. Also please
let me know if there is any other way to achieve my requirement.
Thanks,
Riju Reghunath
.
- Follow-Ups:
- Re: problem with WaitForSingleObject on WM5
- From: Paul G. Tobey [eMVP]
- Re: problem with WaitForSingleObject on WM5
- References:
- problem with WaitForSingleObject on WM5
- From: rijumreghunath
- Re: problem with WaitForSingleObject on WM5
- From: Bruce Eitman [eMVP]
- problem with WaitForSingleObject on WM5
- Prev by Date: Re: The value written from IST is not updated in the ISR
- Next by Date: Internet Explorer in WIN CE
- Previous by thread: Re: problem with WaitForSingleObject on WM5
- Next by thread: Re: problem with WaitForSingleObject on WM5
- Index(es):
Relevant Pages
|