SlideShare a Scribd company logo
1 of 13
Grand Central Dispatch Dispatch Dispatch
Work dispatch_block_t or dispatch_function_t dispatch_queue_t dispatch_source_t dispatch_group_t Queue
^ { for ( int  i =  0 ; i < something very large; i++) { do_heavy_work(); and_keep_doing_it(); } } dispatch_async (..., );
dispatch_async_f(..., ); function foo(void *context) { for ( int  i =  0 ; i < something very large; i++) { do_heavy_work(); and_keep_doing_it(); } } NULL , &foo
^ { for ( int  i =  0 ; i < something very large; i++) { do_heavy_work(); sum += and_keep_doing_it(); } } dispatch_sync (..., ); __block int  sum =  0 ; NSRunAlertPanel ( @&quot;Found the sum!&quot; ,  @&quot;It's: %d&quot; ,  @&quot;OK&quot; ,  nil ,  nil , sum);
Main queue Global queues dispatch_get_main_queue () dispatch_get_global_queue ( X ,  0 ) DISPATCH_QUEUE_PRIORITY_LOW DISPATCH_QUEUE_PRIORITY_DEFAULT DISPATCH_QUEUE_PRIORITY_HIGH Custom queues dispatch_queue_create() serial concurrent serial
^ { for ( int  i =  0 ; i < something very large; i++) { do_heavy_work(); sum += and_keep_doing_it(); } } dispatch_async ( dispatch_get_global_queue ( 0 ,  0 ) , ); __block int  sum =  0 ; NSRunAlertPanel ( @&quot;Found the sum!&quot; ,  @&quot;It's: %d&quot; ,  @&quot;OK&quot; ,  nil ,  nil , sum);
^ { for ( int  i =  0 ; i < something very large; i++) { do_heavy_work(); sum += and_keep_doing_it(); } dispatch_async ( dispatch_get_main_queue () , ); } dispatch_async ( dispatch_get_global_queue ( 0 ,  0 ) , ); __block int  sum =  0 ; ^ { NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; ,  nil ,  nil , sum); }
^ { do_heavy_work(); sum += and_keep_doing_it(); } dispatch_queue_t global = dispatch_get_global_queue( 0 ,  0 ); dispatch_apply (something very large, global, ); __block int  sum =  0 ; NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; ,  nil ,  nil , sum );
^ { do_heavy_work(); sum += and_keep_doing_it(); } dispatch_queue_t global = dispatch_get_global_queue( 0 ,  0 ); dispatch_apply (something very large, global, ); __block int  sum =  0 ; NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; ,  nil ,  nil , sum );
^ { do_heavy_work(); sum += and_keep_doing_it(); } dispatch_queue_t global = dispatch_get_global_queue( 0 ,  0 ); dispatch_group_t  group =  dispatch_group_create (); for ( int  i =  0 ; i < something very large; i++) { dispatch_group_async (group, queue, ); } __block int  sum =  0 ; dispatch_group_notify (group, queue, ); dispatch_release (group); NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; ,  nil ,  nil , sum );
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
http://mikeash.com/?page=pyblog http://thirdcog.eu/pwcblocks/ http://thirdcog.eu/pwcblocks/ http://thirdcog.eu/pwcblocks/

More Related Content

What's hot

Lec21-CS110 Computational Engineering
Lec21-CS110 Computational EngineeringLec21-CS110 Computational Engineering
Lec21-CS110 Computational EngineeringSri Harsha Pamu
 
Computer programing w
Computer programing wComputer programing w
Computer programing wcexpertise
 
Lessons learned from functional programming
Lessons learned from functional programmingLessons learned from functional programming
Lessons learned from functional programmingBryceLohr
 
Functional programming in Swift
Functional programming in SwiftFunctional programming in Swift
Functional programming in SwiftJohn Pham
 
Insert element position
Insert element positionInsert element position
Insert element positionKavya Shree
 
Swift で数学のススメ 〜 プログラミングと数学は同時に学べ
Swift で数学のススメ 〜 プログラミングと数学は同時に学べSwift で数学のススメ 〜 プログラミングと数学は同時に学べ
Swift で数学のススメ 〜 プログラミングと数学は同時に学べTaketo Sano
 
Add digits of number in c
Add digits of number in c Add digits of number in c
Add digits of number in c mohdshanu
 
C program to add two numbers
C program to add two numbers C program to add two numbers
C program to add two numbers mohdshanu
 
Python for Scientists
Python for ScientistsPython for Scientists
Python for ScientistsAndreas Dewes
 
Computer notes - Hashing
Computer notes - HashingComputer notes - Hashing
Computer notes - Hashingecomputernotes
 
Heap sort &amp; bubble sort
Heap sort &amp; bubble sortHeap sort &amp; bubble sort
Heap sort &amp; bubble sortShanmuga Raju
 
Ffffffffffff
FfffffffffffFfffffffffff
Ffffffffffffmohdshanu
 

What's hot (19)

week-10x
week-10xweek-10x
week-10x
 
PyLecture2 -NetworkX-
PyLecture2 -NetworkX-PyLecture2 -NetworkX-
PyLecture2 -NetworkX-
 
12 1 문자열
12 1 문자열12 1 문자열
12 1 문자열
 
Array
ArrayArray
Array
 
Progr2
Progr2Progr2
Progr2
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Lec21-CS110 Computational Engineering
Lec21-CS110 Computational EngineeringLec21-CS110 Computational Engineering
Lec21-CS110 Computational Engineering
 
Computer programing w
Computer programing wComputer programing w
Computer programing w
 
Lessons learned from functional programming
Lessons learned from functional programmingLessons learned from functional programming
Lessons learned from functional programming
 
Functional programming in Swift
Functional programming in SwiftFunctional programming in Swift
Functional programming in Swift
 
Insert element position
Insert element positionInsert element position
Insert element position
 
Swift で数学のススメ 〜 プログラミングと数学は同時に学べ
Swift で数学のススメ 〜 プログラミングと数学は同時に学べSwift で数学のススメ 〜 プログラミングと数学は同時に学べ
Swift で数学のススメ 〜 プログラミングと数学は同時に学べ
 
Add digits of number in c
Add digits of number in c Add digits of number in c
Add digits of number in c
 
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
 
C program to add two numbers
C program to add two numbers C program to add two numbers
C program to add two numbers
 
Python for Scientists
Python for ScientistsPython for Scientists
Python for Scientists
 
Computer notes - Hashing
Computer notes - HashingComputer notes - Hashing
Computer notes - Hashing
 
Heap sort &amp; bubble sort
Heap sort &amp; bubble sortHeap sort &amp; bubble sort
Heap sort &amp; bubble sort
 
Ffffffffffff
FfffffffffffFfffffffffff
Ffffffffffff
 

Viewers also liked

Bedrijf Zoekt App 2011 - Apps - Grondstof voor processen bij de overheid
Bedrijf Zoekt App 2011 - Apps - Grondstof voor processen bij de overheidBedrijf Zoekt App 2011 - Apps - Grondstof voor processen bij de overheid
Bedrijf Zoekt App 2011 - Apps - Grondstof voor processen bij de overheidPeter Keur
 
Ray searches
Ray searchesRay searches
Ray searchesDi Dawson
 
Akhuwat Leading organization through innovation 21042015
Akhuwat Leading organization through innovation 21042015Akhuwat Leading organization through innovation 21042015
Akhuwat Leading organization through innovation 21042015Akhuwat
 
Preferred method of working
Preferred method of workingPreferred method of working
Preferred method of workingDi Dawson
 
WSU Spokane Historical Talk
WSU Spokane Historical TalkWSU Spokane Historical Talk
WSU Spokane Historical TalkLarry Cebula
 
ICT op school, niet bij leren alleen
ICT op school, niet bij leren alleenICT op school, niet bij leren alleen
ICT op school, niet bij leren alleenPeter Keur
 
Taaleem Foundation Schools
Taaleem Foundation SchoolsTaaleem Foundation Schools
Taaleem Foundation SchoolsAkhuwat
 
20110310 zenc kennisnet presentatie missing link v7
20110310 zenc kennisnet presentatie missing link v720110310 zenc kennisnet presentatie missing link v7
20110310 zenc kennisnet presentatie missing link v7Peter Keur
 
Taaleem Foundation Schools Balochistan
Taaleem Foundation Schools BalochistanTaaleem Foundation Schools Balochistan
Taaleem Foundation Schools BalochistanAkhuwat
 
Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24
Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24
Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24Joachim Bengtsson
 
Pubblicità Progresso e Comunicazione Sociale
Pubblicità Progresso e Comunicazione SocialePubblicità Progresso e Comunicazione Sociale
Pubblicità Progresso e Comunicazione Socialepaolopappalardo
 
Ed Ibriefpowerpoint
Ed IbriefpowerpointEd Ibriefpowerpoint
Ed IbriefpowerpointDi Dawson
 
Pakistan strengths
Pakistan strengthsPakistan strengths
Pakistan strengthsAkhuwat
 
België als infrastructuur
België als infrastructuurBelgië als infrastructuur
België als infrastructuurPeter Keur
 

Viewers also liked (15)

Bedrijf Zoekt App 2011 - Apps - Grondstof voor processen bij de overheid
Bedrijf Zoekt App 2011 - Apps - Grondstof voor processen bij de overheidBedrijf Zoekt App 2011 - Apps - Grondstof voor processen bij de overheid
Bedrijf Zoekt App 2011 - Apps - Grondstof voor processen bij de overheid
 
Endometrioziz
EndometriozizEndometrioziz
Endometrioziz
 
Ray searches
Ray searchesRay searches
Ray searches
 
Akhuwat Leading organization through innovation 21042015
Akhuwat Leading organization through innovation 21042015Akhuwat Leading organization through innovation 21042015
Akhuwat Leading organization through innovation 21042015
 
Preferred method of working
Preferred method of workingPreferred method of working
Preferred method of working
 
WSU Spokane Historical Talk
WSU Spokane Historical TalkWSU Spokane Historical Talk
WSU Spokane Historical Talk
 
ICT op school, niet bij leren alleen
ICT op school, niet bij leren alleenICT op school, niet bij leren alleen
ICT op school, niet bij leren alleen
 
Taaleem Foundation Schools
Taaleem Foundation SchoolsTaaleem Foundation Schools
Taaleem Foundation Schools
 
20110310 zenc kennisnet presentatie missing link v7
20110310 zenc kennisnet presentatie missing link v720110310 zenc kennisnet presentatie missing link v7
20110310 zenc kennisnet presentatie missing link v7
 
Taaleem Foundation Schools Balochistan
Taaleem Foundation Schools BalochistanTaaleem Foundation Schools Balochistan
Taaleem Foundation Schools Balochistan
 
Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24
Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24
Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24
 
Pubblicità Progresso e Comunicazione Sociale
Pubblicità Progresso e Comunicazione SocialePubblicità Progresso e Comunicazione Sociale
Pubblicità Progresso e Comunicazione Sociale
 
Ed Ibriefpowerpoint
Ed IbriefpowerpointEd Ibriefpowerpoint
Ed Ibriefpowerpoint
 
Pakistan strengths
Pakistan strengthsPakistan strengths
Pakistan strengths
 
België als infrastructuur
België als infrastructuurBelgië als infrastructuur
België als infrastructuur
 

Similar to Grand Central Dispatch

Similar to Grand Central Dispatch (20)

Blocks+gcd入門
Blocks+gcd入門Blocks+gcd入門
Blocks+gcd入門
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
Code optimization
Code optimization Code optimization
Code optimization
 
Code optimization
Code optimization Code optimization
Code optimization
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4
 
Arrays
ArraysArrays
Arrays
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdfI need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphism
 
week-17x
week-17xweek-17x
week-17x
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
C programming
C programmingC programming
C programming
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 
Sbaw090623
Sbaw090623Sbaw090623
Sbaw090623
 
CBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical fileCBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical file
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
check the modifed code now you will get all operations done.termin.pdf
check the modifed code now you will get all operations done.termin.pdfcheck the modifed code now you will get all operations done.termin.pdf
check the modifed code now you will get all operations done.termin.pdf
 
8 arrays and pointers
8  arrays and pointers8  arrays and pointers
8 arrays and pointers
 

Recently uploaded

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Grand Central Dispatch

  • 1. Grand Central Dispatch Dispatch Dispatch
  • 2. Work dispatch_block_t or dispatch_function_t dispatch_queue_t dispatch_source_t dispatch_group_t Queue
  • 3. ^ { for ( int i = 0 ; i < something very large; i++) { do_heavy_work(); and_keep_doing_it(); } } dispatch_async (..., );
  • 4. dispatch_async_f(..., ); function foo(void *context) { for ( int i = 0 ; i < something very large; i++) { do_heavy_work(); and_keep_doing_it(); } } NULL , &foo
  • 5. ^ { for ( int i = 0 ; i < something very large; i++) { do_heavy_work(); sum += and_keep_doing_it(); } } dispatch_sync (..., ); __block int sum = 0 ; NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; , nil , nil , sum);
  • 6. Main queue Global queues dispatch_get_main_queue () dispatch_get_global_queue ( X , 0 ) DISPATCH_QUEUE_PRIORITY_LOW DISPATCH_QUEUE_PRIORITY_DEFAULT DISPATCH_QUEUE_PRIORITY_HIGH Custom queues dispatch_queue_create() serial concurrent serial
  • 7. ^ { for ( int i = 0 ; i < something very large; i++) { do_heavy_work(); sum += and_keep_doing_it(); } } dispatch_async ( dispatch_get_global_queue ( 0 , 0 ) , ); __block int sum = 0 ; NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; , nil , nil , sum);
  • 8. ^ { for ( int i = 0 ; i < something very large; i++) { do_heavy_work(); sum += and_keep_doing_it(); } dispatch_async ( dispatch_get_main_queue () , ); } dispatch_async ( dispatch_get_global_queue ( 0 , 0 ) , ); __block int sum = 0 ; ^ { NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; , nil , nil , sum); }
  • 9. ^ { do_heavy_work(); sum += and_keep_doing_it(); } dispatch_queue_t global = dispatch_get_global_queue( 0 , 0 ); dispatch_apply (something very large, global, ); __block int sum = 0 ; NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; , nil , nil , sum );
  • 10. ^ { do_heavy_work(); sum += and_keep_doing_it(); } dispatch_queue_t global = dispatch_get_global_queue( 0 , 0 ); dispatch_apply (something very large, global, ); __block int sum = 0 ; NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; , nil , nil , sum );
  • 11. ^ { do_heavy_work(); sum += and_keep_doing_it(); } dispatch_queue_t global = dispatch_get_global_queue( 0 , 0 ); dispatch_group_t group = dispatch_group_create (); for ( int i = 0 ; i < something very large; i++) { dispatch_group_async (group, queue, ); } __block int sum = 0 ; dispatch_group_notify (group, queue, ); dispatch_release (group); NSRunAlertPanel ( @&quot;Found the sum!&quot; , @&quot;It's: %d&quot; , @&quot;OK&quot; , nil , nil , sum );
  • 12.