Synchronous code is used to block the current thread of execution from proceeding on to the next function. This is important for you to know because you can avoid your app crashing when you do an update in the background thread.
- When we talk about synchronous tasks, … these are tasks that are ran in order. … When you run a task, everything that comes later, … has to wait for the first task to finish. … Because of this behavior, synchronous programming … is predictable, which is one of it's advantages. … Synchronous programing may not be popular, … but it can come in handy in some ways. … Suppose you have an app where a user has to login, … accept the terms and conditions, … before finally accessing their dashboard. … This is an example of how it would look in code. … You can easily read this code from top to bottom. … Once the user is logged in, we check if they have … accepted the terms and conditions, … based on the response we get we can proceed to either … show the terms and conditions screen, … or proceed to the dashboard. … If the order of completion of a task is important to you, … you should consider using dispatch.sync. … It's important to know, apple wants that calling … dispatch.sync on a current queue, will result in a deadlock. …
Skill Level Intermediate
1. Evolution of GCD
2. Working with Queues
3. Asychronous vs. Synchronous Execution
4. Concurrency vs. Parallelism
What are deadlocks?1m 21s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.