RFR: 8145083: Use semaphore instead of mutex for synchronization of Unified Logging configuration

David Holmes david.holmes at oracle.com
Mon Dec 14 12:53:09 UTC 2015


Hi Marcus,

Looks good!

On 14/12/2015 8:13 PM, Marcus Larsson wrote:
> Hi,
>
> Please review the following patch to use a semaphore instead of a mutex
> for the synchronization of log configuration. Using a mutex requires
> some parts of the VM to be initialized, whereas the semaphores can be
> used right from the start.

Not completely true as the timed-wait requires some OS initialization 
for clocks, but your usage seems to be safe.

> This simplifies the code and allows very
> early log configuration without special cases for early configuration vs
> reconfiguration after VM init.
>
> Webrev:
> http://cr.openjdk.java.net/~mlarsson/8145083/webrev.00/

I can't verify the correctness of reducing the scope of the "locking" 
(it seems reasonable), but certainly the smaller the critical section 
the better.

The only real comment I have is that a SemaphoreAcquirer utility class 
would make things a bit neater and ensure you can't forget to signal.

Thanks,
David

> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8145083
>
> Thanks,
> Marcus


More information about the serviceability-dev mailing list