Project Loom Wiki
martinrb at google.com
Wed Aug 8 16:21:52 UTC 2018
A tricky problem. ThreadPoolExecutor/FutureTask have difficult code to
manage interrupts so that interrupts reach their intended target.
On Tue, Aug 7, 2018 at 11:48 PM, Hamlin Li <huaming.li at oracle.com> wrote:
> Hi Alan,
> Thank you for the great work.
> Although it's still an early prototype, I think it's better to give my
> suggestion early, if it's already on your list please ignore this email. :-)
> My point is: API should support interrupt a fiber directly.
> First, a Fiber can be park/unpark/await, but only Thread can be
> interrupted(ShadowThread is still a thread). If a fiber is blocking at
> Object.wait, Thread.sleep, Thread.join or I/O operation, then only
> Thread.interrupt can unblock it, unpark will not. That means if I want to
> stop an blocking I/O operation, I need to interrupt the underlying Thread
> rather than interrupt the fiber directly(normally I have direct reference
> to fiber when I execute a fiber).
> Second, as I know in different runs(first run, subsequent continuations),
> a fiber could run on different carrier threads, and based on above first
> point, I'm even confused which thread I'm interrupting when I do
> Thread.interrupt, will it impact other tasks or fibers running in the
> thread? For this part, although based on my test and reading source code I
> know it will not, I'm just saying that it confuses me for a while, it's not
> that straight.
> So, from my point of view, it might be more clear to let user be able to
> directly interrupt a Fiber rather than do it through Thread.
> Thank you
> On 2018/8/4 11:15 AM, Ron Pressler wrote:
>> Loom now has a wiki-page that contains the current status of the project,
>> to resources like talks and relevant documents, and design/implementation
>> We intend to update the wiki from time to time so that it is kept up to
>> date and
>> can serve as a useful communication channel for this project.
More information about the loom-dev