Skip to content

Commit

Permalink
Fix system time & sleep.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Aug 5, 2024
1 parent 34997f1 commit 92bb3a6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ clean:
generate:
go generate ./...

publish: generate
ipfs add -r .

binary: generate
go build -o ww cmd/main.go

Expand Down
Binary file modified examples/hello-world/main.wasm
Binary file not shown.
15 changes: 15 additions & 0 deletions system/cmd/nop/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:generate env GOOS=wasip1 GOARCH=wasm go build -o main.wasm

package main

import (
"fmt"
"time"
)

func main() {
for {
fmt.Println("nop")
time.Sleep(time.Second)
}
}
Binary file added system/cmd/nop/main.wasm
Binary file not shown.
9 changes: 6 additions & 3 deletions ww.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ func (c Cluster) Serve(ctx context.Context) error {
WithName(c.NS).
// WithArgs().
// WithEnv().
WithSysNanosleep().
WithSysNanotime().
WithSysWalltime().
WithRandSource(rand.Reader).
WithOsyield(runtime.Gosched).
WithStdin(c.IO.Stdin()).
WithStdout(c.IO.Stdout()).
WithStderr(c.IO.Stderr()).
WithFS(fs).
WithRandSource(rand.Reader).
WithOsyield(runtime.Gosched))
WithFS(fs))
if err != nil {
return err
}
Expand Down

0 comments on commit 92bb3a6

Please sign in to comment.