diff options
Diffstat (limited to 'src/pkg/runtime/atomic_386.c')
| -rw-r--r-- | src/pkg/runtime/atomic_386.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pkg/runtime/atomic_386.c b/src/pkg/runtime/atomic_386.c index a4f2a114f..79b7cbf96 100644 --- a/src/pkg/runtime/atomic_386.c +++ b/src/pkg/runtime/atomic_386.c @@ -17,3 +17,16 @@ runtime·atomicloadp(void* volatile* addr) { return *addr; } + +#pragma textflag 7 +uint64 +runtime·xadd64(uint64 volatile* addr, int64 v) +{ + uint64 old; + + old = *addr; + while(!runtime·cas64(addr, &old, old+v)) { + // nothing + } + return old+v; +} |
