Re: RFC 86 (v1) IPC Mailboxes for Threads and Signals

[email protected] (Dan Sugalski) Fri, 11 Aug 2000 13:23:19 -0400
Newsgroups perl.perl6.language.flow
Message-ID <[email protected]>
At 12:54 PM 8/11/00 -0400, Uri Guttman wrote:
> >>>>> "DS" == Dan Sugalski <[email protected]> writes:
>
>   DS> Nope. The code that accessses the array needs to support it. Different
>   DS> animal entirely. The ops don't actually need to know.
>
>but still that is overhead code for all arrays and not just the mailbox
>ones.

Nope. Just for the shared ones.

>   DS> s/mailboxes/filehandles/;
>
>   DS> If we're talking a generic communication pipe between things, we
>   DS> should overload the filehandle. It's a nice construct that
>   DS> provides an ordered, serialized, blockable, pollable
>   DS> communications channel with well-defined behavior and a
>   DS> comfortable set of primitives to operate on it.
>
>pollable is a good thing. some mailbox designs are not pollable and some
>are. i like the idea of supporting polling then you can also have
>callbacks. but this does imply an implementation as semaphores and
>shared memory are not pollable. you would have to build this with pipes
>and filehandles.

So? Inter-thread communication is almost undoubtedly not going to be built 
with something as heavyweight as pipes, shm, or mailboxes, so I don't see 
their limitations as relevant here. Regardless, don't design to the 
limitations of one particular implementation method. We can work around 
their limits if need be.

>overlaying it on filehandles is another question. i would like to see a
>single operation which does an atomic lock, block, retrieve, unlock. we
>don't have that for filehandles.  you could use a new method on that
>special handle (i like 'get') which has the desired semantics.

So we enhance filehandles to make reads on them atomic. <> does an atomic 
read on the filehandle. NBD.

>i think making mailboxes in some form is a good idea. but they should be
>special objects (even if they are filehandles) with their own methods to
>support the desired semantics.

Overload filehandles. They really are a good fit for what you're looking for.

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[email protected]                         have teddy bears and even
                                      teddy bears get drunk