这些指令大多数是为了检查i的初始化,以及使用锁执行线程安全的初始化。
Most of these instructions are in place to check for the initialization of I, and to perform a thread-safe initialization using a lock.
Node 声称它绝不会死锁,因为它根本不允许使用锁,它不会直接阻塞 I/O 调用。
Node also claims that it will never deadlock, since there are no locks allowed, and it doesn't directly block for I/O calls.
很多并发性专家事实上往往引导用户远离volatile变量,因为使用它们要比使用锁更加容易出错。
Many concurrency experts tend to guide users away from using volatile variables at all, because they are harder to use correctly than locks.
应用推荐