louiscad
08/09/2021, 10:31 PMjava.lang.Thread
) of a Compose for Desktop app?
My use case is checking whether some code is running on the main thread or not, to disallow running some blocking code where it could affect the UI.Dominaezzz
08/09/2021, 10:43 PMCasey Brooks
08/09/2021, 10:43 PMSwingUtilities.isEventDispatchThread()
louiscad
08/10/2021, 6:17 AMAlexander Kurasov[JB]
08/10/2021, 7:51 AMlouiscad
08/10/2021, 10:06 AM<http://Dispatchers.IO|Dispatchers.IO>
is the right dispatcher to use), it's about preventing misuse, in a world where suspending constructors don't exist. I'll check the SwingUtilities
class to answer my own question.Arslan Armanuly
08/10/2021, 4:35 PMArslan Armanuly
08/10/2021, 4:35 PMlouiscad
08/10/2021, 4:37 PMrunBlocking(Dispatchers.Main)
, I'll have that in mind if I don't find any better.Arslan Armanuly
08/10/2021, 4:48 PMlouiscad
08/10/2021, 6:14 PMsuresh
08/11/2021, 6:47 AMto disallow running some blocking code where it could affect the UI.Not something specific to compose, but issue like this has been solved in other frameworks using libraries like https://github.com/reactor/BlockHound (run as java agent) and it’s extensible.