In a thread-safe program, only one writing thread can modify the variable; other threads can read the up-to-date value by declaring the variable volatile.
在一个线程安全的程序中,只有一个写线程能够修改这个变量;而其他的线程则可以读取volatile声明变量的最新值。
In a thread-safe program, only one writing thread can modify the variable; other threads can read the up-to-date value by declaring the variable volatile.
在一个线程安全的程序中,只有一个写线程能够修改这个变量;而其他的线程则可以读取volatile声明变量的最新值。
应用推荐