Revision ebba2b3e libavformat/network.h

View differences:

libavformat/network.h
55 55
#include <arpa/inet.h>
56 56
#endif
57 57

  
58
#if HAVE_POLL_H
59
#include <poll.h>
60
#endif
61

  
58 62
int ff_socket_nonblock(int socket, int enable);
59 63

  
60 64
static inline int ff_network_init(void)
......
67 71
    return 1;
68 72
}
69 73

  
74
static inline int ff_network_wait_fd(int fd, int write)
75
{
76
    int ev = write ? POLLOUT : POLLIN;
77
    struct pollfd p = { .fd = fd, .events = ev, .revents = 0 };
78
    int ret;
79
    ret = poll(&p, 1, 100);
80
    return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : AVERROR(EAGAIN);
81
}
82

  
70 83
static inline void ff_network_close(void)
71 84
{
72 85
#if HAVE_WINSOCK2_H

Also available in: Unified diff