Your SlideShare is downloading. ×
0
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Grand centraldispatch
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Grand centraldispatch

1,193

Published on

東京iPhone勉強会 #6 発表資料

東京iPhone勉強会 #6 発表資料

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,193
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
11
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. 2
    • 2. 3
    • 3. 4
    • 4. 5
    • 5. 6
    • 6. 7
    • 7. 8
    • 8. 9
    • 9. 10
    • 10. 12
    • 11. 13
    • 12. 14
    • 13. 15
    • 14. 16
    • 15. 17
    • 16. 18
    • 17. 19
    • 18. 21
    • 19. 22
    • 20. 23
    • 21. 24
    • 22. n = IO.read("count.txt") rescue "0"open("count.txt","w") {|f| f.puts n.to_i + 1} 26
    • 23. n = IO.read("count.txt") rescue "0" n = IO.read("count.txt") rescue "0"open("count.txt","w") {|f| f.puts n.to_i + 1} open("count.txt","w") {|f| f.puts n.to_i + 1} 27
    • 24. n = IO.read("count.txt") rescue "0"open("count.txt","w") {|f| f.puts n.to_i + 1} 28
    • 25. 29
    • 26. 30
    • 27. while (true) begin break if Dir.mkdir("lock.txt") rescue sleep(1) endendn = IO.read("count.txt") rescue "0"open("count.txt","w") {|f| f.puts n.to_i + 1}Dir.rmdir("lock.txt") 31
    • 28. lock(“a”) lock(“b”)lock(“b”) lock(“a”)unlock(“b”) unlock(“a”)unlock(“a”) unlock(“b”) 32
    • 29. 34
    • 30. 35
    • 31. 36
    • 32. 37
    • 33. - (void)countThread:(id)param{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [pool release];} [NSThread detachNewThreadSelector:@selector(countThread:) toTarget:self withObject:self]; NSLog(@"Thread started."); 38
    • 34. 39
    • 35. 40
    • 36. - (int) maxOfArray:(int *)a count:(int)n { static int max = 0; for (int i = 0; i < n; i++) { if (a[i] > max) max = a[i]; } return max;} 41
    • 37. - (int)randomNumber { static int rand = 7654321; rand = (rand * 12345 + 678901) & 0x7fff; return rand;} 42
    • 38. 43
    • 39. NSMutableDictionary *threadLoacl = [[NSTread currentThread] threadDictonary];[threadLocal setObject:@”Test” forKey:@”mode”];s = [threadLocal objectForKey:@”mode”] 44
    • 40. @interface MyInt : NSObject { int intValue;}@end@implementation MyInt-(int) getInt { return intValue;}-(void) setOddInt:(int)i { intValue = i; intValue = (intValue >> 1) << 1;}@end 45
    • 41. @interface MyString : NSObject { NSMutableString *str;}@end@implementation MyInt-(MyString *) getString { return str;}-(void) addString:(NSString *)s { [str appendString:s];}@end 46
    • 42. 47
    • 43. 48
    • 44. @interface MyPoint : NSObject { GCPoint point;}@end@implementation MyInt-(GCPoint) getPoint { return point;}-(void) setPoint:(GCPoint)p { point = p;}@end 49
    • 45. @interface MyString : NSObject { NSString *string;}@property (nonatomic, retain) NSString *string;@end@implementation MyString@synthesize string;@end 50
    • 46. 51
    • 47. 52
    • 48. 54
    • 49. 55
    • 50. 57
    • 51. 58
    • 52. 59
    • 53. @interface CountOperation : NSOperation { id delegate;}@implementation CountOperation- (id)initWithDelegate:(id)aDelegate { self = [super init]; if (self != nil) { delegate = aDelegate; } return self;}- (void)main { NSAutoreleasePool *pool = [NSAutoreleasePool new]; [pool release];}@end queue = [[NSOperationQueue alloc] init]; CountOperation *op = [[[CountOperation alloc] initWithDelegate:self] autorelease]; [queue addOperation:op]; NSLog(@"Thread started.");} 60
    • 54. 62
    • 55. 63
    • 56. {|ary| ^(NSArray *ary) { s = “” NSMutableString *s = [NSMutableString string]; for a in ary for (NSString *a in ary) { s += a [s appendString:a]; end } s return s;} } 64
    • 57. __block NSMutableString *s = [NSMutableString string];^(NSArray *ary) { for (NSString *a in ary) { [s appendString:a]; }} 65
    • 58. - (NSArray *)sortedArrayUsingSelector:(SEL)comparator- (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr 66
    • 59. 67
    • 60. 68
    • 61. 70
    • 62. 72

    ×