You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2023/01/11 17:29:35 UTC

[GitHub] [logging-log4j2] jvz commented on pull request #1195: Optimize Lazy::relaxed

jvz commented on PR #1195:
URL: https://github.com/apache/logging-log4j2/pull/1195#issuecomment-1379238383

   I've realized recently that this class could use some better internal docs. I had to chase a lot of academic pointers to find out what the hell release/acquire memory ordering semantics means since the `VarHandle` API docs essentially tell you that "it works basically the same way as some feature in C and C++" which itself is a fairly recent addition to those language standards (C11 and C++11, though of course prior versions had non-standard extensions in various compilers to support similar features since they're relevant to implementing multithreaded runtimes). I hope that the API docs are sufficiently clear, though, on the reasoning behind using `Lazy::lazy` (the "strict" lazy) versus `Lazy::relaxed` (the "ok to compute multiple times as long as we all get the same published reference in the end" lazy) versus the other one (the "ok to compute multiple times as we always get the same result, so any thread can have any published value" lazy). Kotlin's own lazy class supports less
  than this, but they don't seem to use Java 11 yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org