Latest API revision of Fiber

Remi Forax forax at univ-mlv.fr
Sun Dec 9 22:23:27 UTC 2018


Hi all,
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)
and
  <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.
should be
  @apiNote TBD if we need both awaitTermination and join methods.

regards,
Rémi


More information about the loom-dev mailing list