Skip to content

Commit

Permalink
Use shared_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfadden8 committed Jul 20, 2023
1 parent 26f3adf commit 51d870a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/umpire/Allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Allocator::Allocator(strategy::AllocationStrategy* allocator) noexcept
// we create a mutex to be used during allocation operations
//
if (dynamic_cast<umpire::strategy::ThreadSafeAllocator*>(allocator) != nullptr) {
m_mutex = new std::mutex; // Management of pointer TBD
m_mutex = std::shared_ptr<std::mutex>(new std::mutex);
} else {
m_mutex = nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/umpire/Allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Allocator : private strategy::mixins::Inspector, strategy::mixins::Allocat
* \brief Mutex to be used for AllocationStrategys that
* require thread safety
*/
std::mutex* m_mutex;
std::shared_ptr<std::mutex> m_mutex;
};

inline std::string to_string(const Allocator& a)
Expand Down

0 comments on commit 51d870a

Please sign in to comment.