Select PMC

Kevin Tew tewk at tewk.com
Wed Feb 23 15:55:31 UTC 2011


On 02/23/2011 07:55 AM, Nick Wellnhofer wrote:
> On 21/02/2011 20:29, Kevin Tew wrote:
>> I've just pushed tewk/select, which contains a non-blocking support for
>> linux.
>> I really want to see rakudo get some non-blocking IO features, hence I
>> started with parrot.
>>
>> I'd like to merge this sooner than later,
>> So constructive patches, commits, pull requests to tewk/select are 
>> welcome.
>
> I like the update/remove methods because they work with other event 
> mechanisms, too. The getfd, getmaxfd and get_data_hash are specific to 
> select on UNIX, but afaics they're only needed for completeness and 
> testing.
>
> The ability to associate arbitrary data PMCs with an fd also seems 
> useful. But how am I supposed to get the FileHandle PMC from the 
> returned data PMC? It might be better to introduce an additional 
> "Event" PMC type that contains the FileHandle, the r/w/e flags, and 
> user-defined data. Then you would only have to pass this PMC to 
> update/remove. See the event struct in libevent, for example.
I like the idea of an Event PMC.

I tried to keep the interface very very simple.

The idea would be to call update with an array [FileDescriptorPMC, 
USERDATA ... ], an Event PMC, or any user defined PMC.

Maybe I should add a 3 arg update(filedescriptor, user_data, rwe_flags) 
that automatically builds a [FileDescriptorPMC, userdata] array and puts 
it in the fd_map.

Kevin

> Nick
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev



More information about the parrot-dev mailing list