3 ms·
Mistake 10 has a race condition. The shared pointer could be cleaned up between the weak pointer expiry check and lock. Why not just lock and check for null bef
by inlined 10y ago
Mistake 10 has a race condition. The shared pointer could be cleaned up between the weak pointer expiry check and lock. Why not just lock and check for null before using it?
- superbatfish 10y agoYou're right. These were all good tips except for #10, where the "solution" is not thread-safe. Checking for null is better.