1 // ROOT-level parked parent: the root spawns and then immediately parks in a
2 // receive that only the child can wake. If the child's startup needed the
3 // parent's event loop, this is a deadlock; on wasm the page starts the domain,
4 // so the parent may be parked. The intermediate shape (a spawned domain that
5 // spawns and then parks) is spawn_parked_intermediate.mx.
6 package main
7 8 func b(c chan int32) (closed chan struct{}) {
9 select {
10 case <-closed:
11 return closed
12 default:
13 }
14 c <- 7
15 return closed
16 }
17 18 func main() {
19 select {
20 case <-shutdown:
21 return
22 default:
23 }
24 c := chan int32{:1}
25 done := spawn(b, c)
26 v := <-c
27 println("root got", v)
28 <-done
29 println("done")
30 }
31