MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / select_read

Function select_read

dependencies/httplib/httplib.h:2269–2295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2267}
2268
2269inline ssize_t select_read(socket_t sock, time_t sec, time_t usec) {
2270#ifdef CPPHTTPLIB_USE_POLL
2271 struct pollfd pfd_read;
2272 pfd_read.fd = sock;
2273 pfd_read.events = POLLIN;
2274
2275 auto timeout = static_cast<int>(sec * 1000 + usec / 1000);
2276
2277 return handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); });
2278#else
2279#ifndef _WIN32
2280 if (sock >= FD_SETSIZE) { return 1; }
2281#endif
2282
2283 fd_set fds;
2284 FD_ZERO(&fds);
2285 FD_SET(sock, &fds);
2286
2287 timeval tv;
2288 tv.tv_sec = static_cast<long>(sec);
2289 tv.tv_usec = static_cast<decltype(tv.tv_usec)>(usec);
2290
2291 return handle_EINTR([&]() {
2292 return select(static_cast<int>(sock + 1), &fds, nullptr, nullptr, &tv);
2293 });
2294#endif
2295}
2296
2297inline ssize_t select_write(socket_t sock, time_t sec, time_t usec) {
2298#ifdef CPPHTTPLIB_USE_POLL

Callers 5

is_socket_aliveFunction · 0.85
keep_aliveFunction · 0.85
is_readableMethod · 0.85
httplib.hFile · 0.85

Calls 1

handle_EINTRFunction · 0.85

Tested by

no test coverage detected