humbleui

leonoel 2023-08-11T08:16:43.171839Z

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 ?

leonoel 2023-08-11T09:00:14.137959Z

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)))

leonoel 2023-08-11T09:05:26.193599Z

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

Niki 2023-08-11T12:09:36.244099Z

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

leonoel 2023-08-11T12:21:35.118949Z

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

Niki 2023-08-11T12:37:54.022159Z

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