Thread overview
[dmd-concurrency] What is shared?
Jan 03, 2010
Jason House
Jan 04, 2010
Michel Fortin
Jan 04, 2010
Sean Kelly
Jan 04, 2010
Jason House
Jan 04, 2010
Brad Roberts
Jan 04, 2010
Sean Kelly
January 03, 2010
On digitalmars.D, I've seen a lot of confusion about how shared should/ does work. I don't know of any formal documentation on this. Maybe that'd be a side goal for this list?

Certainly, shared is transitive just like const or immutable. Non- shared instances can't call shared functions and shared instances can only call shared functions.

I know of at least one exception to that: auto x = new shared(T)(); will call T's this() which is can not be marked as shared (bugzilla 3640). I'm not sure about other special functions. It also isn't possible to have both a shared and a non-shared version of template functions (bugzilla 3660). 3660 has stopped my use of shared dead in its tracks.

While I'm listing bugzilla stuff, 3642's awful error message seems relevent. When that message shows up more meaningful scenarios there are other more helpful error messages that are also printed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-concurrency/attachments/20100103/4690209a/attachment.htm>
January 03, 2010
This is a great discussion opener. I'll continue with a related question later. For now, the short answer is: "shared" is used to mark objects that may be shared across threads. Conversely, an object _not_ marked as "shared" is definitely visible only within one thread. This is information known statically.

The bugs you mention are serious. Walter, could you please give them priority? Thanks.


Andrei

Jason House wrote:
> On digitalmars.D, I've seen a lot of confusion about how shared should/does work. I don't know of any formal documentation on this. Maybe that'd be a side goal for this list?
> 
> Certainly, shared is transitive just like const or immutable. Non-shared instances can't call shared functions and shared instances can only call shared functions.
> 
> I know of at least one exception to that: auto x = new shared(T)(); will call T's this() which is can not be marked as shared (bugzilla 3640). I'm not sure about other special functions. It also isn't possible to have both a shared and a non-shared version of template functions (bugzilla 3660). 3660 has stopped my use of shared dead in its tracks.
> 
> While I'm listing bugzilla stuff, 3642's awful error message seems relevent. When that message shows up more meaningful scenarios there are other more helpful error messages that are also printed.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency
January 03, 2010
Le 2010-01-03 ? 19:34, Andrei Alexandrescu a ?crit :

> Conversely, an object _not_ marked as "shared" is definitely visible only within one thread.

Except for those marked immutable, which also implies shared.

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



January 03, 2010
On Jan 3, 2010, at 7:34 PM, Andrei Alexandrescu <andrei at erdani.com> wrote:


> The bugs you mention are serious. Walter, could you please give them priority? Thanks.

Unlike the other two, the general solution to 3640 isn't clear. It may be worth a larger discussion. I'm not yet sure what is and what isn't on-topic for this mailing list. What are the goals of the decision makers?
>
January 03, 2010
Not necessarily. Immutable means that synchronization isn't necessary for data accessed by multiple threads, but it says nothing about visibility.

Sent from my iPhone

On Jan 3, 2010, at 5:43 PM, Michel Fortin <michel.fortin at michelf.com> wrote:

> Le 2010-01-03 ? 19:34, Andrei Alexandrescu a ?crit :
>
>> Conversely, an object _not_ marked as "shared" is definitely visible only within one thread.
>
> Except for those marked immutable, which also implies shared.
>
> -- 
> Michel Fortin
> michel.fortin at michelf.com
> http://michelf.com/
>
>
>
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency
January 03, 2010
Jason House wrote:
> On Jan 3, 2010, at 7:34 PM, Andrei Alexandrescu <andrei at erdani.com> wrote:
> 
> 
>> The bugs you mention are serious. Walter, could you please give them priority? Thanks.
> 
> Unlike the other two, the general solution to 3640 isn't clear. It may
> be worth a larger discussion. I'm not yet sure what is and what isn't
> on-topic for this mailing list. What are the goals of the decision makers?

Here's my basic thoughts on how to proceed with this list and the general topic of concurrency:

1) basic high level design of the language
2) implementation within dmd of the language
3) implementation of pieces of phobos

In that order.

Given the rather limited resources available, keeping focus and concentrating on dealing with the most important parts first will help to get to a usable implementation fastest.

Later,
Brad
January 03, 2010
I'm not sure I qualify as a decision maker, but since the final draft of TDPL is due fairly soon I think the immediate goal is to produce at least the foundation for a solid and forward-thinking concurrency model within the next few weeks.  Ordinarily I'd be inclined to say that this is an incredibly ambitious goal, except that the discussion has really been going on for ages now.

I think it's reasonable to begin by at least pretending that we're starting from scratch, but knowing that we really can't afford to get tied up discussing minutae for too terribly long.  In short, nothing's off limits but we need to be productive. :-)

Sent from my iPhone

On Jan 3, 2010, at 7:29 PM, Jason House <jason.james.house at gmail.com> wrote:

> On Jan 3, 2010, at 7:34 PM, Andrei Alexandrescu <andrei at erdani.com> wrote:
>
>
>> The bugs you mention are serious. Walter, could you please give them priority? Thanks.
>
> Unlike the other two, the general solution to 3640 isn't clear. It may be worth a larger discussion. I'm not yet sure what is and what isn't on-topic for this mailing list. What are the goals of the decision makers?
>>
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency