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

Au contraire: Go has a built-in 'select' keyword that lets you wait on a set of arbitrary (blocking) channel operations. Start up blocking I/O in goroutines, and select on channels that give you the results.


Channels are not network sockets; select cannot be used to wait on a set of network sockets.

(Early versions of Go had a "network channel" concept, but that was removed from the language: https://softwareengineering.stackexchange.com/questions/1540...)


select{} has nothing to with select(), epoll etc. It works on channels only, which are not implemented using those syscalls.


A goroutine is a "task" though. And typically you spin up a goroutine for your select, and hang your current goroutine on its completion.

Seems pretty similar to me.


For networking, it's using epoll() under the scenes; depends on what exact non-blocking operation you're using, though.

See this very very old HN thread:

https://news.ycombinator.com/item?id=3565703

(Hopefully the standard library has improved since then.)


That's not access to the raw system's select/epoll.

It just happens to offer a similar model (and have a select operation).




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

Search: