Difference between revisions of "User:Jamesboston/nsIProcess/meetin-092308"

From CDOT Wiki
Jump to: navigation, search
(New page: Meeting: Sept 23, 2008<br /> Topic: Using Netscape Portable Runtime (NSPR)<br /> People: James Boston (jboston), Mark Finkle (mfinkle)<br /> <code> <pre> 23:47 < mfinkle> jboston: one que...)
 
(No difference)

Latest revision as of 23:20, 22 September 2008

Meeting: Sept 23, 2008
Topic: Using Netscape Portable Runtime (NSPR)
People: James Boston (jboston), Mark Finkle (mfinkle)

23:47 < mfinkle> jboston: one question that will likely come up is: why not push this into nspr?
23:47 < jboston> um...
23:48 < jboston> I don't know.
23:50 < jboston> I'm furiously reading up on nspr now trying to think of something intelligent to say.
23:52 < jboston> I see it's got ansynchronous i/o.
23:54 < mfinkle> jboston: nspr has a function to create processes on windows 
                 http://mxr.mozilla.org/mozilla-central/source/nsprpub/pr/src/md/windows/ntmisc.c#299
23:55 < mfinkle> but then nsIProcess doesn't use it anyway (before your patch)
23:55 < mfinkle> so I guess it's ok, that kill uses Windows directly, instead of using nspr
23:56 < jboston> I guess if it's written with nspr it would be easier to maintain in the long run.
23:56 < mfinkle> PRProcess is a wrapper around MDProcess which is a struct for a HANDLE and a DWORD
23:57 < mfinkle> jboston: maybe not (I'm not pushing for nspr, just trying to figure out if you'll need to defend
                 not using it)
23:57 < mfinkle> http://mxr.mozilla.org/mozilla-central/source/nsprpub/pr/src/md/windows/ntmisc.c#421
23:59 < mfinkle> so nsProcess.mProcess.md.handle should hold what you want, right?
23:59 < jboston> Yes. I recognize CloseHandle(procInfo.hThread);
23:59 < mfinkle> that is, _if_ nsProcess actually used that on WINDOWS anyway :)
23:59 < jboston> There's something very similar in my patch: 
                 http://matrix.senecac.on.ca/~jwboston/patches/Patch210908.txt
23:59 < jboston> +  TerminateProcess(
23:59 < jboston> +    procInfo.hProcess, // handle within the PROCESS_INFORMATION struct
23:59 < jboston> +    NULL // I just guessed for this value
23:59 < jboston> +  );
Day changed to 23 Sep 2008
00:02 < jboston> But yes, that handle holds the pid that is the key to everything.
00:02 < mfinkle> ok, how about this idea
00:03 < mfinkle> instead of using a PROCESS_INFORMATION procInfo as a member
00:03 < mfinkle> just make sure the WINNT block of code uses mProcess
00:03 < mfinkle> which is already a data memebr
00:04 < mfinkle> just like nspr does here 
                 http://mxr.mozilla.org/mozilla-central/source/nsprpub/pr/src/md/windows/ntmisc.c#421
00:04 < jboston> Ok. The TerminateProcess call is actually a bad way to kill a process anyway I think.
00:04 < mfinkle> then at least nsProcess.mProcess is initialized correctly
00:05 < mfinkle> probably init mProcess variable here? 
                 http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsProcessCommon.cpp#302
00:06 < mfinkle> jboston: as for TerminateProcess, well you are in a method named "kill" :)
00:07 < jboston> I see that nspr uses the same call too actually. I just thought I remember reading that's there's 
                 a more gentle way of stopping a process.
00:08 < mfinkle> http://mxr.mozilla.org/mozilla-central/source/nsprpub/pr/src/md/windows/ntmisc.c#481
00:08 < mfinkle> yep
00:08 < jboston> Something about reporting exit codes?
00:08 < mfinkle> so, if you setup mProcess.md.handle and mProcess.md.id in nsProcess, the normal nspr call will work
00:08 < jboston> ok