equal
deleted
inserted
replaced
43 { |
43 { |
44 if (SwingUtilities.isEventDispatchThread()) body |
44 if (SwingUtilities.isEventDispatchThread()) body |
45 else SwingUtilities.invokeLater(new Runnable { def run = body }) |
45 else SwingUtilities.invokeLater(new Runnable { def run = body }) |
46 } |
46 } |
47 |
47 |
|
48 def future[A](body: => A): Future[A] = |
|
49 { |
|
50 if (SwingUtilities.isEventDispatchThread()) Future.value(body) |
|
51 else { |
|
52 val promise = Future.promise[A] |
|
53 later { promise.fulfill_result(Exn.capture(body)) } |
|
54 promise |
|
55 } |
|
56 } |
|
57 |
48 |
58 |
49 /* delayed events */ |
59 /* delayed events */ |
50 |
60 |
51 def delay_first(delay: => Time)(event: => Unit): Standard_Thread.Delay = |
61 def delay_first(delay: => Time)(event: => Unit): Standard_Thread.Delay = |
52 Standard_Thread.delay_first(delay) { later { event } } |
62 Standard_Thread.delay_first(delay) { later { event } } |