Files
lincodex/runner/testdata/hostile/go/thread_bomb.go
T

22 lines
365 B
Go

// Thread bomb: goroutines blocked in system calls force the runtime to
// create threads; the cgroup process limit must stop it.
package main
import (
"os"
"syscall"
)
func main() {
var fds [2]int
if err := syscall.Pipe(fds[:]); err != nil {
os.Exit(2)
}
for {
go func() {
buffer := make([]byte, 1)
_, _ = syscall.Read(fds[0], buffer)
}()
}
}