You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[@DylanYang](https://github.com/Dylan19Yang):作者为我们介绍了 Swift 6 和 iOS 18 下的新同步框架,其中主要包含了两个底层结构 Mutex 和 Atomics。作者在本文中对这两个新的能力做了较为详细的说明和性能比对。Mutex 能使得对被他包裹的数据的访问自动上锁,在性能上和手动通过代码上锁区别不大,但是相比使用 Actor 有不少提升。不过相比 Actor 的缺点自然是锁会阻塞当前线程。而 Atomic 则可以使被他包裹的操作都为原子操作不会被并发打断。从性能上看它和 Actor 比并没有较大优势,因此大多数情况下使用 Actor 已经足够。对同步框架感兴趣的读者可以花时间阅读下本文。
0 commit comments