I once had to write an application in a non-blocking system. I won’t ever do it again if I can avoid it. Seriously once you’re above the hardware interrupt level and can use the abstraction of a thread/goroutine/coroutine and “blocking”, that abstraction will pay for itself 100 times over. IMHO a good system allows this code to be written as:
try {
while (true) {
type = rdr.ReadByte()
length = rdr.ReadUint32()
payload = rdr.Read(length)
out = stdout if type==Stdout else stderr
out.Write(payload)
}
} except (IOException) {
return
}
I once had to write an application in a non-blocking system. I won’t ever do it again if I can avoid it. Seriously once you’re above the hardware interrupt level and can use the abstraction of a thread/goroutine/coroutine and “blocking”, that abstraction will pay for itself 100 times over. IMHO a good system allows this code to be written as:
Nothing really to do with a socket.