MCPcopy Create free account
hub / github.com/DFHack/dfhack / reconnect

Method reconnect

plugins/devel/kittens.cpp:269–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267 });
268 }
269 void reconnect(size_t pos) {
270 auto b = other.lock();
271 if (!b)
272 return;
273 // Not required to use Sig::lock because other holds strong reference to
274 // Signal. But this just shows how weak_ref could be used.
275 auto sig = Sig::lock(other_sig);
276 if (!sig)
277 return;
278 con[pos] = sig->connect(b,
279 [this](uint32_t) {
280 uint32_t old = callee.fetch_add(1);
281 assert(old != 0xDEDEDEDE); (void)old;
282 std::this_thread::sleep_for(delay);
283 assert(callee != 0xDEDEDEDE);
284 });
285 }
286 void connect(color_ostream& o, shared& a, shared& b,size_t pos, uint32_t c)
287 {
288 out = &o;

Callers 1

sharedsignalFunction · 0.80

Calls 2

lockMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected