| 63 | |
| 64 | template<typename T> |
| 65 | void UniqueThreadSafeOwner<T>::reset() |
| 66 | { |
| 67 | if ( !obj_ ) // fast path avoiding locking and unnecessary writing in obj_ when it is already null |
| 68 | return; |
| 69 | std::unique_lock lock( mutex_ ); |
| 70 | assert( !construction_ ); // one thread constructs the object, and this thread resets it |
| 71 | obj_.reset(); |
| 72 | } |
| 73 | |
| 74 | template<typename T> |
| 75 | void UniqueThreadSafeOwner<T>::update( const std::function<void(T&)> & updater ) |
no outgoing calls
no test coverage detected