This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Xcode4.4 | |
// llvm4の機能のうち一部が、 | |
// iOS 5.1 SDK で使えない | |
// 例 | |
NSNumber *b = @YES; // error | |
NSArray *array = @[ @1, @2, @3 ]; | |
NSNumber *n = array[1]; // error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* KVOChangeScope -- Conveniently mark edits for Key-Value Observations in | |
* Objective-C++ in custom setters. | |
* | |
* Example: | |
* | |
* - (void)setFoo:(id)value { | |
* kvo_scoped_change(foo); | |
* // your setter code here which might return at any moment | |
* } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main (int argc, const char * argv[]) { | |
dispatch_queue_t waitingChairs = dispatch_queue_create("waitingChairs", 0); | |
dispatch_queue_t barber = dispatch_queue_create("barber", 0); | |
dispatch_semaphore_t semaphore = dispatch_semaphore_create(3); | |
NSInteger ident = 0; | |
while (++ident) { | |
if (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW) != 0) { | |
printf("Customer %d turned away\n", ident); | |
continue; | |
} |
NewerOlder