Theiostream (talk | contribs) No edit summary |
(Fix typo. Bestow an IPFHeader transclusion.) |
||
Line 1: | Line 1: | ||
[[CPExclusiveLock]] provides system-wide locking through temporary files. You use CPExclusiveLock like any other <code>NSLocking</code>-conformant classes, e.g. | |||
[[CPExclusiveLock]] provides system- | |||
<source lang="objc"> | <source lang="objc"> | ||
CPExclusiveLock* syslock = [[CPExclusiveLock alloc] initWithName:@"MyExclusiveLock"]; | CPExclusiveLock* syslock = [[CPExclusiveLock alloc] initWithName:@"MyExclusiveLock"]; | ||
Line 13: | Line 11: | ||
== Header == | == Header == | ||
{{IPFHeader|AppSupport}} |
Revision as of 22:01, 9 December 2012
CPExclusiveLock provides system-wide locking through temporary files. You use CPExclusiveLock like any other NSLocking
-conformant classes, e.g.
CPExclusiveLock* syslock = [[CPExclusiveLock alloc] initWithName:@"MyExclusiveLock"];
[syslock lock];
[device doOperation:1 :2 :3 :4];
[syslock unlock];
A CPExclusiveLock will create a temporary file in ~/Library/Caches
. If the name is given, it will be used as the filename.
When the lock is acquired, the object will open the temporary file with O_NONBLOCK|O_EXLOCK|O_CREAT
mode.
Header
- Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/AppSupport/CPExclusiveLock.h
|