1 | #pragma once |
---|---|
2 | |
3 | #include <torch/csrc/distributed/c10d/Utils.hpp> |
4 | |
5 | namespace c10d { |
6 | namespace tcputil { |
7 | |
8 | #define CONNECT_SOCKET_OFFSET 2 |
9 | |
10 | inline int poll(struct pollfd *fds, unsigned long nfds, int timeout) { |
11 | return ::poll(fds, nfds, timeout); |
12 | } |
13 | |
14 | inline void addPollfd(std::vector<struct pollfd> &fds, int socket, |
15 | short events) { |
16 | fds.push_back({.fd = socket, .events = events}); |
17 | } |
18 | |
19 | inline struct ::pollfd getPollfd(int socket, short events) { |
20 | struct ::pollfd res = {.fd = socket, .events = events}; |
21 | return res; |
22 | } |
23 | |
24 | } // namespace tcputil |
25 | } // namespace c10d |
26 |