News for hackers. Stuff that matters.
Re:Debugging memory corruption: who the hell writes “2” into... by spacechild1 on Sunday November 14, 2021 @08:28AM (#29217045)
Actually, the select() call was blocking. Non-blocking in this context would mean periodically calling select() with a timeout of 0.
Re:Debugging memory corruption: who the hell writes “2” into... by bullen on Sunday November 14, 2021 @08:46AM (#29217134)
Select being blocking is normal, non-blocking IO does not depend on select being non-blocking.

Select returns the list of non-blocking sockets that have data read/write pending.

Re:Debugging memory corruption: who the hell writes “2” into... by spacechild1 on Sunday November 14, 2021 @10:23AM (#29217697)
select() is just a means to multiplex network I/O. It can be either blocking or non-blocking, depending on your application architecture. I have worked on both kinds.

BTW, the sockets themselves don't even have to be non-blocking.

Also, I'd like to stress that the concepts or blocking/non-blocking I/O and synchronous/asynchronous I/O are really orthogonal. You can do synchronous networking with non-blocking sockets and vice versa.

Re:Debugging memory corruption: who the hell writes “2” into... by spacechild1 on Sunday November 14, 2021 @11:10AM (#29218030)
Or to put it another way: depending on the timeout value, select() can achieve blocking or non-blocking I/O on several sockets simultaneously. In both cases, the sockets themselves can be either blocking or non-blocking.

There is no practical difference between blocking on select() for multiple sockets or blocking on recv() for a single socket - in both cases the thread can't do anything else.