apache / royale-compiler

Apache Royale Compiler
https://royale.apache.org/
Apache License 2.0
95 stars 49 forks source link

Double-Checked Locking #160

Open QiAnXinCodeSafe opened 3 years ago

QiAnXinCodeSafe commented 3 years ago

https://github.com/apache/royale-compiler/blob/6f75df78d08d3c4a7f81a8d25d96b978972ee480/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeCache.java#L224-L232

Double-Checked Locking is widely cited and used as an efficient method for implementing lazy initialization in a multithreaded environment. Unfortunately, it will not work reliably in a platform independent way when implemented in Java, without additional synchronization.

carlosrovira commented 3 years ago

Hi, thanks for the information. Could you please let us know as a better way of doing it submitting a patch. We'll be glad to integrate any improvement. thanks

QiAnXinCodeSafe commented 3 years ago

Hi, thanks for the information. Could you please let us know as a better way of doing it submitting a patch. We'll be glad to integrate any improvement. thanks Modify the variable map with volatile.

carlosrovira commented 3 years ago

Hi @QiAnXinCodeSafe, if you can submit a Pull Request it would be better and would make your collaborations and out testing more productive. Could you send as a PR for this issue? thanks