2009/10/30 Phil Dawes <[email protected]>:
> Hi Paul
>
> Paul Moore wrote:
>>
>> Hmm, this is really far more complex than I can follow, but rather
>> than using factor-level pipes, why not create pure win32 handle level
>> pipes, then wrap them using opened-file in the target VM only? That
>> way, the completion port is only assigned and registered in the
>> correct VM.
>>
>
> Yes that's what I'm currently doing. The problem is that this only works
> for one target vm and I need it to work for many clients.
> (i.e. currently only one vm can be listening to the IOCompletionPort on
> the write handle). I'm going to have a bit of a play tonight to see if
> there's a way round this.

Ah, the *write* handle! Sorry, I was thinking about the read handle.

I wonder, could you use a named pipe (I know Factor already uses named
pipes under the hood) and pass around the name, so that each client
can open a write handle of its own on the pipe? That way, you don't
have a single port/handle for all clients. In effect, run
"open-other-end" in each client separately. (I have the distinct
feeling you're going to say "Yes that's what I'm currently doing"
again. Ug the caveman busy reinventing your wheels over here :-))

Another possibility might be to use Windows mailslots rather than
pipes. I'm mildly suspicious of what the documentation says about
reliability, though...

> User api will be something like:
>
> : spawn-vm ( quot -- msg-node )
>
> i.e. you pass it a quot to execute in the new vm and it returns a
> concurrency.messaging node that you can send messages to.
>
> Under the hood the spawn-vm call initialises the vm pipe (if it's not
> already created) spawns a new vm in a native thread and passes it the
> 'write' end of the pipe and a lock. The new vm thread initialises its
> own pipe, and pushes the write end of this new pipe down the parent pipe
> to the parent.
>
> Meanwhile both vms spawn a coop thread to continually read their pipe
> and dispatch messages to local coop threads in the same manner as
> concurrency.distributed.
>
> Hope that makes sense,

Yes, it does, and it looks nice. It actually sounds like my "open the
write end in the client" idea is different from how you're currently
doing it, too, so maybe I've actually come up with something useful
this time!!! :-)

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

Reply via email to