美文网首页
swift中互斥锁

swift中互斥锁

作者: 张群 | 来源:发表于2018-03-17 13:02 被阅读19次

    在swift中,互斥锁如何写oc中的互斥锁:@synchronized(self) { 

     //需要执行的代码块

     }

    swift中的互斥锁

    objc_sync_enter(self) 

    //需要执行的代码块 

    objc_sync_exit(self)

    至于其他多线程的API和以前的一样,只是少了perform这一类的API,苹果已经去掉了

    相关文章

      网友评论

          本文标题:swift中互斥锁

          本文链接:https://www.haomeiwen.com/subject/fscjqftx.html