[libdispatch-dev] Queue size
tclementdev at gmail.com
Thu Oct 7 08:54:13 PDT 2010
On Oct 7, 2010, at 5:14 PM, Dave Zarzycki wrote:
> That would be a "latent serialization" problem that was hinted at in my response. The dirty secret of our industry is that many thread safe libraries are not actually designed to achieve any concurrency when invoked concurrently. This creates huge problems for developers like yourself that are trying to use them concurrently.
>> It is difficult if not impossible to remove these locks. I guess the solution is to limit the number of dispatched blocks on my queues using dispatch semaphores.
> The solution is to desynchronize the subsystem in question and switch to completion callbacks. In other words, do this kind of transform:
> Result *foo(Input *x);
> void foo(Input *x, dispatch_queue_t completion_queue, void (^completion_callback)(Result *));
This also means I shouldn't use dispatch_sync() in those subsystems and always use dispatch_async() instead?
Some dispatch_sync() calls are used on serial queues to synchronize access to internal data (instead of using locks) and return some information (ie. getter methods).
More information about the libdispatch-dev