On 1/14/18 4:46 PM, Nick Sabalausky wrote:

LockedConnection provides access to the underlying Connection via alias
this. And the alias this means LockedConnection can be implicitly
converted to the underlying Connection.

Am I correct in understanding that means it's possible for a
LockedConnection to go out of scope and become re-locked, but then
something that was already holding a reference to its underlying
Connection now has an "illegal" reference to a connection that's been
returned to the pool?

Yes, but only if you specifically extract it. If you use auto
everywhere, then you shouldn't have a problem.

I take it this is something for user code to be careful to avoid?

This is the case with all reference counting wrappers. If you have
functions that accept an unwrapped object, you have no choice but to
extract it. But as long as you keep a local with that locked connection,
you should be OK.

-Steve