Top "Grand-central-dispatch" questions

Grand Central Dispatch (GCD) provides a simple and robust mechanism for concurrent and asynchronous operations, primarily in Apple operating systems (e.g., iOS, macOS, watchOS, and tvOS), but also FreeBSD and MidnightBSD.

Concurrent vs serial queues in GCD

I'm struggling to fully understand the concurrent and serial queues in GCD. I have some issues and hoping someone can …

ios multithreading concurrency grand-central-dispatch
Alternatives to dispatch_get_current_queue() for completion blocks in iOS 6?

I have a method that accepts a block and a completion block. The first block should run in the background, …

objective-c cocoa-touch ios6 objective-c-blocks grand-central-dispatch
using dispatch_sync in Grand Central Dispatch

Can anyone explain with really clear use cases what the purpose of dispatch_sync in GCD is for? I can't …

cocoa ios ios4 grand-central-dispatch
Get current dispatch queue?

I have a method which should support being called from any queue, and should expect to. It runs some code …

iphone ios objective-c grand-central-dispatch dispatch
dispatch_once after the Swift 3 GCD API changes

What is the new syntax for dispatch_once in Swift after the changes made in language version 3? The old version …

swift grand-central-dispatch
Difference between dispatch_async and dispatch_sync on serial queue?

I've created a serial queue like this: dispatch_queue_t _serialQueue = dispatch_queue_create("com.example.name", DISPATCH_QUEUE_SERIAL); …

ios multithreading grand-central-dispatch
Wait for async task to finish completion block before returning in app delegate

I'm using a subclass of UIManagedDocument to use Core Data in my project. The point is for the subclass to …

ios objective-c grand-central-dispatch
dispatch_get_main_queue() in main thread

I have method which makes UI changes in some cases. For example: -(void) myMethod { if(someExpressionIsTrue) { // make some UI …

objective-c multithreading grand-central-dispatch nsthread
What's the difference between the "global queue" and the "main queue" in GCD?

Among some other ways, there are these two ways to get queues in GCD: dispatch_get_global_queue(DISPATCH_QUEUE_…

iphone ios concurrency grand-central-dispatch
Dispatch queues: How to tell if they're running and how to stop them

I'm just playing around with GCD and I've written a toy CoinFlipper app. Here's the method that flips the coins: …

objective-c cocoa multithreading grand-central-dispatch