开发者

Synchronizing NSMutableArray for Thread Security ?

I have a Threaded application, in which there is a NSMutableArray, which contains the NSManagedObjects, Now i want my array to be accesse开发者_如何学God once at a time by any Thread. So how do i synchronize that array, or may be put locking mechanism on it.

Thanks in Advance ...


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

@synchronized(myArray) {
  [myArray doSomething];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜