Skip to content

Commit

Permalink
Documents USE_BLOCKS_BASED_LOCKING define. Refs #10.
Browse files Browse the repository at this point in the history
  • Loading branch information
Grzegorz Adam Hankiewicz committed Jan 11, 2012
1 parent d29a3e7 commit 1f1d3af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.markdown
Expand Up @@ -18,6 +18,8 @@ App Store

For iOS work, or Mac App Store work, you will probably want to set both COREFOUNDATION_HACK_LEVEL and KVO_HACK_LEVEL to `0`. In this mode, MAZeroingWeakRef uses no private APIs.

Also, if you need your app to run on iOS 3.x you need to disable blocks based code setting USE_BLOCKS_BASED_LOCKING to `0`.

Source Code
-----------

Expand Down
14 changes: 13 additions & 1 deletion Source/MAZeroingWeakRef.m
Expand Up @@ -48,6 +48,19 @@
#define KVO_HACK_LEVEL 1
#endif

/*
The USE_BLOCKS_BASED_LOCKING macro allows control on the code structure used
during lock checking. You want to disable blocks if you want your app to work
on iOS 3.x devices. iOS 4.x and above can use blocks.
1 - Use blocks for lock checks.
0 - Don't use blocks for lock checks.
*/
#ifndef USE_BLOCKS_BASED_LOCKING
#define USE_BLOCKS_BASED_LOCKING 1
#endif

#if KVO_HACK_LEVEL >= 1
@interface NSObject (KVOPrivateMethod)

Expand Down Expand Up @@ -192,7 +205,6 @@ + (void)initialize
}
}

#define USE_BLOCKS_BASED_LOCKING 1
#if USE_BLOCKS_BASED_LOCKING
#define BLOCK_QUALIFIER __block
static void WhileLocked(void (^block)(void))
Expand Down

0 comments on commit 1f1d3af

Please sign in to comment.