summaryrefslogtreecommitdiff
path: root/libgo/runtime/lock_futex.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/lock_futex.c')
-rw-r--r--libgo/runtime/lock_futex.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libgo/runtime/lock_futex.c b/libgo/runtime/lock_futex.c
index cdc12d7c75c..9a533a577a4 100644
--- a/libgo/runtime/lock_futex.c
+++ b/libgo/runtime/lock_futex.c
@@ -118,8 +118,12 @@ runtime_notewakeup(Note *n)
void
runtime_notesleep(Note *n)
{
+ if(runtime_m()->profilehz > 0)
+ runtime_setprof(false);
while(runtime_atomicload(&n->key) == 0)
runtime_futexsleep(&n->key, 0, -1);
+ if(runtime_m()->profilehz > 0)
+ runtime_setprof(true);
}
void
@@ -135,14 +139,18 @@ runtime_notetsleep(Note *n, int64 ns)
if(runtime_atomicload(&n->key) != 0)
return;
+ if(runtime_m()->profilehz > 0)
+ runtime_setprof(false);
deadline = runtime_nanotime() + ns;
for(;;) {
runtime_futexsleep(&n->key, 0, ns);
if(runtime_atomicload(&n->key) != 0)
- return;
+ break;
now = runtime_nanotime();
if(now >= deadline)
- return;
+ break;
ns = deadline - now;
}
+ if(runtime_m()->profilehz > 0)
+ runtime_setprof(true);
}