Ответ 1
Нет. Поток принадлежит планировщику. В любом случае планировщик имеет ссылку на тело, не завершенное Будущее (это происходит в a.start()
), поэтому он не будет собирать мусор до завершения.
object Futures {
/** Arranges for the asynchronous execution of `body`,
* returning a future representing the result.
*
* @param body the computation to be carried out asynchronously
* @return the future representing the result of the
* computation
*/
def future[T](body: => T): Future[T] = {
val c = new Channel[T](Actor.self(DaemonScheduler))
val a = new FutureActor[T](_.set(body), c)
a.start()
a
}
}