Skip to content

Commit

Permalink
remove old forklock stub and replace it with sync.RWMutex
Browse files Browse the repository at this point in the history
Signed-off-by: leongross <leon.gross@9elements.com>
  • Loading branch information
leongross committed Nov 11, 2024
1 parent c3a2e91 commit 72cea16
Showing 1 changed file with 5 additions and 26 deletions.
31 changes: 5 additions & 26 deletions src/syscall/forklock.go
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
//go:build tinygo && linux && !wasip1 && !wasip2 && !darwin && !baremetal
//go:build tinygo && linux && !wasip1 && !wasip2 && !darwin && !baremetal && !tinygo.wasm

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)

Check failure on line 12 in src/syscall/forklock.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

undefined: system
Expand All @@ -34,5 +15,3 @@ func CloseOnExec(fd int) {
func SetNonblock(fd int, nonblocking bool) (err error) {
return system.SetNonblock(fd, nonblocking)

Check failure on line 16 in src/syscall/forklock.go

View workflow job for this annotation

GitHub Actions / build-macos (macos-14)

undefined: system
}

// type SysProcAttr struct{}

0 comments on commit 72cea16

Please sign in to comment.