Here the self identifier declares a thread local variable time.
这里的self标识符声明一个线程局部变量time。
Note that the address of a thread local variable is valid only as long as the thread in which the address was taken still exists.
请注意:只有在其中获取地址的线程仍然存在的情况下,线程本地变量的地址才有效。
In standard c, the effect of this is to forbid the use of the address of a thread local variable as an initializer for an object or pointer.
在标准c中,这种作法的效果是禁止将线程本地变量的地址用作对象或指针的初始值设定项。
While no one would ever directly use the idiom in Listing 1, this code is very similar to the case where the lock associated with a synchronized block can be proven to be a thread-local variable.
虽然没有人会直接使用清单1中的形式,但是与这个代码非常类似的情况是:可以证实与synchronized块关联的锁是一个线程本地变量。
To create a thread-local variable, you instantiate an object of class ThreadLocal.
要创建一个线程局部变量,请实例化类ThreadLocal的一个对象。
To create a thread-local variable, you instantiate an object of class ThreadLocal.
要创建一个线程局部变量,请实例化类ThreadLocal的一个对象。
应用推荐