[dmd-concurrency] Sending mesages to non-listening threads

Michel Fortin michel.fortin at michelf.com
Wed Jan 13 13:05:18 PST 2010


Le 2010-01-13 à 14:58, Robert Jacques a écrit :

> [...] programming with threads doesn't scale since inevitably you either have too many or not enough.
> 
> One way to mitigate this is to have a task library like cilk or Intel's Threading Building blocks.

Mac OS X since 10.6 also offers libdispatch where the kernel itself can help processes decide when to create new threads. The project is opensource and it looks like it might be adopted by FreeBSD too.

<http://libdispatch.macosforge.org/>

The API is very nice to use with blocks (Apple extension to C). Here is a multithreaded foreach creating tasks executed by libdispatch:

	dispatch_apply(count, queue, ^(size_t i) {
	   printf("%u\n",i);
	});

Can we do something like this in D, given all the sharing protections?


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the dmd-concurrency mailing list