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

Method Init

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

Source from the content-addressed store, hash-verified

1245 explicit SelfPipeImpl(bool signal_safe) : signal_safe_(signal_safe) {}
1246
1247 Status Init() {
1248 ARROW_ASSIGN_OR_RAISE(pipe_, CreatePipe());
1249 if (signal_safe_) {
1250 if (!please_shutdown_.is_lock_free()) {
1251 return Status::IOError("Cannot use non-lock-free atomic in a signal handler");
1252 }
1253 // We cannot afford blocking writes in a signal handler
1254 RETURN_NOT_OK(SetPipeFileDescriptorNonBlocking(pipe_.wfd.fd()));
1255 }
1256
1257 atfork_handler_ = std::make_shared<AtForkHandler>(
1258 /*before=*/
1259 [weak_self = std::weak_ptr<SelfPipeImpl>(shared_from_this())] {
1260 auto self = weak_self.lock();
1261 if (self) {
1262 self->BeforeFork();
1263 }
1264 return self;
1265 },
1266 /*parent_after=*/
1267 [](std::any token) {
1268 auto self = std::any_cast<std::shared_ptr<SelfPipeImpl>>(std::move(token));
1269 self->ParentAfterFork();
1270 },
1271 /*child_after=*/
1272 [](std::any token) {
1273 auto self = std::any_cast<std::shared_ptr<SelfPipeImpl>>(std::move(token));
1274 self->ChildAfterFork();
1275 });
1276 RegisterAtFork(atfork_handler_);
1277
1278 return Status::OK();
1279 }
1280
1281 Result<uint64_t> Wait() override {
1282 if (pipe_.rfd.closed()) {

Callers 1

MakeMethod · 0.45

Calls 10

BeforeForkMethod · 0.95
ParentAfterForkMethod · 0.95
ChildAfterForkMethod · 0.95
CreatePipeFunction · 0.85
IOErrorFunction · 0.85
RegisterAtForkFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.50
OKFunction · 0.50
fdMethod · 0.45

Tested by

no test coverage detected