diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:23:02 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:23:02 +0200 |
commit | 8fcc691d6fa80c9ddf38bf0d34b803bab0e421d5 (patch) | |
tree | ba71646a10b518372d110532d86fcf0b98edc14f /src/pkg/runtime/lock_futex.c | |
parent | 3bb719bbf3cdb97b3901f3baaa2da9d02a5c3cdb (diff) | |
parent | 8a39ee361feb9bf46d728ff1ba4f07ca1d9610b1 (diff) | |
download | golang-8fcc691d6fa80c9ddf38bf0d34b803bab0e421d5.tar.gz |
Merge tag 'upstream/1.3' into debian-sid
Upstream version 1.3
Diffstat (limited to 'src/pkg/runtime/lock_futex.c')
-rw-r--r-- | src/pkg/runtime/lock_futex.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pkg/runtime/lock_futex.c b/src/pkg/runtime/lock_futex.c index e6e9be923..c16ac905d 100644 --- a/src/pkg/runtime/lock_futex.c +++ b/src/pkg/runtime/lock_futex.c @@ -130,8 +130,11 @@ runtime·notesleep(Note *n) { if(g != m->g0) runtime·throw("notesleep not on g0"); - while(runtime·atomicload((uint32*)&n->key) == 0) + while(runtime·atomicload((uint32*)&n->key) == 0) { + m->blocked = true; runtime·futexsleep((uint32*)&n->key, 0, -1); + m->blocked = false; + } } #pragma textflag NOSPLIT @@ -143,8 +146,11 @@ notetsleep(Note *n, int64 ns, int64 deadline, int64 now) // does not count against our nosplit stack sequence. if(ns < 0) { - while(runtime·atomicload((uint32*)&n->key) == 0) + while(runtime·atomicload((uint32*)&n->key) == 0) { + m->blocked = true; runtime·futexsleep((uint32*)&n->key, 0, -1); + m->blocked = false; + } return true; } @@ -153,7 +159,9 @@ notetsleep(Note *n, int64 ns, int64 deadline, int64 now) deadline = runtime·nanotime() + ns; for(;;) { + m->blocked = true; runtime·futexsleep((uint32*)&n->key, 0, ns); + m->blocked = false; if(runtime·atomicload((uint32*)&n->key) != 0) break; now = runtime·nanotime(); |