LockBlocks 0.0.2

LockBlocks 0.0.2

TestsTested
LangLanguage Obj-CObjective C
License BSD
ReleasedLast Release Dec 2014

Maintained by Unclaimed.


Downloads

Total9,368
Week0
Month0

Installs

Apps27
Test Targets5
powered by Segment

GitHub

Stars8
Watchers0
Forks3
Issues0
Contributors2
Pull Requests0

Code

Files7
LOCLines of Code 199


  • By
  • Nate Petersen

Overview

LockBlocks adds block methods to Objective-C Lock objects. It also adds a Read/Write Lock class.

Usage

Instead of making a call like this:

[myLock lock];

... critical code ...

[myLock unlock];

With LockBlocks you use the block-based methods that call lock and unlock for you:

[myLock executeInLock:^{
    ... critical code ...
}];

This more clearly delineates what is a critical section of your code, and helps avoid forgetting to release the lock.

LockBlocks also adds an Objective-C version of a Read/Write Lock (implemented using pthreads). This allows you to use exclusive/non-exclusive locks. Please read the important note about re-entrancy (recursion) in DRReadWriteLock.h.

Installation

I highly recommend that you use CocoaPods to integrate LockBlocks into your app. If you aren't familiar with it, CocoaPods is an awesomely simple dependency manager for Objective-C projects. You can get more info about it here.

If you're using CocoaPods, all you have to do is put this line in your Podfile:

pod 'LockBlocks',   '0.0.1'

And you're done.


If you aren't using CocoaPods (Why not? What's your problem??) then you'll have to just grab the LockBlocks source and drop it into your project.

Caveats

LockBlocks version 0.0.1 is still a beta release. Some of the methods have not been thoroughly tested. Use at your own risk, and please file a bug if you encounter any problems.

Contact

If you end up using LockBlocks in a project, I'd love to hear about it.

email: [email protected]
twitter: @nate_petersen