Revamped concurrency API
Sean Kelly
sean at invisibleduck.org
Tue Oct 13 08:39:21 PDT 2009
MIURA Masahiro Wrote:
> Jeremie Pelletier wrote:
> > I also don't believe one model is "ruling them all".
>
> Let me clarity this, just in case I have caused an unnecessary
> confusion: I think Sean's Erlang-like API is meant to coexist
> with the current core.thread, and that you can use one or both
> of them to build higher-level concurrency models.
Exactly. That's also why I settled on the Erlang-like API instead of something like coroutines. It's possible to build a coroutine API on top of the Erlang API, but not vice-versa.
> I think it's nice to have core.thread *and* message-passing API
> in Phobos. Thread alone is too primitive for daily use, but
> we don't want to have too many concurrency models.
I see core as holding language-essential stuff and "close to the metal" APIs, and have no inclination of hiding core.thread or core.sync from the user. If someone wants to work at this level and they understand the risks they should be able to. Any higher-level stuff like the message-passing API I proposed would live in Phobos and sit on top of what's in core.
I disagree about poor performance though. With unique references or move semantics, a copy of even complex data isn't necessary to ensure that a message is passed safely.
More information about the Digitalmars-d
mailing list