Latest API revision of Fiber
forax at univ-mlv.fr
Sun Dec 9 22:23:27 UTC 2018
i've just taken a look to the changes of the Fiber API since my last test :)
In toFuture(), why do want to guarantee that there is only one CompletableFuture for a Fiber,
i'm not sure i want to pay for a volatile read/volatile write (the CAS) if i call toFuture().
in my opinion, it should be just a best effort thing, i.e. the future field doesn't need to be volatile and the CAS is not necessary.
The signature of schedule(Runnable) and schedule(Executor, Runnable) should be
<V> Fiber<V> schedule(Runnable task)
<V> Fiber<V> schedule(Executor scheduler, Runnable task)
given that the 'return value' is null for a Runnable, it can be seen as any type, not just Void.
This allows code like this to work:
Fiber<String> fiber = ( some condition )? Fiber.schedule(runnable): Fiber.schedule(callable);
And a minor nit, the javadoc was not updated when await was renamed to awaitTermination.
@apiNote TBD if we need both await and join methods.
@apiNote TBD if we need both awaitTermination and join methods.
More information about the loom-dev