What triggers Fiber.unpark?

Chris Plummer chris.plummer at oracle.com
Thu Oct 17 19:30:58 UTC 2019


On 10/17/19 12:53 AM, Alan Bateman wrote:
> On 16/10/2019 21:58, Arkadiusz Gasiński wrote:
>> Just noticed that the previous question in the mailing list was 
>> pretty much
>> the same (what a coincidence) and actually checked your talk from JVMLS,
>> @Alan. I’m still wondering what’s calling this InnocuousThread that 
>> in turn
>> unpark Fiber? Also, is this thread used for all Fiber unparking or 
>> only in
>> case of I/O?
>>
> sun.nio.ch.Poller is probably what you want. The `polled` method is 
> invoked when a file descriptor is ready and it unparks the fiber that 
> is parked waiting on that file descriptor.
>
> -Alan
This part of the video shows the stack when the poll completes and the 
fiber is unparked:

https://youtu.be/NV46KFV1m-4?t=509

Maybe Alan can copy-n-paste the stack trace from the presentation here 
for the record.

Note this is on macos, which uses KQueuePoller. On linux is uses 
EPollPoller. Poller.startPollerThread() is where the InnocuousThread is 
created:

             Thread t = JLA.executeOnCarrierThread(() ->
                     InnocuousThread.newSystemThread(name, poller));

And the above code is triggered from the Poller static initializer.

Chris



More information about the loom-dev mailing list