aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime.c
diff options
context:
space:
mode:
authorHector Chu <hectorchu@gmail.com>2010-01-06 17:58:55 -0800
committerRuss Cox <rsc@golang.org>2010-01-06 17:58:55 -0800
commit6bfe5f55f4dc110ca43a202a6a5eb70ee477916b (patch)
tree3ef0b1e03a660d7e220471a0ae9485cc16756632 /src/pkg/runtime/runtime.c
parent5c07e0c17ce6a0627a2fe4bbc4254b322ec879ce (diff)
downloadgo-6bfe5f55f4dc110ca43a202a6a5eb70ee477916b.tar.xz
Ported runtime to Windows.
R=rsc CC=golang-dev https://golang.org/cl/176066
Diffstat (limited to 'src/pkg/runtime/runtime.c')
-rw-r--r--src/pkg/runtime/runtime.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c
index 4a0309e0c7..8588894624 100644
--- a/src/pkg/runtime/runtime.c
+++ b/src/pkg/runtime/runtime.c
@@ -165,6 +165,20 @@ goargs(void)
osĀ·Envs.cap = envc;
}
+// Atomic add and return new value.
+uint32
+xadd(uint32 volatile *val, int32 delta)
+{
+ uint32 oval, nval;
+
+ for(;;){
+ oval = *val;
+ nval = oval + delta;
+ if(cas(val, oval, nval))
+ return nval;
+ }
+}
+
byte*
getenv(int8 *s)
{