aspects on methods?

2016-07-12 Thread jj75607 via Digitalmars-d-learn
I want to use aspect-like annotations to transform @Lockable class Abc { @sync void f() { writeln("f"); } @shared void g() { writeln("g"); } } to something like: class Abc { shared(ReadWriteMutex) _lock123; this()

some atomic structs

2016-07-01 Thread jj75607 via Digitalmars-d-learn
I wrote some java-like atomic structs. Please criticize it https://dpaste.dzfl.pl/24f1438ebb52

thread-safe shared field access

2016-06-30 Thread jj75607 via Digitalmars-d-learn
For example I have a shared from different threads variable. What piece of code is correctly thread-safe? First: shared class A { shared(int) x; void test1() { x = 10; x += 5 writeln(x); } } Or second: import core.atomic; shared c

Re: compilation error with shared ReadWriteMutex

2016-06-30 Thread jj75607 via Digitalmars-d-learn
On Thursday, 30 June 2016 at 12:25:54 UTC, Steven Schveighoffer wrote: On 6/30/16 8:18 AM, jj75607 wrote: [...] You don't need to mark this shared, because the entire class is shared, all members are implicitly marked shared. [...] Thanks! Is this a compilation only 'cast' with no r

Re: opEquals on shared object

2016-06-30 Thread jj75607 via Digitalmars-d-learn
On Thursday, 30 June 2016 at 12:21:03 UTC, Steven Schveighoffer wrote: On 6/30/16 6:26 AM, jj75607 wrote: Hello! I need to overload opEquals on shared class C shared class C { override bool opEquals(Object o) { return false; } } But compilation fails with the message: Error: function f700

compilation error with shared ReadWriteMutex

2016-06-30 Thread jj75607 via Digitalmars-d-learn
I wrote shared class with rwmutex import core.sync.rwmutex; shared class Shared { ReadWriteMutex rwmutex; int[] items; this() { rwmutex = new ReadWriteMutex(); } } But it fails with: Error: cannot implicitly convert expression (new ReadWriteMu

opEquals on shared object

2016-06-30 Thread jj75607 via Digitalmars-d-learn
Hello! I need to overload opEquals on shared class C shared class C { override bool opEquals(Object o) { return false; } } But compilation fails with the message: Error: function f700.C.opEquals does not override any function, did you mean to override 'object.Object.opEquals'? What am I

Re: multithreading profiling

2016-04-18 Thread jj75607 via Digitalmars-d-learn
On Monday, 18 April 2016 at 13:45:20 UTC, Marc Schütz wrote: Which platform/OS, dmd version, and command line are you using? Windows7, DMD 2.071.0, run from Visual Studio 2013 Community + VisualD 0.3.43

multithreading profiling

2016-04-18 Thread jj75607 via Digitalmars-d-learn
Hello! Is it possible to start profiling on multithreaded app with Dmd? https://issues.dlang.org/show_bug.cgi?id=14511 is open. I am doing wrong or why this program segfaults if compiled with profiler hooks? import core.atomic; shared struct S { uint counter; bool in