MCPcopy Create free account
hub / github.com/Tencent/mars / __ComputerWaitTime

Function __ComputerWaitTime

mars/comm/messagequeue/message_queue.cc:421–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421static int64_t __ComputerWaitTime(const MessageWrapper& _wrap) {
422 int64_t wait_time = 0;
423
424 if (kImmediately == _wrap.timing.type) {
425 wait_time = 0;
426 } else if (kAfter == _wrap.timing.type) {
427 int64_t time_cost = ::gettickspan(_wrap.record_time);
428 wait_time = _wrap.timing.after - time_cost;
429 } else if (kPeriod == _wrap.timing.type) {
430 int64_t time_cost = ::gettickspan(_wrap.record_time);
431
432 if (kAfter == _wrap.periodstatus) {
433 wait_time = _wrap.timing.after - time_cost;
434 } else if (kPeriod == _wrap.periodstatus) {
435 wait_time = _wrap.timing.period - time_cost;
436 }
437 }
438
439 return 0 < wait_time ? wait_time : 0;
440}
441
442MessagePost_t FasterMessage(const MessageHandler_t& _handlerid, const Message& _message, const MessageTiming& _timing) {
443 ScopedLock lock(sg_messagequeue_map_mutex);

Callers 1

FasterMessageFunction · 0.85

Calls 1

gettickspanFunction · 0.85

Tested by

no test coverage detected