Skip to content

Instantly share code, notes, and snippets.

@jspahrsummers
Created November 24, 2015 16:11

Revisions

  1. jspahrsummers created this gist Nov 24, 2015.
    15 changes: 15 additions & 0 deletions main.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #import <Foundation/Foundation.h>

    int main (int argc, const char **argv) {
    @autoreleasepool {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    dispatch_sync(dispatch_get_main_queue(), ^{
    NSLog(@"is main thread? %i", (int)[NSThread isMainThread]);
    });
    });

    dispatch_main();
    }

    return 0;
    }
    1 change: 1 addition & 0 deletions output.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    2015-11-24 16:08:39.545 main[88889:21446128] is main thread? 0