Re: atomic operations compared to c++

2017-06-14 Thread David Nadlinger via Digitalmars-d
On Wednesday, 14 June 2017 at 12:48:14 UTC, Russel Winder wrote: On Wed, 2017-06-14 at 10:40 +, gzp via Digitalmars-d wrote: […] cas in all api I've seen on a failed swap, the current value is retrieved (in c/c++ there are intrinsic for them) This appears to be in core.atomic. There is

Re: atomic operations compared to c++

2017-06-14 Thread David Nadlinger via Digitalmars-d
Hi, On Tuesday, 13 June 2017 at 06:12:46 UTC, gzp wrote: the docs are quite minimal That's true. In fact, this applies not only to atomic intrinsics, but all of `shared`. We need to sit down and properly specify things at some point. Andrei has been trying to get an initiative going to do

Re: atomic operations compared to c++

2017-06-14 Thread Patrick Schluter via Digitalmars-d
On Wednesday, 14 June 2017 at 12:15:49 UTC, Russel Winder wrote: On Wed, 2017-06-14 at 12:28 +0100, rikki cattermole via Digitalmars-d wrote: > [...] Step back a moment. C++ and Java are trying to stop programmers using these features, in favour of using higher level abstractions. In C++

Re: atomic operations compared to c++

2017-06-14 Thread gzp via Digitalmars-d
Actually I've just found an isue from 2015 (still in NEW state): https://issues.dlang.org/show_bug.cgi?id=15007 I've updated and linked this forum.

Re: atomic operations compared to c++

2017-06-14 Thread gzp via Digitalmars-d
I am fairly sure it isn't, but why is this needed if you use a parallelism oriented approach to the architecture and design? Sorry to repeat but whilst there are circumstances where this stuff is needed (operating systems), most other applications should be written without the need for locks,

Re: atomic operations compared to c++

2017-06-14 Thread rikki cattermole via Digitalmars-d
On 14/06/2017 1:48 PM, Russel Winder via Digitalmars-d wrote: On Wed, 2017-06-14 at 13:27 +0100, rikki cattermole via Digitalmars-d wrote: […] Yes. A N.G. post will be forgotten about quickly, but an issue in the bug tracker can send you updates as things progress. OK. Feel free to sign me

Re: atomic operations compared to c++

2017-06-14 Thread Russel Winder via Digitalmars-d
On Wed, 2017-06-14 at 13:27 +0100, rikki cattermole via Digitalmars-d wrote: > […] > Yes. A N.G. post will be forgotten about quickly, but an issue in > the > bug tracker can send you updates as things progress. OK. Feel free to sign me up for the issue. > At the end of the day, that module

Re: atomic operations compared to c++

2017-06-14 Thread Russel Winder via Digitalmars-d
On Wed, 2017-06-14 at 10:40 +, gzp via Digitalmars-d wrote: > After digging into it the source for me it seems as D is lacking > a "standardized" atomic library. It has some basic concepts, but > far behind the c++ standards. > I don't know if there are any RFC-s in this topic but it

Re: atomic operations compared to c++

2017-06-14 Thread Guillaume Piolat via Digitalmars-d
On Tuesday, 13 June 2017 at 06:12:46 UTC, gzp wrote: But what about compare_exchange (CAS) ? In C++ one have to provide Memory ordering for success and failure, but not in D. I have some difficulty already to comprehend MemoryOrder.rel and MemoryOrder.acq A cas with MemoryOrder.raw wouldn't

Re: atomic operations compared to c++

2017-06-14 Thread rikki cattermole via Digitalmars-d
On 14/06/2017 1:15 PM, Russel Winder via Digitalmars-d wrote: snip I don't know if D compiler is aware of the fences and won't move out/in instructions from guarded areas. Thanks: gzp Please create an issue here: issues.dlang.org for druntime atomic support. Clearly the requirements that we

Re: atomic operations compared to c++

2017-06-14 Thread Russel Winder via Digitalmars-d
On Wed, 2017-06-14 at 12:28 +0100, rikki cattermole via Digitalmars-d wrote: > On 14/06/2017 11:40 AM, gzp wrote: > > After digging into it the source for me it seems as D is lacking a > > "standardized" atomic library. It has some basic concepts, but far > > behind the c++ standards. > > I

Re: atomic operations compared to c++

2017-06-14 Thread Adrian Matoga via Digitalmars-d
On Tuesday, 13 June 2017 at 06:12:46 UTC, gzp wrote: (...) There is no consume in D. What do you currently use for in C++? It is temporarily deprecated in C++17.

Re: atomic operations compared to c++

2017-06-14 Thread rikki cattermole via Digitalmars-d
On 14/06/2017 11:40 AM, gzp wrote: After digging into it the source for me it seems as D is lacking a "standardized" atomic library. It has some basic concepts, but far behind the c++ standards. I don't know if there are any RFC-s in this topic but it requires a lot of work. Just to mention

Re: atomic operations compared to c++

2017-06-14 Thread gzp via Digitalmars-d
After digging into it the source for me it seems as D is lacking a "standardized" atomic library. It has some basic concepts, but far behind the c++ standards. I don't know if there are any RFC-s in this topic but it requires a lot of work. Just to mention some by my first experience: cas in

Re: atomic operations compared to c++

2017-06-13 Thread Kagamin via Digitalmars-d
LDC uses seq_cst seq_cst

atomic operations compared to c++

2017-06-13 Thread gzp via Digitalmars-d
I'm trying to port some simple lock-free algorithm to D and as the docs are quite minimal I'm stuck a little bit. The memory order seem to be ok: MemoryOrder.acq -> C++ accquire MemoryOrder.rel -> C++ release MemoryOrder.raw -> C++ relaxed MemoryOrder.seq -> C++ seq_cst or acq_rel (the