What you are seeing is Poly/ML repeatedly polling then blocking for a short while. It doesn't use a blocking call or a long time-out because with multi-threading there's the possibility that another thread might interrupt it, perhaps as the result of a console interrupt.

Actually, looking at the code I think it could be improved. I'll have a look at it.

David

On 13/12/2018 09:01, Kostirya wrote:
   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.
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to