<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 09/07/2025 16:54, Nikita Bobko
wrote:<span style="white-space: pre-wrap">
</span></div>
<blockquote type="cite" cite="mid:0B57604A-AB4F-458F-B4D8-21BD5B157BAE@jetbrains.com">
<pre wrap="" class="moz-quote-pre">
I understand why you are asking, and yes, currentThread may change
across suspension points. It's not a problem though in Kotlin Coroutines
because we have our ways to carry arbitrary data over threads.
</pre>
</blockquote>
Having currentThread change in a thread of execution will break a
lot of things. I'm thinking of unlock methods throwing
IllegalMonitorStateException if there is a suspension point after
calling into some Java code that acquires a lock. Same thing with
closing a confined arena throwing WrongThreadException, and dozens
of other parts of the system that make use of the current Thread or
current thread ID. This is on top of all methods that may block and
all the serviceability features/APIs that are also thread focused.
So while the discussion here is on inheriting ScopedValues, it looks
like it is dwarfed in comparison to all the issues that may arise
when executing Java code.<br>
<br>
-Alan<br>
<br>
<br>
<br>
<br>
</body>
</html>