From ff8ae468613a30ee1e6a3e2db18042992c8e08ed Mon Sep 17 00:00:00 2001 From: Bram Veenboer <bram.veenboer@gmail.com> Date: Wed, 12 Feb 2020 14:25:57 +0100 Subject: [PATCH] Make ITRFDirection::at thread safe by adding a lock --- ITRFDirection.cc | 2 ++ ITRFDirection.h | 1 + 2 files changed, 3 insertions(+) diff --git a/ITRFDirection.cc b/ITRFDirection.cc index ff6c8e5d..1f484926 100644 --- a/ITRFDirection.cc +++ b/ITRFDirection.cc @@ -80,6 +80,8 @@ ITRFDirection::ITRFDirection(const vector3r_t &direction): vector3r_t ITRFDirection::at(real_t time) const { + std::lock_guard<std::mutex> lock(itsMutex); + // Cannot use MeasFrame::resetEpoch(Double), because that assumes the // argument is UTC in (fractional) days (MJD). itsFrame.resetEpoch(casacore::Quantity(time, "s")); diff --git a/ITRFDirection.h b/ITRFDirection.h index 08200021..d7d8997f 100644 --- a/ITRFDirection.h +++ b/ITRFDirection.h @@ -61,6 +61,7 @@ private: mutable casacore::MeasFrame itsFrame; mutable casacore::MDirection::Convert itsConverter; + mutable std::mutex itsMutex; }; // @} -- GitLab