UNIX网络编程读书笔记:pselect函数函数原型

pselect函数是由POSIX发明的,其原型如下:

#include <sys/select.h>
#include <signal.h>
#include <time.h>
int pselect (int maxfdpl, fd_set *readset, fd_set *writeset, 
    fd_set *exceptset, const struct timespec *timeout,
    const sigset_t *sigmask);
返回值:就绪描述字的个数,0——超时,-1——出错

UNIX网络编程读书笔记:pselect函数pselect相对于select的两个变化

(1)pselect使用timespec结构,而不使用timeval结构。timespec结构是POSIX的有一个发明。

struct timespec {
    time_t    tv_sec;     /* seconds */
    long      tv_nsec;    /* nanoseconds */
};

这两个结构的区别在于第二个成员:新结构的该成员tv_nsec指定纳秒数,而旧结构的该成员tv_usec指定微秒数。

(2)pselect函数增加了第六个参数:一个指向信号掩码的指针。

UNIX网络编程读书笔记:pselect函数

相关文章:

  • 2021-10-30
  • 2022-02-14
  • 2022-03-07
  • 2021-05-23
  • 2022-03-06
  • 2022-02-22
猜你喜欢
  • 2021-11-04
  • 2022-01-23
  • 2022-02-02
  • 2021-09-24
  • 2021-12-04
  • 2022-02-08
  • 2021-10-08
相关资源
相似解决方案