From f6fc39e69a0a621480bec9ceafd154ec83cf0100 Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 22 Jun 2014 23:19:10 +0200 Subject: Fix race condition on accessing m_time_of_day_speed causing day night race on some architectures --- src/environment.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/environment.h') diff --git a/src/environment.h b/src/environment.h index cecc9133a..a59bbd9a1 100644 --- a/src/environment.h +++ b/src/environment.h @@ -38,6 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/numeric.h" #include "mapnode.h" #include "mapblock.h" +#include "jthread/jmutex.h" class ServerEnvironment; class ActiveBlockModifier; @@ -93,11 +94,9 @@ public: void stepTimeOfDay(float dtime); - void setTimeOfDaySpeed(float speed) - { m_time_of_day_speed = speed; } + void setTimeOfDaySpeed(float speed); - float getTimeOfDaySpeed() - { return m_time_of_day_speed; } + float getTimeOfDaySpeed(); void setDayNightRatioOverride(bool enable, u32 value) { @@ -121,6 +120,9 @@ protected: // Overriding the day-night ratio is useful for custom sky visuals bool m_enable_day_night_ratio_override; u32 m_day_night_ratio_override; + +private: + JMutex m_lock; }; -- cgit v1.2.3