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

Function WaitForRunningLockEnd

mars/comm/messagequeue/message_queue.cc:218–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218void WaitForRunningLockEnd(const MessagePost_t& _message) {
219 if (Handler2Queue(Post2Handler(_message)) == CurrentThreadMessageQueue()) return;
220
221 ScopedLock lock(sg_messagequeue_map_mutex);
222 const MessageQueue_t& id = Handler2Queue(Post2Handler(_message));
223
224 std::map<MessageQueue_t, MessageQueueContent>::iterator pos = sg_messagequeue_map.find(id);
225 if (sg_messagequeue_map.end() == pos) return;
226 MessageQueueContent& content = pos->second;
227
228 if (content.lst_runloop_info.empty()) return;
229
230 auto find_it = std::find_if(content.lst_runloop_info.begin(), content.lst_runloop_info.end(),
231 [&_message](const RunLoopInfo& _v){ return _message == _v.runing_message_id; });
232
233 if (find_it == content.lst_runloop_info.end()) return;
234
235 boost::shared_ptr<Condition> runing_cond = find_it->runing_cond;
236 runing_cond->wait(lock);
237}
238
239void WaitForRunningLockEnd(const MessageQueue_t& _messagequeueid) {
240 if (_messagequeueid == CurrentThreadMessageQueue()) return;

Callers 3

~ActiveLogicMethod · 0.85
CancelAndWaitMethod · 0.85

Calls 7

findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
waitMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected