PageRenderTime 52ms CodeModel.GetById 40ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/thirdparty/SPMediaKeyTap/SPInvocationGrabbing/main.m

http://github.com/tomahawk-player/tomahawk
Objective C | 38 lines | 35 code | 3 blank | 0 comment | 0 complexity | 64cedb4901f14b8f82160d41834812c7 MD5 | raw file
 1#import <Cocoa/Cocoa.h>
 2#import "NSObject+SPInvocationGrabbing.h"
 3
 4@interface Foo : NSObject {
 5    int a;
 6}
 7-(void)startIt;
 8-(void)theBackgroundStuff;
 9-(void)theForegroundStuff;
10@end
11
12@implementation Foo
13-(void)startIt;
14{
15    NSLog(@"Starting out on the main thread...");
16    a = 3;
17    [[self inBackground] theBackgroundStuff];
18}
19-(void)theBackgroundStuff;
20{
21    NSLog(@"Woah, this is a background thread!");
22    a += 6;
23    [[self onMainAsync:YES] theForegroundStuff];
24}
25-(void)theForegroundStuff;
26{
27    NSLog(@"Hey presto: %d", a);
28}
29@end
30
31int main() {
32    NSAutoreleasePool *pool = [NSAutoreleasePool new];
33    Foo *foo = [Foo new];
34    [foo startIt];
35    [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
36    [pool release];
37    return 0;
38}