diff options
Diffstat (limited to 'src/pkg/runtime/os_dragonfly.c')
-rw-r--r-- | src/pkg/runtime/os_dragonfly.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pkg/runtime/os_dragonfly.c b/src/pkg/runtime/os_dragonfly.c index f93c02ce1..7bde58f75 100644 --- a/src/pkg/runtime/os_dragonfly.c +++ b/src/pkg/runtime/os_dragonfly.c @@ -40,13 +40,38 @@ getncpu(void) return 1; } +static void futexsleep(void); + #pragma textflag NOSPLIT void runtime·futexsleep(uint32 *addr, uint32 val, int64 ns) { + void (*fn)(void); + + g->m->ptrarg[0] = addr; + g->m->scalararg[0] = val; + g->m->ptrarg[1] = &ns; + + fn = futexsleep; + runtime·onM(&fn); +} + +static void +futexsleep(void) +{ + uint32 *addr; + uint32 val; + int64 ns; int32 timeout = 0; int32 ret; + addr = g->m->ptrarg[0]; + val = g->m->scalararg[0]; + ns = *(int64*)g->m->ptrarg[1]; + g->m->ptrarg[0] = nil; + g->m->scalararg[0] = 0; + g->m->ptrarg[1] = nil; + if(ns >= 0) { // The timeout is specified in microseconds - ensure that we // do not end up dividing to zero, which would put us to sleep |