main.mx raw

   1  // A panic is death: the diagnostic goes to the process's stderr FIRST, and the
   2  // process then aborts (status 134). Nothing is sent on the breaker - the
   3  // process ending is the event every domain inside it shares.
   4  package main
   5  
   6  func worker(go chan int32) (closed chan struct{}) {
   7  	for {
   8  		select {
   9  		case <-closed:
  10  			return closed
  11  		case <-go:
  12  			panic("worker died")
  13  		}
  14  	}
  15  }
  16  
  17  func main() {
  18  	select {
  19  	case <-shutdown:
  20  		return
  21  	default:
  22  	}
  23  	g := chan int32{}
  24  	done := spawn(worker, g)
  25  	g <- 1
  26  	<-done
  27  	println("main saw the breaker")
  28  }
  29