Synchronizing NSMutableArray for Thread Security ?

后端 未结 1 475
闹比i
闹比i 2020-12-14 03:56

I have a Threaded application, in which there is a NSMutableArray, which contains the NSManagedObjects, Now i want my array to be accessed once at

相关标签:
1条回答
  • 2020-12-14 04:54

    You could wrap every access to the class with something like the following:

    @synchronized(myArray) {
      [myArray doSomething];
    }
    
    0 讨论(0)
提交回复
热议问题