Hello.
My application use select or poll before accept socket.
I trace system calls and found that too many select or poll calls occur.
When I use select:
select(1024,{ },{ },{ },{ 0.010000 }) = 0 (0x0)
select(1024,{ 3 },{ },{ },{ 0.000000 }) = 0 (0x0)
select(1024,{ },{ },{ },{ 0.010000 }) = 0 (0x0)
select(1024,{ 3 },{ },{ },{ 0.000000 }) = 0 (0x0)
select(1024,{ },{ },{ },{ 0.010000 }) = 0 (0x0)
...
select(1024,{ 3 },{ },{ },{ 0.000000 }) = 1 (0x1)
accept(3,{ AF_INET 127.0.0.1:54121 },0xbb9f9c5c) = 4 (0x4)
When I use poll and do *not* select:
poll({ 3/POLLIN },1,0) = 0 (0x0)
select(1024,{ },{ },{ },{ 0.010000 }) = 0 (0x0)
poll({ 3/POLLIN },1,0) = 0 (0x0)
select(1024,{ },{ },{ },{ 0.010000 }) = 0 (0x0)
poll({ 3/POLLIN },1,0) = 0 (0x0)
select(1024,{ },{ },{ },{ 0.010000 }) = 0 (0x0)
poll({ 3/POLLIN },1,0) = 1 (0x1)
...
accept(3,{ AF_INET 127.0.0.1:48659 },0xbb9f9c5c) = 4 (0x4)
My application wait incoming connection and do nothing but use 1-2% CPU.
What is it and why it is?
By the way.
When I use kevent (epoll on linux) via FFI it is all right.
Nick.