WinSockUtils.hpp 552 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <c10d/Utils.hpp>
  3. namespace c10d {
  4. namespace tcputil {
  5. #define CONNECT_SOCKET_OFFSET 1
  6. inline int poll(struct pollfd *fdArray, unsigned long fds, int timeout) {
  7. return WSAPoll(fdArray, fds, timeout);
  8. }
  9. inline void addPollfd(std::vector<struct pollfd> &fds, int socket,
  10. short events) {
  11. fds.push_back({(SOCKET)socket, events});
  12. }
  13. inline struct ::pollfd getPollfd(int socket, short events) {
  14. struct ::pollfd res = {(SOCKET)socket, events};
  15. return res;
  16. }
  17. } // namespace tcputil
  18. } // namespace c10d