-
Notifications
You must be signed in to change notification settings - Fork 5
SNThreadSafeArray
Ju Liaoyuan edited this page Dec 20, 2022
·
1 revision
Inherits from NSMutableArray
Declared in SNThreadSafeArray.h
SNThreadSafeArray.m
A simple implementation of thread safe mutable array.Generally, access performance is lower than NSMutableArray,
but higher than using @synchronized, NSLock, or pthread_mutex_t.It’s also compatible with the custom methods in NSArray(YYAdd)
and NSMutableArray(YYAdd)
source code from YYKit
Warning: Fast enumerate(for..in) and enumerator is not thread safe, use enumerate using block instead. When enumerate or sort with block/callback, do NOT send message to the array inside the block/callback.
Sona Wiki