pipe_channel_wasm.mx raw
1 //go:build js && wasm
2
3 package runtime
4
5 import (
6 "internal/task"
7 "unsafe"
8 )
9
10 // WASM stubs for native-only pipe channel and domain functions.
11 // On WASM, spawn uses SAB channels (spawn_wasm.mx); pipe-bound channels
12 // do not exist. pipeBoundFd is always 0 so the guards in chan.mx never
13 // fire, but the symbols must exist for compilation.
14
15 func PipeChanCloseSignal(_ *channel) {}
16 func (ch *channel) tryPipeSend(_ unsafe.Pointer) bool { return false }
17 func (ch *channel) tryPipeRecv(_ unsafe.Pointer) (received, ok bool) { return false, false }
18 func pipeSelectRecheck(_ *task.Task, _ []chanSelectState, _ unsafe.Pointer) bool { return false }
19
20 // domainShutdownAll is a no-op on WASM: no OS child processes.
21 func domainShutdownAll() {}
22
23 // PipeFDCanSend always returns true on WASM (SAB channels are unbounded).
24 func PipeFDCanSend(_ int32) bool { return true }
25