0

I read somewhere that dispatch barriers should be added to custom queue and not to the global queue. I am not getting the exact reason for that. Thanks.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
Jush
  • 71
  • 3

1 Answers1

1

Global queues are a shared resource within a process. The system frameworks need to be able to depend on the global queues being unencumbered by unknown interlocks, otherwise low-level framework processes could be held up by higher level user activities, possibly causing deadlocks. GCD gives developers the ability to establish arbitrary concurrency abstractions and interlocks atop global queues, so it's a moot point to gripe about their absence on the global queues. Asking why you can't have barriers on global queues is like asking why one process on a pre-emptive multitasking system can't block all the others.

ipmcc
  • 29,581
  • 5
  • 84
  • 147