Suche senden
Hochladen
Threading in iOS / Cocoa Touch
•
Als KEY, PDF herunterladen
•
2 gefällt mir
•
2,808 views
M
mobiledeveloperpl
Folgen
Karol Kozimor talking at Cracow.mobi 2011
Weniger lesen
Mehr lesen
Technologie
Bildung
Melden
Teilen
Melden
Teilen
1 von 61
Jetzt herunterladen
Empfohlen
iOS Multithreading
iOS Multithreading
Richa Jain
Multithreading and Parallelism on iOS [MobOS 2013]
Multithreading and Parallelism on iOS [MobOS 2013]
Kuba Břečka
Grand Central Dispatch Design Patterns
Grand Central Dispatch Design Patterns
Robert Brown
Grand Central Dispatch
Grand Central Dispatch
cqtt191
Introduction to TPL
Introduction to TPL
Gyuwon Yi
Concurrency Programming in Java - 07 - High-level Concurrency objects, Lock O...
Concurrency Programming in Java - 07 - High-level Concurrency objects, Lock O...
Sachintha Gunasena
Java Concurrency in Practice
Java Concurrency in Practice
Alina Dolgikh
Java Concurrency, Memory Model, and Trends
Java Concurrency, Memory Model, and Trends
Carol McDonald
Empfohlen
iOS Multithreading
iOS Multithreading
Richa Jain
Multithreading and Parallelism on iOS [MobOS 2013]
Multithreading and Parallelism on iOS [MobOS 2013]
Kuba Břečka
Grand Central Dispatch Design Patterns
Grand Central Dispatch Design Patterns
Robert Brown
Grand Central Dispatch
Grand Central Dispatch
cqtt191
Introduction to TPL
Introduction to TPL
Gyuwon Yi
Concurrency Programming in Java - 07 - High-level Concurrency objects, Lock O...
Concurrency Programming in Java - 07 - High-level Concurrency objects, Lock O...
Sachintha Gunasena
Java Concurrency in Practice
Java Concurrency in Practice
Alina Dolgikh
Java Concurrency, Memory Model, and Trends
Java Concurrency, Memory Model, and Trends
Carol McDonald
Effective java - concurrency
Effective java - concurrency
feng lee
Concurrency and Thread-Safe Data Processing in Background Tasks
Concurrency and Thread-Safe Data Processing in Background Tasks
WO Community
Java Concurrency Gotchas
Java Concurrency Gotchas
Alex Miller
Concurrency with java
Concurrency with java
Hoang Nguyen
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8
Martin Toshev
Parallel Programming With Dot Net
Parallel Programming With Dot Net
Neeraj Kaushik
Tech talk
Tech talk
Preeti Patwa
.NET Multithreading/Multitasking
.NET Multithreading/Multitasking
Sasha Kravchuk
Basics of Java Concurrency
Basics of Java Concurrency
kshanth2101
Java New Evolution
Java New Evolution
Allan Huang
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
Prashant Rane
Concurrency in Java
Concurrency in Java
Allan Huang
Efficient Android Threading
Efficient Android Threading
Anders Göransson
Java concurrency - Thread pools
Java concurrency - Thread pools
maksym220889
Java Concurrency
Java Concurrency
Carol McDonald
Java 8 - Stamped Lock
Java 8 - Stamped Lock
Haim Yadid
Android development training programme , Day 3
Android development training programme , Day 3
DHIRAJ PRAVIN
Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners
Paddy Lock
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
Unity Technologies Japan K.K.
Java concurrency
Java concurrency
Abhijit Gaikwad
iOS Ecosystem
iOS Ecosystem
Matteo Battaglio
Memory Management on iOS
Memory Management on iOS
Make School
Weitere ähnliche Inhalte
Was ist angesagt?
Effective java - concurrency
Effective java - concurrency
feng lee
Concurrency and Thread-Safe Data Processing in Background Tasks
Concurrency and Thread-Safe Data Processing in Background Tasks
WO Community
Java Concurrency Gotchas
Java Concurrency Gotchas
Alex Miller
Concurrency with java
Concurrency with java
Hoang Nguyen
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8
Martin Toshev
Parallel Programming With Dot Net
Parallel Programming With Dot Net
Neeraj Kaushik
Tech talk
Tech talk
Preeti Patwa
.NET Multithreading/Multitasking
.NET Multithreading/Multitasking
Sasha Kravchuk
Basics of Java Concurrency
Basics of Java Concurrency
kshanth2101
Java New Evolution
Java New Evolution
Allan Huang
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
Prashant Rane
Concurrency in Java
Concurrency in Java
Allan Huang
Efficient Android Threading
Efficient Android Threading
Anders Göransson
Java concurrency - Thread pools
Java concurrency - Thread pools
maksym220889
Java Concurrency
Java Concurrency
Carol McDonald
Java 8 - Stamped Lock
Java 8 - Stamped Lock
Haim Yadid
Android development training programme , Day 3
Android development training programme , Day 3
DHIRAJ PRAVIN
Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners
Paddy Lock
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
Unity Technologies Japan K.K.
Java concurrency
Java concurrency
Abhijit Gaikwad
Was ist angesagt?
(20)
Effective java - concurrency
Effective java - concurrency
Concurrency and Thread-Safe Data Processing in Background Tasks
Concurrency and Thread-Safe Data Processing in Background Tasks
Java Concurrency Gotchas
Java Concurrency Gotchas
Concurrency with java
Concurrency with java
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8
Parallel Programming With Dot Net
Parallel Programming With Dot Net
Tech talk
Tech talk
.NET Multithreading/Multitasking
.NET Multithreading/Multitasking
Basics of Java Concurrency
Basics of Java Concurrency
Java New Evolution
Java New Evolution
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
Concurrency in Java
Concurrency in Java
Efficient Android Threading
Efficient Android Threading
Java concurrency - Thread pools
Java concurrency - Thread pools
Java Concurrency
Java Concurrency
Java 8 - Stamped Lock
Java 8 - Stamped Lock
Android development training programme , Day 3
Android development training programme , Day 3
Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
Java concurrency
Java concurrency
Andere mochten auch
iOS Ecosystem
iOS Ecosystem
Matteo Battaglio
Memory Management on iOS
Memory Management on iOS
Make School
iOS Memory Management
iOS Memory Management
Asim Rais Siddiqui
iOS Memory Management Basics
iOS Memory Management Basics
Bilue
Apple iOS - A modern way to mobile operating system
Apple iOS - A modern way to mobile operating system
Dhruv Patel
Apple iOS
Apple iOS
Chetan Gowda
iOS platform
iOS platform
maya_slides
CPU Scheduling Algorithms
CPU Scheduling Algorithms
Shubhashish Punj
Andere mochten auch
(8)
iOS Ecosystem
iOS Ecosystem
Memory Management on iOS
Memory Management on iOS
iOS Memory Management
iOS Memory Management
iOS Memory Management Basics
iOS Memory Management Basics
Apple iOS - A modern way to mobile operating system
Apple iOS - A modern way to mobile operating system
Apple iOS
Apple iOS
iOS platform
iOS platform
CPU Scheduling Algorithms
CPU Scheduling Algorithms
Ähnlich wie Threading in iOS / Cocoa Touch
Node.js primer for ITE students
Node.js primer for ITE students
Quhan Arunasalam
Opening opensource : The Jenkins Way
Opening opensource : The Jenkins Way
Nicolas De Loof
Ma forge++ : @Cloud
Ma forge++ : @Cloud
Nicolas De Loof
Netty - anfix tech&beers
Netty - anfix tech&beers
jorgecarabias
2013-05-15 threads. why and how
2013-05-15 threads. why and how
CocoaHeads Tricity
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
Tom Croucher
Webconf nodejs-production-architecture
Webconf nodejs-production-architecture
Ben Lin
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
Sencha
Introduction to node.js
Introduction to node.js
Su Zin Kyaw
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
Netcetera
Tamir Dresher - Demystifying the Core of .NET Core
Tamir Dresher - Demystifying the Core of .NET Core
Tamir Dresher
Implementing Parallelism in PostgreSQL - PGCon 2014
Implementing Parallelism in PostgreSQL - PGCon 2014
EDB
.NET on Linux: Entity Framework Core 1.0
.NET on Linux: Entity Framework Core 1.0
All Things Open
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Eugene Yokota
NodeJS
NodeJS
LinkMe Srl
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
Alex Thissen
node.js: Javascript's in your backend
node.js: Javascript's in your backend
David Padbury
Road to sbt 1.0 paved with server
Road to sbt 1.0 paved with server
Eugene Yokota
Deploying on the cutting edge
Deploying on the cutting edge
ericholscher
Python, async web frameworks, and MongoDB
Python, async web frameworks, and MongoDB
emptysquare
Ähnlich wie Threading in iOS / Cocoa Touch
(20)
Node.js primer for ITE students
Node.js primer for ITE students
Opening opensource : The Jenkins Way
Opening opensource : The Jenkins Way
Ma forge++ : @Cloud
Ma forge++ : @Cloud
Netty - anfix tech&beers
Netty - anfix tech&beers
2013-05-15 threads. why and how
2013-05-15 threads. why and how
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
Webconf nodejs-production-architecture
Webconf nodejs-production-architecture
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
Introduction to node.js
Introduction to node.js
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
Tamir Dresher - Demystifying the Core of .NET Core
Tamir Dresher - Demystifying the Core of .NET Core
Implementing Parallelism in PostgreSQL - PGCon 2014
Implementing Parallelism in PostgreSQL - PGCon 2014
.NET on Linux: Entity Framework Core 1.0
.NET on Linux: Entity Framework Core 1.0
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
NodeJS
NodeJS
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
node.js: Javascript's in your backend
node.js: Javascript's in your backend
Road to sbt 1.0 paved with server
Road to sbt 1.0 paved with server
Deploying on the cutting edge
Deploying on the cutting edge
Python, async web frameworks, and MongoDB
Python, async web frameworks, and MongoDB
Kürzlich hochgeladen
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Allon Mureinik
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
Slack Application Development 101 Slides
Slack Application Development 101 Slides
praypatel2
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Roshan Dwivedi
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Malak Abu Hammad
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
The Digital Insurer
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
Pooja Nehwal
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Sinan KOZAK
Kürzlich hochgeladen
(20)
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Slack Application Development 101 Slides
Slack Application Development 101 Slides
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Threading in iOS / Cocoa Touch
1.
simply mobile
2.
About Me Used to
be a Linux kernel developer Currently developing hardware accessories for iOS © 2011
3.
What this talk
isn’t about © 2011
4.
What this talk
isn’t about Hardware accessories © 2011
5.
What this talk
isn’t about Hardware accessories App Store overnight success © 2011
6.
What this talk
isn’t about Hardware accessories App Store overnight success POSIX threads © 2011
7.
150% thread content
© 2011
8.
Plan 1. Why we
love and hate threads 2. Grand Central Dispatch 3. NSThread class © 2011
9.
Threading ©
2011
10.
Threading Not only for
multi-core chips © 2011
11.
Threading Not only for
multi-core chips Responsiveness is the king © 2011
12.
Threading Not only for
multi-core chips Responsiveness is the king “The snappy” © 2011
13.
Threading Not only for
multi-core chips Responsiveness is the king “The snappy” Asynchronicity © 2011
14.
Half-measures Asynchronous I/O CoreData Notifications and
KVO © 2011
15.
General solution Threads
© 2011
16.
Downsides Overhead Especially on embedded
systems #1 issue: threads are difficult © 2011
17.
Really? Thread management IPC, messaging,
synchronization Locking Reentrancy ??? © 2011
18.
Solution Grand Central Dispatch
© 2011
19.
Grand Central Dispatch Language
features Runtime libraries System enhancements © 2011
20.
Together Automate thread management
© 2011
21.
22.
Language features: blocks Small,
self-contained pieces of code Anonymous, inline collection of code Available: Snow Leopard, iOS 4.0 © 2011
23.
Blocks features Typed arguments Return
value Access (and modify) variables © 2011
24.
Mainly useful as Callbacks Self-contained
units of work © 2011
25.
Syntax BOOL (^block)(void); BOOL areKittensCute
= YES; block = ^{ return areKittensCute; }; © 2011
26.
Example - (void)blink:(UIColor *)color {
self.view.backgroundColor = color; [UIView animateWithDuration:1.0 animations:^{self.view.backgroundColor = [UIColor darkGrayColor];}]; } © 2011
27.
28.
Grand Central API GCD
provides FIFO queues for blocks Three types: Main Concurrent Serial © 2011
29.
Concurrent queues Blocks dequeued
in FIFO order … but run concurrently if resources allow Finish in any order Created automatically © 2011
30.
Serial queues Useful for
serialization of tasks Created manually dispatch_queue_create(“com.yourname.queue”, NULL); © 2011
31.
Really? Thread management IPC, messaging,
synchronization Locking Reentrancy ??? © 2011
32.
When queues are
not enough Dispatch sources © 2011
33.
Dispatch source API C-level
API Can monitor for events (signals, data) and dispatch handlers to appropriate queues Low-level, useful for OS X but maybe not for iOS © 2011
34.
Back to square
one NSThread class © 2011
35.
The real thing Cost
of threads: Creation time Memory footprint (512 kB) Design overhead © 2011
36.
Conclusion — Don’t use
threads! © 2011
37.
… unless you have
no other choice High level event monitoring © 2011
38.
Thread lifecycle 1. Initialize 2.
Start 1. Create autorelease pool, setup sources 2. Do work 3. Cancel 4. Drain pool © 2011
39.
Thread init newThread =
[[NSThread alloc] initWithTarget:self selector:@selector(newThreadEntryPoint:) object:nil]; © 2011
40.
Entry point - (void)newThreadEntryPoint:(id)param {
… } © 2011
41.
Thread start [newThread start];
© 2011
42.
Housekeeping - (void)newThreadEntryPoint:(id)param {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; … } © 2011
43.
Get to work Two
options: Execute a predefined workset Monitor for events Run loop © 2011
44.
Event sources NSInputStream *catnipStream; [catnipStream
setDelegate:self]; [catnipStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [catnipStream open]; © 2011
45.
Running the loop do
{ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; } while (!done); © 2011
46.
The whole package -
(void)runThread { newThread = [[NSThread alloc] initWithTarget:self selector:@selector(newThreadEntryPoint:) object:nil]; [newThread start]; } - (void)newThreadEntryPoint:(id)param { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [catnipStream setDelegate:self]; [catnipStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [catnipStream open]; do { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; } while (!done); } © 2011
47.
Reuse & recycle What
if I need on-demand threads? © 2011
48.
Run loop maintenance do
{ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; } while (!done); © 2011
49.
Run loop maintenance do
{ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; } while ([[NSThread currentThread] isCancelled] == NO); © 2011
50.
Run loop maintenance do
{ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:5]]; } while ([[NSThread currentThread] isCancelled] == NO); © 2011
51.
Clean up! [catnipStream close]; [catnipStream
removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [catnipStream setDelegate:nil]; © 2011
52.
A lot of
code? - (void)runThread { newThread = [[NSThread alloc] initWithTarget:self selector:@selector(newThreadEntryPoint:) object:nil]; [newThread start]; } - (void)newThreadEntryPoint:(id)param { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [catnipStream setDelegate:self]; [catnipStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [catnipStream open]; do { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:5]]; } while ([[NSThread currentThread] isCancelled] == NO); [catnipStream close]; [catnipStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [catnipStream setDelegate:nil]; [pool drain]; } © 2011
53.
More maintenance
Consider draining the autorelease pool from within the loop if the thread will be running for a long time do { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:5]]; [pool drain]; pool = [[NSAutoreleasePool alloc] init]; } while ([[NSThread currentThread] isCancelled] == NO); © 2011
54.
How to quit? [newThread
cancel]; Safe to use from any thread © 2011
55.
Conclusions iOS applications are
heavily threaded internally Main thread, web rendering thread etc. GCD is also implemented via threads © 2011
56.
Caveats Key-value observers are
always executed in the current thread context What happens when KVO from secondary threads is used to handle or update UI outlets? © 2011
57.
58.
Solution performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait (on secondary
thread) [self performSelectorOnMainThread:@selector(updateField s:) withObject:data waitUntilDone:YES]; © 2011
59.
Why? Responsiveness!
© 2011
60.
Questions?
Karol Kozimor karol.kozimor@iosyn.com © 2011
61.
More info Concurrency Programming
Guide Operation Queues Threading Programming Guide WWDC 2011: Blocks and Grand Central Dispatch in Practice © 2011
Hinweis der Redaktion
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Jetzt herunterladen