前提:jdk8
ConcurrentLinkedQueue 的注释中有这么一段话:
Memory consistency effects: As with other concurrent collections, actions in a thread prior to placing an object into a ConcurrentLinkedQueue happen-before actions subsequent to the access or removal of that element from the ConcurrentLinkedQueue in another thread.
翻译过来就是:先发生的插入操作 happen-before 后发生的访问或移除操作。
看了下内存一致性的相关概念,还是有点云里雾里。总之,上面这句话,是通过 ConcurrentLinkedQueue 的代码实现(源码也看过了)来保证的吗?还是通过更底层的东西来保证的?
怎么做到保证的啊。
求大佬们帮忙解答