From 02243ec6c7a60b8affe855d1af78e57482d9194d Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Thu, 28 Nov 2024 15:03:00 +0100 Subject: [PATCH] threading_model.md: Mention `UIUtil.invokeLaterIfNeeded()` --- topics/basics/architectural_overview/threading_model.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/topics/basics/architectural_overview/threading_model.md b/topics/basics/architectural_overview/threading_model.md index 8c9aeb9ad..ce7857f33 100644 --- a/topics/basics/architectural_overview/threading_model.md +++ b/topics/basics/architectural_overview/threading_model.md @@ -549,6 +549,9 @@ Massive batches of VFS events can be pre-processed in the background with [`Asyn Use `Application.isDispatchThread()`. +If code must be invoked on EDT and the current thread can be EDT or BGT, use [`UIUtil.invokeLaterIfNeeded()`](%gh-ic%/platform/util/ui/src/com/intellij/util/ui/UIUtil.java). +If the current thread is EDT, this method will run code immediately, or will schedule a later invocation if the current thread is BGT. + ### Why write actions are currently allowed only on EDT? Reading data model was often performed on EDT to display results in the UI.