RFR: 8145083: Use semaphore instead of mutex for synchronization of Unified Logging configuration
Marcus Larsson
marcus.larsson at oracle.com
Mon Dec 14 14:54:07 UTC 2015
Hi David,
On 2015-12-14 13:53, David Holmes wrote:
> Hi Marcus,
>
> Looks good!
Thanks!
>
> 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.
Alright, thanks for checking. I'm happy as long as it works in time for
argument parsing.
>
>> 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.
I've received similar feedback from others regarding a MutexLocker-like
stack object for this, so I've modified the patch to use such instead.
Thanks,
Marcus
>
> Thanks,
> David
>
>> Issue:
>> https://bugs.openjdk.java.net/browse/JDK-8145083
>>
>> Thanks,
>> Marcus
More information about the serviceability-dev
mailing list