On Sat, Jun 1, 2013 at 3:43 PM, Thad Guidry <thadgui...@gmail.com> wrote:

>
>
>> I know that Rust currently doesn't currently support this, but what if
>> futures could use a custom allocator?   Then it could work like this:
>>
>> 1. Futures use a custom free-list allocator for performance.
>>
>
I don't see why Futures could not be allocated on the stack ?

Since Rust is move aware and has value types, it seems to me this should be
possible.

-- Matthieu


> 2. The I/O request allocates new future object, registers uv event, then
>> returns unique pointer to the future to its' caller.  However I/O manager
>> retains internal reference to the future, so that it can be resolved once
>> I/O completes.
>> 3. The future object also has a flag indicating that there's an
>> outstanding I/O, so if caller drops the reference to it, it won't be
>> returned to the free list until I/O completes.
>> 4. When I/O is complete, the future get resolved and all attached
>> continuations are run.
>>
>>
>> Vadim
>>
>>
> Brian,
>
> Vadim described the idea fairly well there with the meat of my idea being
> # 2.  I was just trying to describe the scenario that # 4 be able to happen
> only when all the registered event(s) happen (not just 1 blocking step but
> perhaps many blocking steps).
>
> I would not know where to start mocking something like that with Rust
> yet... still beginning.
>
> --
> -Thad
> http://www.freebase.com/view/en/thad_guidry
>
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
>
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to