ATUnitySafeThreadDictionary.h 691 B

12345678910111213141516171819202122
  1. // ATSafeThreadDictionary.h
  2. // ATSDK
  3. //
  4. // Created by topon on 2020/9/21.
  5. // Copyright © 2020 AnyThink. All rights reserved.
  6. //
  7. #import <Foundation/Foundation.h>
  8. /**
  9. A simple implementation of thread safe mutable dictionary.
  10. @discussion Generally, access performance is lower than NSMutableDictionary,
  11. but higher than using @synchronized, NSLock, or pthread_mutex_t.
  12. @warning Fast enumerate(for...in) and enumerator is not thread safe,
  13. use enumerate using block instead. When enumerate or sort with block/callback,
  14. do *NOT* send message to the dictionary inside the block/callback.
  15. */
  16. @interface ATUnitySafeThreadDictionary<KeyType, ObjectType> : NSMutableDictionary
  17. @end