MCPcopy Create free account
hub / github.com/apache/brpc / OnCreated

Method OnCreated

test/brpc_event_dispatcher_unittest.cpp:425–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423friend class brpc::IOEvent<EventPipe>;
424
425 int OnCreated() {
426 if (pipe(_pipe_fds)) {
427 PLOG(FATAL) << "Fail to create _pipe_fds";
428 return -1;
429 }
430 if (_io_event.Init((void*)id()) != 0) {
431 LOG(ERROR) << "Fail to init IOEvent";
432 return -1;
433 }
434 _io_event.set_bthread_tag(bthread_self_tag());
435 if (_io_event.AddConsumer(_pipe_fds[0]) != 0) {
436 PLOG(ERROR) << "Fail to add SocketId=" << id()
437 << " into EventDispatcher";
438 return -1;
439 }
440
441
442 _input_event_count = 0;
443 return 0;
444 }
445
446 void BeforeRecycled() {
447 brpc::GetGlobalEventDispatcher(_pipe_fds[0], bthread_self_tag())

Callers

nothing calls this directly

Calls 5

idFunction · 0.85
bthread_self_tagFunction · 0.85
set_bthread_tagMethod · 0.80
InitMethod · 0.45
AddConsumerMethod · 0.45

Tested by

no test coverage detected