humbleui 2023-08-11

JWM question : is it acceptable to call App/start multiple times, assuming the calls are properly serialized and each previous call is properly disposed with App/terminate ?

This crashes the JVM

(dotimes [_ 10]
  (let [latch (CountDownLatch. 1)
        thread (Thread. (reify Runnable
                          (run [_]
                            (App/start
                              (reify Runnable
                                (run [_] (.countDown latch)))))))]
    (.start thread)
    (.await latch)
    (App/runOnUIThread (reify Runnable (run [_] (App/terminate))))
    (.join thread)))

Context : I'm writing a developer tool that is meant to be launched from the REPL, I want the UI thread to be initialized lazily and disposed when the last window is closed

I suppose not :) I’ve never thought about it, actually. Why don’t you keep UI thread?

That can work for me, I'm just trying to be a good citizen

Alternatively, if you figure out a way to safely stop/start app, we can merge it. But it have to be done for all three systems though

👍 1