Python线程间共享变量的原子性(如互斥锁)
发布时间
阅读量:
阅读量
What kinds of global value mutation are thread-safe?
A global interpreter lock (GIL) restricts execution to a single thread within the Python virtual machine. Generally, switching among threads occurs between bytecode instructions; the interval for such switches can be configured using sys.setswitchinterval(). Each bytecode instruction, along with all associated C implementation code, forms an atomic operation as seen by a Python program.
In theory, this implies a precise accounting necessitates a thorough grasp of the PVM bytecode implementation. In practice, it indicates that processi
全部评论 (0)
还没有任何评论哟~
