MCPcopy Create free account
hub / github.com/PhoneVR-Developers/PhoneVR / safeDispatch

Method safeDispatch

code/common/src/PVRSocketUtils.cpp:109–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void TCPTalker::safeDispatch(function<void()> hdl) {
110 try {
111 sktMtx.lock();
112 if (_skt) {
113 bool done = false;
114 _skt->get_io_service().dispatch([&] {
115 hdl();
116 done = true;
117 });
118 while (!done)
119 sleep_for(milliseconds(10));
120 }
121 sktMtx.unlock();
122 } catch (exception &e) {
123 PVR_DB_I("[TCPTalker::safeDispatch] Exception caught: " + string(e.what()));
124 }
125}
126
127bool TCPTalker::send(PVR_MSG msgType, vector<uint8_t> data) {
128 vector<uint8_t> buf = {'p', 'v', 'r', (uint8_t) msgType, 0, 0};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected