MCPcopy Create free account
hub / github.com/FastLED/FastLED / set_nonblocking

Function set_nonblocking

src/fl/stl/asio/ip/tcp.cpp.hpp:115–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115bool set_nonblocking(int fd, bool enabled) {
116#ifdef FL_IS_WIN
117 u_long mode = enabled ? 1 : 0;
118 return ioctlsocket(fd, FIONBIO, &mode) == 0;
119#else
120 int flags = fcntl(fd, F_GETFL, 0);
121 if (flags == -1)
122 return false;
123 if (enabled) {
124 return fcntl(fd, F_SETFL, flags | O_NONBLOCK) != -1;
125 } else {
126 return fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) != -1;
127 }
128#endif
129}
130
131bool is_would_block() {
132#ifdef FL_IS_WIN

Callers 4

connectMethod · 0.70
set_non_blockingMethod · 0.70
openMethod · 0.70
acceptMethod · 0.70

Calls 1

fcntlFunction · 0.50

Tested by

no test coverage detected