Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Concurrency in iOS: #iOScon 2016

sammyd
May 26, 2016

Concurrency in iOS: #iOScon 2016

What is concurrency? Why use it? Why is so bloody hard?

Learn about using concurrency on Apple's platforms, and how you can improve your app by taking full advantage of the device.

Presented at #iOScon 2016.

sammyd

May 26, 2016
Tweet

More Decks by sammyd

Other Decks in Programming

Transcript

  1. Race Condition time Value 1 1 1 2 2 Thread

    1 Thread 2 inc r1 w2 +1 inc
  2. Race Condition time Value 1 1 1 2 2 2

    Thread 1 Thread 2 inc r1 w2 +1 inc r2
  3. Race Condition time Value 1 1 1 2 2 2

    2 Thread 1 Thread 2 inc r1 w2 +1 inc r2 +1
  4. Race Condition time Value 1 1 1 2 2 2

    2 3 Thread 1 Thread 2 inc r1 w2 +1 inc r2 w3 +1
  5. Race Condition time Value 1 1 1 1 Thread 1

    Thread 2 inc r1 inc r1 +1
  6. Race Condition time Value 1 1 1 2 1 Thread

    1 Thread 2 inc r1 inc r1 w2 +1
  7. Race Condition time Value 1 1 1 2 1 2

    Thread 1 Thread 2 inc r1 +1 inc r1 w2 +1
  8. Race Condition time Value 1 1 1 2 1 2

    2 Thread 1 Thread 2 inc r1 w2 +1 inc r1 w2 +1
  9. Thread Safety time Value 1111 1112 1122 1223 Thread 1

    Thread 2 r1111 w2222 r1122 w3333 Thread 3 r1223
  10. Thread Safety time Value 1111 1112 1122 1223 2233 Thread

    1 Thread 2 r1111 w2222 r1122 w3333 Thread 3 r1223
  11. Thread Safety time Value 1111 1112 1122 1223 2233 2333

    Thread 1 Thread 2 r1111 w2222 r1122 r2333 w3333 Thread 3 r1223
  12. Thread Safety time Value 1111 1112 1122 1223 2233 2333

    3333 Thread 1 Thread 2 r1111 w2222 r1122 r2333 w3333 Thread 3 r1223
  13. Thread Safety time Value 1111 1112 1122 1223 2233 2333

    3333 3333 3333 Thread 1 Thread 2 r1111 w2222 r1122 r2333 w3333 Thread 3 r1223 r3333 r3333
  14. promises networkRequest(url, callback: { data in decompressor(data, callback: { image

    in imageResizer(image, callback: { small in filterImage(small, callback: { filtered in displayImage(filtered) }) }) }) })