Waiting on intrinsic locks parks the executor thread

Andrew Haley aph at redhat.com
Wed Jan 23 09:42:52 UTC 2019


On 1/22/19 6:11 PM, Volkan Yazıcı wrote:
> Though I am a little bit confused about where do you draw the line for
> deciding on "functions that used to affect threads start affecting fibers
> as well". For instance, Thread.sleep() suspends a fiber and releases the
> executor thread back into the pool. OTOH, Object#wait() blocks the entire
> fiber+thread pair. Maybe I am missing something obvious but what is the
> rationale here?

Monitors and synchronized blocks are really hard to do wth
fibers. They're baked in to the virtual machine at a very low level,
with lots of hand-carved assembly code. In hindsight, allowing every
object to be locked and signalled wasn't such a great idea.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the loom-dev mailing list