mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
d01a932201
* runtime,syscall,internal/poll,os: wasip1 poll_oneoff scheduler integration + net.FileListener On wasip1 today every syscall.Read/Write blocks the entire wasm module — the cooperative scheduler invokes poll_oneoff only for sleep/timer wakeups, and there's no path from the net package to a working TCP server. This change fixes both: it threads poll_oneoff through the scheduler's idle path so a goroutine doing FD I/O parks instead of blocking the module, and it provides enough internal/poll / os / syscall surface that upstream Go's net.FileListener / net.FileConn works on a host-pre-opened TCP socket. * runtime: keep scheduler_cooperative idle-wait calls direct TestBinarySize/hifive1b/examples/echo regressed by 32 bytes after the previous commit routed the scheduler's idle wait through a schedulerIdleWait helper. The extra call frame + branch landed on every non-wasip1 cooperative target, where the original direct sleepTicks / waitForEvents calls compile to a single inlined call.
13 lines
422 B
Go
13 lines
422 B
Go
//go:build !wasip1
|
|
|
|
package os
|
|
|
|
// pollFD is a literal empty struct on non-wasip1 targets. As long as the
|
|
// field is not the last in its containing struct, Go gives a zero-sized
|
|
// non-trailing field a true zero byte layout — file then occupies exactly
|
|
// the same space as it would without the field at all.
|
|
type pollFD struct{}
|
|
|
|
func (pollFD) Close() error { return nil }
|
|
func (pollFD) Exist() bool { return false }
|