www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Needs pause intrinsic/wrapper in druntime, but where?

reply Manu <turkeyman gmail.com> writes:
I need a pause() function in druntime (wrap x86 `pause`/arm `yield`,
etc), but it's not clear where to put it...
Candidates are:
  core.atomic - seems odd, but it's almost exclusively used when
implementing spin locks
  core.thread - sounds appropriate, but doesn't really mean anything wrt threads
  core.sync.??? - no appropriate sub-package appears to exist...

Ideas?
I'm leaning towards core.atomic.
Oct 06
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Sunday, 6 October 2019 at 18:50:56 UTC, Manu wrote:
 I need a pause() function in druntime (wrap x86 `pause`/arm 
 `yield`,
 etc), but it's not clear where to put it...
 Candidates are:
   core.atomic - seems odd, but it's almost exclusively used when
 implementing spin locks
   core.thread - sounds appropriate, but doesn't really mean 
 anything wrt threads
   core.sync.??? - no appropriate sub-package appears to exist...

 Ideas?
 I'm leaning towards core.atomic.
intrinsics go into core.bitOp Atomic Load and Store are there as well :)
Oct 06
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 6 October 2019 at 21:17:16 UTC, Stefan Koch wrote:
 intrinsics go into core.bitOp
pause has nothing to do with bits though...
Oct 06
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Sunday, 6 October 2019 at 21:36:49 UTC, Adam D. Ruppe wrote:
 On Sunday, 6 October 2019 at 21:17:16 UTC, Stefan Koch wrote:
 intrinsics go into core.bitOp
pause has nothing to do with bits though...
neither does atomic load and store. or writing to input/output ports.
Oct 06
parent Manu <turkeyman gmail.com> writes:
On Sun, Oct 6, 2019 at 2:50 PM Stefan Koch via Digitalmars-d
<digitalmars-d puremagic.com> wrote:
 On Sunday, 6 October 2019 at 21:36:49 UTC, Adam D. Ruppe wrote:
 On Sunday, 6 October 2019 at 21:17:16 UTC, Stefan Koch wrote:
 intrinsics go into core.bitOp
pause has nothing to do with bits though...
neither does atomic load and store. or writing to input/output ports.
Too late the party, it's in core.atomic. I reckon that's the most sensible location.
Oct 06