diff --git a/src/syscall/forklock.go b/src/syscall/forklock.go index cab4721400..a158b24871 100644 --- a/src/syscall/forklock.go +++ b/src/syscall/forklock.go @@ -1,31 +1,12 @@ -//go:build tinygo && linux && !wasip1 && !wasip2 && !darwin && !baremetal +//go:build tinygo && linux && !wasip1 && !wasip2 && tinygo.wasm && !wasm_unknown && !darwin && !baremetal && !nintendoswitch package syscall -// This is the original ForkLock: -// -// var ForkLock sync.RWMutex -// -// This requires importing sync, but importing sync causes an import loop: -// -// package tinygo.org/x/drivers/examples/net/tcpclient -// imports bytes -// imports io -// imports sync -// imports internal/task -// imports runtime/interrupt -// imports device/arm -// imports syscall -// imports sync: import cycle not allowed -// -// So for now, make our own stubbed-out ForkLock that doesn't use sync.. +import ( + "sync" +) -type forklock struct{} - -func (f forklock) RLock() {} -func (f forklock) RUnlock() {} - -var ForkLock forklock +var ForkLock sync.RWMutex func CloseOnExec(fd int) { system.CloseOnExec(fd) @@ -34,5 +15,3 @@ func CloseOnExec(fd int) { func SetNonblock(fd int, nonblocking bool) (err error) { return system.SetNonblock(fd, nonblocking) } - -// type SysProcAttr struct{}