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

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 

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.