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

SwiftConf 2016: Concurrency on iOS

sammyd
September 08, 2016

SwiftConf 2016: Concurrency on iOS

...queueing for the futures

Some slides that accompany a talk presented at SwiftConf 2016. You should check out the Xcode Playground to get a better understanding of what the hell is going on

sammyd

September 08, 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) }) }) }) })