Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Blocking system calls spawn OS threads in Go, which can be cached and recycled for new goroutines. You don't see this if you code to pkg/net because it multiplexes i/o with a select/kqueue goroutine, but you'll see it right away if you code directly to the syscalls.

Close isn't a blocking call, though.



Close is annotated as a blocking syscall in http://golang.org/src/pkg/syscall/syscall_linux.go#L810

Is there a guarantee on Linux that close can't block? (I suppose it depends on the file type and the definition of blocking.)


Only if SO_LINGER is set.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: