Comparison of several usages of the singleton pattern

I have systematically studied the design pattern twice before, one c# and one java. Of course, there is no difference in essence. The essence of the pattern: the ideas are still the same, but the learning is not enough, and repeated learning is required.

Glossary:

volatile: type modifier:
https://baike.baidu.com/item/volatile/10606957?fr=aladdin

      Modifies variables that are accessed and modified by different threads; as an instruction keyword, to ensure that this instruction is not omitted due to compiler optimizations, each use of the variable(s) modified by this word needs to be (sequentially) re-read instead of Use the backup in the register

I found a blog written particularly well:

The fragrance of the rising sun
https://blog.csdn.net/luofen521/article/details/51788230 See below:
CSDN: Reprinting is really troublesome, and there are still problems with the format

Comparison of several usages of the singleton pattern

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325563958&siteId=291194637