MCPcopy Index your code
hub / github.com/python/cpython / handleEAGAIN

Function handleEAGAIN

Platforms/emscripten/streams.mjs:52–69  ·  view source on GitHub ↗

* Calls the callback and handle node EAGAIN errors.

(cb)

Source from the content-addressed store, hash-verified

50 * Calls the callback and handle node EAGAIN errors.
51 */
52function handleEAGAIN(cb) {
53 while (true) {
54 try {
55 return cb();
56 } catch (e) {
57 if (e && e.code === "EAGAIN") {
58 // Presumably this means we're in node and tried to read from/write to
59 // an O_NONBLOCK file descriptor. Synchronously sleep for 10ms then try
60 // again. In case for some reason we fail to sleep, propagate the error
61 // (it will turn into an EOFError).
62 if (syncSleep(10)) {
63 continue;
64 }
65 }
66 throw e;
67 }
68 }
69}
70
71function readWriteHelper(stream, cb, method) {
72 let nbytes;

Callers 1

readWriteHelperFunction · 0.85

Calls 2

cbFunction · 0.85
syncSleepFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…