MCPcopy Create free account
hub / github.com/apache/arrow / DoSend

Method DoSend

cpp/src/arrow/util/io_util.cc:1352–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350 Status ClosedPipe() const { return Status::Invalid("Self-pipe closed"); }
1351
1352 bool DoSend(uint64_t payload) {
1353 // This needs to be async-signal safe as it's called from Send()
1354 if (pipe_.wfd.closed()) {
1355 // Already closed
1356 return false;
1357 }
1358 const char* buf = reinterpret_cast<const char*>(&payload);
1359 auto buf_size = static_cast<int64_t>(sizeof(payload));
1360 while (buf_size > 0) {
1361 int64_t n_written =
1362 PIPE_WRITE(pipe_.wfd.fd(), buf, static_cast<uint32_t>(buf_size));
1363 if (n_written < 0) {
1364 if (errno == EINTR) {
1365 continue;
1366 } else {
1367 // Perhaps EAGAIN if non-blocking, or EBADF if closed in the meantime?
1368 // In any case, we can't do anything more here.
1369 break;
1370 }
1371 }
1372 buf += n_written;
1373 buf_size -= n_written;
1374 }
1375 return buf_size == 0;
1376 }
1377
1378 const bool signal_safe_;
1379 Pipe pipe_;

Callers

nothing calls this directly

Calls 2

closedMethod · 0.45
fdMethod · 0.45

Tested by

no test coverage detected