MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Init

Method Init

phxqueue/consumer/freqman.cpp:80–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78FreqMan::~FreqMan() {}
79
80comm::RetCode FreqMan::Init(const int topic_id, Consumer *consumer) {
81 impl_->topic_id = topic_id;
82 impl_->consumer = consumer;
83
84 impl_->last_update_time = comm::utils::Time::GetSteadyClockMS();
85
86 impl_->shm = (FreqManShm_t *)mmap(nullptr, sizeof(FreqManShm_t), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
87 if (MAP_FAILED == impl_->shm) {
88 QLErr("mmap failed %s", strerror(errno));
89 return comm::RetCode::RET_ERR_SYS;
90 }
91 memset(impl_->shm, 0, sizeof(FreqManShm_t));
92
93 return comm::RetCode::RET_OK;
94}
95
96static void ClearConsumeStat(ConsumeStat_t &consume_stat, const int nhandle_id) {
97 consume_stat.nget = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected