Skip to content

Instantly share code, notes, and snippets.

@danmartyn
Created October 15, 2013 04:18
Show Gist options
  • Select an option

  • Save danmartyn/6986419 to your computer and use it in GitHub Desktop.

Select an option

Save danmartyn/6986419 to your computer and use it in GitHub Desktop.

Revisions

  1. danmartyn created this gist Oct 15, 2013.
    14 changes: 14 additions & 0 deletions GCD
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    // Doing something on the main thread

    dispatch_queue_t myQueue = dispatch_queue_create("My Queue",NULL);
    dispatch_async(myQueue, ^{
    // Perform long running process

    dispatch_async(dispatch_get_main_queue(), ^{
    // Update the UI

    });
    });

    // Continue doing other stuff on the
    // main thread while process is running.