2009/10/28 Paul Moore <[email protected]>: > 2009/10/28 Phil Dawes <[email protected]>: >> Hi Slava, Hi everyone, >> >> I've got the native thread message passing working really well on Linux, >> you can just do a '[ blah ] spawn-vm'. >> >> Unfortunately I'm having problems doing the same thing with io.pipes on >> windows. Here's a boiled down test case 'pipe-race.factor', which blows >> up with the error at the bottom of this post: >> >> http://paste.factorcode.org/paste?id=1009 >> >> The run-test word creates a pipe and then passes the write handle as a >> command line arg to a new vm thread. The new vm turns the handle into an >> output port and sends binary messages down it which the parent receives. >> (except it doesn't on windows because the whole thing goes bang) >> >> Am I doing something illegal here? > > You need to open the pipe with the "inherit handle" security attribute. > > Raw Win32 code for doing this is: > > BOOL ret; > HANDLE hRead; > HANDLE hWrite; > SECURITY_ATTRIBUTES sec = { 0 }; > sec.nLength = sizeof(sec); > sec.bInheritHandle = 1; > > ret = CreatePipe(&hRead, &hWrite, &sec, 0); > > Hope this helps,
Yes, the default pipe creation in io.pipes.windows.nt makes the pipe handles non-inheritable. Rather than hacking the security attributes, you could use DuplicateHandle (from windows.kernel32) to create an inheritable copy of the handle. That should work, but I haven't got the expertise with alien to set up the various pointers etc. Paul. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
