SlideShare a Scribd company logo
1 of 13
Download to read offline
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

Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...itnewsafrica
 
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sectoritnewsafrica
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 

Recently uploaded (20)

Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
 
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 

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.