aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/time.goc
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/time.goc')
-rw-r--r--libgo/runtime/time.goc10
1 files changed, 8 insertions, 2 deletions
diff --git a/libgo/runtime/time.goc b/libgo/runtime/time.goc
index cae15e5..b3f0fb0 100644
--- a/libgo/runtime/time.goc
+++ b/libgo/runtime/time.goc
@@ -61,15 +61,21 @@ ready(int64 now, Eface e)
void
runtime_tsleep(int64 ns)
{
+ G* g;
Timer t;
- if(ns <= 0)
+ g = runtime_g();
+
+ if(ns <= 0) {
+ g->status = Grunning;
+ g->waitreason = nil;
return;
+ }
t.when = runtime_nanotime() + ns;
t.period = 0;
t.f = ready;
- t.arg.__object = runtime_g();
+ t.arg.__object = g;
addtimer(&t);
runtime_gosched();
}