RFR: 8229517: Support for optional asynchronous/buffered logging [v19]

Albert Mingkun Yang ayang at openjdk.java.net
Mon May 24 09:05:18 UTC 2021


On Mon, 24 May 2021 02:02:55 GMT, Xin Liu <xliu at openjdk.org> wrote:

> When _sem.wait() returns, it just decreases one. however, _buffer.pop_all() pops all messages in queue at once. The two numbers are not consistent all the time.

Thank you for the explanation. I overlooked the fact that the "consumer" clears out the buffer in bulk.

> Could you elaborate this? thanks?

I mean that "_sem is a semaphore whose value denotes how many messages have been enqueued" is a bit inaccurate, because `write()` will decrement the semaphore value. For example, a producer has enqueued 2 msgs, but `_sem` could be `0`, as `flush` has been called.

However, I don't see a easy way to "fix" this; I am OK with the current comment.

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

PR: https://git.openjdk.java.net/jdk/pull/3135


More information about the hotspot-dev mailing list