[libdispatch-dev] libdispatch's thread model

Mario Schwalbe schwalbe at inf.tu-dresden.de
Wed Jan 27 07:41:53 PST 2010


when dispatching a bunch of jobs (blocks) to a global concurrent queue,
libdispatch, running on Linux or FreeBSD, always spawns a thread for each job
submitted. On Mac OS X it works as expected.

This somewhat interferes with libdispatch's initial intention of a set of
worker threads - equal to the number of processors - that execute each job
in turn. Is there some chance to get that fixed?

I know that Apple's non-posix extension to pthread isn't available.
Nevertheless, it should be possible to at least use a bounded number of
worker threads less than MAX_THREAD_COUNT (255). What about dynamically
setting MAX_THREAD_COUNT (or a similar variable) to the number of processors


More information about the libdispatch-dev mailing list