并发共享数据时,Python 比 C++ 省心,是因为【0】。
内存模型对比:bytecode_atomic(语言)——CPython 单条字节码在 GIL 下不可分;needs_atomic_type=C++ 才要显式 atomic;guaranteed_ordering、safe(语言, 用没用 atomic)。
bytecode_atomic(语言)
needs_atomic_type
guaranteed_ordering
safe(语言, 用没用 atomic)
全部评论