select() socket call CPU consumption -


if have following code select call , suppose socket fds not ready i/o of time, thread take cpu or sleep , let other thread job. select() cpu intensive call?

while(1) {    select(maxfd, &rfds, null, null, null); } 

will behaviour same timeout = 0 (kind of polling ) instead of null.

if timeout value null, select block indefinitely until data available on sockets , file descriptors in rfds. however, data available on file descriptor in set, code have consume entire cpu since don't show thing suggests draining data off socket. (the second call select return indicating there still data on socket).

if pass in zero'd out timeval select, non-blocking poll. it's equivalent calling send() or recv() msg_dontwait flag (but without data being copied).


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -