GRKConcurrentCollections 1.0

GRKConcurrentCollections 1.0

TestsTested
LangLanguage Obj-CObjective C
License CC
ReleasedLast Release May 2015

Maintained by Levi Brown.



Threadsafe collections for Objective C.

A collection of classes which encapsulate NSMutableArray, NSMutableDictionary, and NSMutableSet for threadsafe concurrent read and write access. Inspired by a post by Mike Ash.

Future Ideas

  • More comprehensive tests.
  • Additional collection types.

Installing

If you're using CocoPods it's as simple as adding this to your Podfile:

pod 'GRKConcurrentCollections'

otherwise, simply add the contents of the GRKConcurrentCollections subdirectory to your project.

Documentation

To use, simply import the header for the collection you want to use:

#import "GRKConcurrentMutableArray.h"
#import "GRKConcurrentMutableDictionary.h"
#import "GRKConcurrentMutableSet.h"

Then you can use instances of the same to perform read and write operations to the instances from multiple threads without being concerned about collisions.

Please note that when modifying the contents of the collections from multiple threads, the actual contents will be unpredictable due to thread scheduling. One should consider using the "Snapshot" methods to get the contents at any one particular time, or the augmentWithBlock: method to perform a sequence of operations on the collection without being concerned about concurrency.

Additional documentation is available in each header file.

Disclaimer and Licence

About

A professional iOS engineer by day, my name is Levi Brown. Authoring a blog grokin.gs, I am reachable via:

Twitter @levigroker
App.net @levigroker
Email [email protected]

Your constructive comments and feedback are always welcome.