Re: Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-17 Thread Ali Çehreli via Digitalmars-d-learn
On 06/17/2014 11:17 AM, George Sapkin wrote: On Tuesday, 17 June 2014 at 17:18:36 UTC, Ali Çehreli wrote: Shared data can be accessed by more than one thread. Unless it is locked, other threads may see the array in an inconsistent state. Ali But that's a local copy of it, no? If it's not, wil

Re: Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-17 Thread George Sapkin via Digitalmars-d-learn
On Tuesday, 17 June 2014 at 17:18:36 UTC, Ali Çehreli wrote: Shared data can be accessed by more than one thread. Unless it is locked, other threads may see the array in an inconsistent state. Ali But that's a local copy of it, no? If it's not, will making a local copy solve this? The origi

Re: Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-17 Thread Ali Çehreli via Digitalmars-d-learn
On 06/17/2014 08:51 AM, George Sapkin wrote:> Does making an array copy with shared cast away make any sense? > > auto n = 10; > auto sharedData = new shared SomeClass[n]; > foreach (i; 0..n) sharedData[i] = new shared SomeClass(i); > > auto nonSharedData = cast(SomeClass[]) sharedData[0..$]; > a

Re: Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-17 Thread George Sapkin via Digitalmars-d-learn
Does making an array copy with shared cast away make any sense? auto n = 10; auto sharedData = new shared SomeClass[n]; foreach (i; 0..n) sharedData[i] = new shared SomeClass(i); auto nonSharedData = cast(SomeClass[]) sharedData[0..$]; auto sorted = sort!((a, b) => a.value < b.value)(nonSharedDa

Re: Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-17 Thread Andrew Edwards via Digitalmars-d-learn
On 6/17/14, 11:34 AM, George Sapkin wrote: On Tuesday, 17 June 2014 at 04:38:24 UTC, Ali Çehreli wrote: Good news: The code compiles with 2.066 after adding 'import std.algorithm;' :) Ali Thanks, but where can I get 2.066? It seems it's not going to be branched until June 30th. Is there any

Re: Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-17 Thread George Sapkin via Digitalmars-d-learn
On Tuesday, 17 June 2014 at 04:38:24 UTC, Ali Çehreli wrote: Good news: The code compiles with 2.066 after adding 'import std.algorithm;' :) Ali Thanks, but where can I get 2.066? It seems it's not going to be branched until June 30th. Is there any way to resolve this now with 2.065?

Re: Trying to sort shared data with a predicate causes 'unable to format shared objects'

2014-06-16 Thread Ali Çehreli via Digitalmars-d-learn
On 06/16/2014 07:45 PM, George Sapkin wrote: I'm trying to sort shared data with a predicate. Buy that causes 'unable to format shared objects'. Here's an example reproducing the issue without any threading code: shared class SomeClass { immutable int value; this(const int value) {