From ac3e36be7d8a9a997989e8eb38a8cdeb9ea1d13a Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Fri, 20 Sep 2024 13:57:05 +0200 Subject: [PATCH] coroutine_dispatchers.md: Add information about no write intent lock on Dispatchers.EDT since 2024.3 --- .../coroutines/coroutine_dispatchers.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/topics/basics/architectural_overview/coroutines/coroutine_dispatchers.md b/topics/basics/architectural_overview/coroutines/coroutine_dispatchers.md index d0c3bf2aa..df637a045 100644 --- a/topics/basics/architectural_overview/coroutines/coroutine_dispatchers.md +++ b/topics/basics/architectural_overview/coroutines/coroutine_dispatchers.md @@ -67,6 +67,14 @@ In the IntelliJ Platform, the EDT dispatcher is also installed as `Dispatchers.M Use `Dispatchers.Main` only if the coroutine is IntelliJ Platform-context agnostic (e.g., when it can be executed outside the IntelliJ Platform context). Use `Dispatchers.EDT` when in doubt. +### EDT Dispatcher and Write Intent Lock + +As explained in the [](threading_model.md#locks-and-edt) section, write intent lock is acquired on EDT implicitly. +This behavior has changed in coroutine context in version 2024.3. + +Since 2024.3, write intent lock is not acquired implicitly in coroutines called on the EDT dispatcher. +Coroutines must use [`readAction`/`writeAction`/`writeIntentReadAction`](%gh-ic%/platform/core-api/src/com/intellij/openapi/application/coroutines.kt) API to acquire a required lock explicitly. + ## Dispatchers vs. Threads The dispatcher concept is a higher level of abstraction over threads.