On Friday, 24 January 2014 at 06:03:27 UTC, dennis luehring wrote:

no - the parameters and local vars of the function are in the stack of the thread - so there is no problem with them, only shared variables can have a need to synchronization

your idea tries to solve non existing problems?

...Unless the thread is started with a delegate (literal or member function), which implicitly gains an unsynchronized view of its enclosing scope (or class). Granted, the "default" D's spawning function, std.concurrency.spawn, being restrictive like a firm parent, simply would not allow this. However, it may sometimes be feasible to do so (using Thread interface directly), although this is a case for "I know what I'm doing" category.

If we had a way of explicitly capturing variables for delegate literals, the problem with delegates could go away altogether.

Reply via email to