changeset 49066 | 1067a639d42a |
parent 49065 | 8ead9e8b15fb |
--- a/src/Pure/System/jfx_thread.scala Sun Sep 02 19:26:05 2012 +0200 +++ b/src/Pure/System/jfx_thread.scala Sun Sep 02 21:01:11 2012 +0200 @@ -25,4 +25,14 @@ if (JFX_Platform.isFxApplicationThread()) body else JFX_Platform.runLater(new Runnable { def run = body }) } + + def future[A](body: => A): Future[A] = + { + if (JFX_Platform.isFxApplicationThread()) Future.value(body) + else { + val promise = Future.promise[A] + later { promise.fulfill_result(Exn.capture(body)) } + promise + } + } }