[crac] RFR: Wake up all TIMED_WAITING threads after restore [v2]

Radim Vansa rvansa at openjdk.org
Wed Jun 21 09:13:34 UTC 2023

On Tue, 20 Jun 2023 10:06:57 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> We are not triggering the Java InterruptedException; when you look into the implementation of `JavaThread::interrupt` you'll see that unparking from those 3 types of conditions is all it's actually doing, setting and immediately unsetting the interrupted flag is a noop on posix systems.
>> So I don't think this can be any cheaper. We are operating on a bit higher level only to reuse code that we would otherwise inline in here.
> t->interrupt() triggers unparks of two ParkEvents and of a Parker. They do some bookkeeping in addition to just pthread_cond_timedwait(). But OK, I see we need to actually unpark the thread for park() callers to recalculate the abs time. Anyway, Thread::interrupt looks like a hack. AFAICS unpark()s can be called without Java thread state check, which also will be more straightforward.

The thread state check might be more of an optimization, even though unparking a non-parked thread is a noop, it still means some work that's unnecessary.


PR Review Comment: https://git.openjdk.org/crac/pull/85#discussion_r1236673967

More information about the crac-dev mailing list