Thread overview
associative arrays
Jun 02, 2013
deadalnix
Jun 02, 2013
Walter Bright
Jun 03, 2013
deadalnix
Jun 03, 2013
Jonathan M Davis
June 02, 2013
Quick question, are they supposed to be stable ? Are they supposed to be thread safe when shared ?
June 02, 2013
On 6/2/2013 11:37 AM, deadalnix wrote:
> Quick question, are they supposed to be stable ? Are they supposed to be thread
> safe when shared ?

Declaring anything shared does not make it "thread safe". You still have to synchronize, etc.
June 03, 2013
On Sunday, 2 June 2013 at 18:55:15 UTC, Walter Bright wrote:
> On 6/2/2013 11:37 AM, deadalnix wrote:
>> Quick question, are they supposed to be stable ? Are they supposed to be thread
>> safe when shared ?
>
> Declaring anything shared does not make it "thread safe". You still have to synchronize, etc.

Sure, but what is the goal we want to reach. Thread safe hash table are know technology and can surely be implemented.
June 03, 2013
On Monday, June 03, 2013 04:13:21 deadalnix wrote:
> On Sunday, 2 June 2013 at 18:55:15 UTC, Walter Bright wrote:
> > On 6/2/2013 11:37 AM, deadalnix wrote:
> >> Quick question, are they supposed to be stable ? Are they
> >> supposed to be thread
> >> safe when shared ?
> > 
> > Declaring anything shared does not make it "thread safe". You still have to synchronize, etc.
> 
> Sure, but what is the goal we want to reach. Thread safe hash table are know technology and can surely be implemented.

I would be very surprised to ever see the build-in AAs doing that. Not only are there all kinds of problems in their implementation, but making them synchronize would incur overhead which is unnecessary for most programs. If you want to use them in a shared context, then make them shared and protect them with mutex or synchronized blocks. That's the normal thing to do. And if you want one that does the synchronization automatically, then create a wrapper for the built-in AA which is synchronized. We may very well add that to std.container at some point, but the built-in AA implementation isn't going to function that way in and of itself.

- Jonathan M Davis