On Wed, 16 Nov 2022 04:23:37 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> It seems timer.cancel() says "Terminates this timer, discarding any currently 
> scheduled tasks." 

Yes, that's the intention.

> so it might disregard the "done" check been done in ScheduleTask resulting in 
> false positive...

If we reach timer.cancel() before the timer fires off the task we don't need 
the task
canceling it means the test can exit immediately - not wait 20 or 30 seconds.

If it does fire because cancel is too slow, it will see "done==true"

So perhaps I'm not following your point ?


> Should we do Thread.yield() instead? 

No. 

> I'll tidy it up a bit more.

-------------

PR: https://git.openjdk.org/jdk/pull/11179

Reply via email to