What are the differences between poll and select?

后端 未结 3 1582
执笔经年
执笔经年 2020-11-29 14:59

I am referring to the POSIX standard select and poll system C API calls.

3条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 15:12

    Both of them are slow and mostly the same, But different in size and some kind of features!

    When you write an iterator, You need to copy the set of select every time! While poll has fixed this kind of problem to have beautiful code. Another difference is that poll can handle more than 1024 file descriptors (FDs) by default. poll can handle different events to make the program more readable instead of having a lot of variables to handle this kind of job. Operations in poll and select is linear and slow because of having a lot of checks.

提交回复
热议问题