Andrei,<br><br>Does my decision that std.parallelism should be a "here be dragons" module and there's no reasonably way to make it safe make it a non-starter for you, or have you just not gotten around to reviewing it?<br>
<br>--Dave<br><br><div class="gmail_quote">On Sun, Sep 5, 2010 at 11:05 AM, David Simcha <span dir="ltr"><<a href="mailto:dsimcha@gmail.com">dsimcha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
It doesn't use std.concurrency. It just uses core.thread. For now,
core.thread doesn't take a shared delegate, meaning it bypasses the
entire shared system. Sean said a while back that eventually it
would start taking a shared delegate. When it does, I'll simply
cast the workLoop delegate to shared, thus bypassing the entire
shared system again. As the warning at the top of the module
states, it does subvert the type system to achieve completely
unchecked sharing, though this doesn't require relying on
implementation bugs, just unsafe casts. <br>
<br>
I've thought about this enough that I think trying to improve the
type system to make this lib use something other than completely
unchecked sharing, while still being useful for pedal-to-metal
parallelism, is a lost cause at least for D2. <b>Maybe</b> it's
do-able in D3. Even if it's technically do-able, I think it would
make the library so inefficient and/or the API so obtuse that for
something like this I feel strongly that unsafe "here be dragons" +
@system is the right answer. Those that want a safe multithreading
model can simply not use this module.<br>
<br>
I am completely in favor of std.parallelism coming w/ a huge warning
on it, being @system as opposed to @trusted, and not being
considered the "flagship" multhreading model. However, even TDPL
mentions the possibility of using casts to achieve unchecked
sharing, which is exactly what this module will do when core.thread
starts taking shared delegates. If D is still supposed to be a
systems language, I think dangerous, pedal-to-metal libraries like
this have their place in Phobos, as long as it's clear that that's
what they are.<div><div></div><br></div></div></blockquote></div>