-
Enhancement
-
Resolution: Fixed
-
P4
-
18
-
b08
G1ServiceThread::schedule_task calls schedule (locking the monitor), then calls notify (relocking the monitor) to trigger updating any pending wait. It would be simpler if schedule had a bool notify argument for use there (true) and by G1ServiceTask::schedule (false, since called from the service thread, so it can't be waiting). This would make the notify() function only called from stop_service, which could just do the monitor lock and notify directly, eliminating the notify function.
The thread's service loop is also more complicated than it needs to be, with multiple trips in and out of the monitor. This can also be simplified and made to look more like typical wait-for-value then process loops.
The thread's service loop is also more complicated than it needs to be, with multiple trips in and out of the monitor. This can also be simplified and made to look more like typical wait-for-value then process loops.