Waiting on intrinsic locks parks the executor thread

Ron Pressler ron.pressler at oracle.com
Tue Jan 22 18:28:47 UTC 2019


There is no rationale other than prioritization.
We would eventually like to support Object.wait(), but the implementation may not be simple,
so this is something we’ve decided to postpone for now, especially as there are alternatives.
There isn’t much of a good alternative for Thread.sleep().

Ron


On January 22, 2019 at 6:12:09 PM, Volkan Yazıcı (volkan.yazici at gmail.com) wrote:

Thanks for the prompt reply Alan. Yes, locks do work for me.  

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?  

On Tue, Jan 22, 2019 at 5:00 PM Alan Bateman <Alan.Bateman at oracle.com>  
wrote:  

> On 22/01/2019 15:43, Volkan Yazıcı wrote:  
> > Within a fiber waiting on an intrinsic lock, Object#wait(), parks the  
> > executor thread. Is this behavior intended? If so, is there an  
> alternative  
> > release-the-lock-and-suspend intrinsic for fibers?  
> >  
> Yes, this is expected for now. Can you use java.util.concurrent locks?  
>  
> -Alan  
>  


More information about the loom-dev mailing list