digitalmars.D - Converting from tango.Atomic to D2 core.atomic
- eris (19/19) Jul 06 2011 Hi,
- dsimcha (2/6) Jul 06 2011 core.atomic does do atomic load/store as of 2.053.
- KennyTM~ (7/13) Jul 06 2011 Yes there are atomicLoad and atomicStore*, but the documentation on
- Daniel Gibson (5/31) Jul 06 2011 Isn't there already a D2 port of QtD?
- eris (6/6) Jul 06 2011 Yes, but it appears that I must have checked out an earlier version that...
- Sean Kelly (15/41) Jul 07 2011 1. The volatile statements should really be converted to atomic ops. I'v...
Hi, I've been converting 'qtd' (the qt lib interface for D) to ldc / D2 version. Apparently some areas of the phobos and druntime library are still a little green for D2 or LDC2 because I'm jumping through some hoops to make it work. Minor Issues: 1. core.thread is still using 'volatile' instead of 'synchronized'. Volatile has been deprecated and you need to tell the compiler to ignore it or the compile fails. I'm thinking that a core D2 library should not cause a compile abort by default. I got passed it by disabling deprecated checks. Major Issues: 2. One file in the qtd implementation (QList.d) is using some sort of lock-free shared list. Their implementation uses the old tango.core.Atomic semantics of Atomic! (load, store, increment, decrement). I've tried converting these to the equivalent phobos core.atomic and running into some dead ends. a) core.atomic implements nearly all binary ops as well as nearly all assignment / increment ops. But it doesn't implement the simplest of the ops: load, store. Are these assumed to "just work" for ints and doubles? If so, fine, but there are platform-dependent gotchas lurking along that path.
Jul 06 2011
== Quote from eris (jvburnes gmail.com)'s articlea) core.atomic implements nearly all binary ops as well as nearly all assignment / increment ops. But it doesn't implement the simplest of the ops: load, store. Are these assumed to "just work" for ints and doubles? If so, fine, but there are platform-dependent gotchas lurking along that path.core.atomic does do atomic load/store as of 2.053.
Jul 06 2011
On Jul 6, 11 23:48, dsimcha wrote:== Quote from eris (jvburnes gmail.com)'s articleYes there are atomicLoad and atomicStore*, but the documentation on d-p-l.org isn't updated** (it exists in phobos-prerelease*** though). *: https://github.com/D-Programming-Language/druntime/blob/master/src/core/atomic.d#L95 **: http://d-programming-language.org/phobos/core_atomic.html ***: http://d-programming-language.org/phobos-prerelease/core_atomic.htmla) core.atomic implements nearly all binary ops as well as nearly all assignment / increment ops. But it doesn't implement the simplest of the ops: load, store. Are these assumed to "just work" for ints and doubles? If so, fine, but there are platform-dependent gotchas lurking along that path.core.atomic does do atomic load/store as of 2.053.
Jul 06 2011
Am 06.07.2011 17:45, schrieb eris:Hi, I've been converting 'qtd' (the qt lib interface for D) to ldc / D2 version. Apparently some areas of the phobos and druntime library are still a little green for D2 or LDC2 because I'm jumping through some hoops to make it work. Minor Issues: 1. core.thread is still using 'volatile' instead of 'synchronized'. Volatile has been deprecated and you need to tell the compiler to ignore it or the compile fails. I'm thinking that a core D2 library should not cause a compile abort by default. I got passed it by disabling deprecated checks. Major Issues: 2. One file in the qtd implementation (QList.d) is using some sort of lock-free shared list. Their implementation uses the old tango.core.Atomic semantics of Atomic! (load, store, increment, decrement). I've tried converting these to the equivalent phobos core.atomic and running into some dead ends. a) core.atomic implements nearly all binary ops as well as nearly all assignment / increment ops. But it doesn't implement the simplest of the ops: load, store. Are these assumed to "just work" for ints and doubles? If so, fine, but there are platform-dependent gotchas lurking along that path.Isn't there already a D2 port of QtD? See https://bitbucket.org/qtd/repo/wiki/Home Cheers, - Daniel
Jul 06 2011
Yes, but it appears that I must have checked out an earlier version that had bugs. I'm not sure how that happened. I built it according to the directions on the qtd page. After looking at their Atomic.d implementation, I see numerous updates that should fix several issues. I'll re-checkout the sources and see if it helps.
Jul 06 2011
1. The volatile statements should really be converted to atomic ops. I've be= en lazy about it because it works as-is.=20 2a. There is an atomicLoad and atomicStore in core.atomic. Not sure if it's i= n the current release though.=20 Sent from my iPhone On Jul 6, 2011, at 11:45 AM, eris <jvburnes gmail.com> wrote:Hi, =20 I've been converting 'qtd' (the qt lib interface for D) to ldc / D2 versio=n.Apparently some areas of the phobos and druntime library are still a littl=egreen for D2 or LDC2 because I'm jumping through some hoops to make it wor=k.=20 Minor Issues: =20 1. core.thread is still using 'volatile' instead of 'synchronized'. Volat=ilehas been deprecated and you need to tell the compiler to ignore it or the compile fails. I'm thinking that a core D2 library should not cause a com=pileabort by default. I got passed it by disabling deprecated checks. =20 Major Issues: =20 2. One file in the qtd implementation (QList.d) is using some sort of lock-free shared list. Their implementation uses the old tango.core.Atomi=csemantics of Atomic! (load, store, increment, decrement). I've tried converting these to the equivalent phobos core.atomic and running into som=edead ends. =20 a) core.atomic implements nearly all binary ops as well as nearly all assignment / increment ops. But it doesn't implement the simplest of the o=ps:load, store. Are these assumed to "just work" for ints and doubles? If s=o,fine, but there are platform-dependent gotchas lurking along that path. =20
Jul 07 2011