Lock Store provides a simple mechanism for key-based, read/write access to shared data across multiple threads.
You have two options for adding this library to your project: as a framework or as source.
Drag the LockStore.xcodeproj file into your app's Xcode project. Make sure that it is being added as a dependency.
With the library added to your project, you can now import the library header.
#import <NimbusKitLockStore/NimbusKitLockStore.h>
Drag all of the files from the src
directory into your app.
With the library added to your project, you can now import the library header.
#import "NimbusKitLockStore.h"
NILockStore plays nicely with Objective-C's @synchronized
for locking on a per-object basis.
NSString* const kSomeKey = @"somekey"; // Defined externally, likely as an extern
NILockStore* lockStore = [NILockStore new];
@synchronized(lockStore[kSomeKey]) {
// Read
id someThreadSafeObject = lockStore[kSomeKey].object;
// Write
lockStore[kSomeKey].object = someNewThreadSafeObject;
}
Initial release.
- Includes NILockStore.
Lock Store was built by Jeff Verkoeyen (featherless).
You can be the first! Open a pull request now.
NimbusKit's Lock Store is licensed under the BSD three-clause license. For a more permissive license (no redistribution of copyright notice, etc.), please contact Jeff at jverkoey@gmail.com for pricing.