diff options
author | sapier <Sapier at GMX dot net> | 2014-06-22 23:19:10 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2014-06-23 00:26:57 +0200 |
commit | f6fc39e69a0a621480bec9ceafd154ec83cf0100 (patch) | |
tree | 603c593d6207478e19b731423e0fe436424bf16f /src/environment.h | |
parent | b3a2ef1a911b5ee22ff6478b5a3f9a12f6e40121 (diff) | |
download | minetest-f6fc39e69a0a621480bec9ceafd154ec83cf0100.tar.gz minetest-f6fc39e69a0a621480bec9ceafd154ec83cf0100.tar.bz2 minetest-f6fc39e69a0a621480bec9ceafd154ec83cf0100.zip |
Fix race condition on accessing m_time_of_day_speed causing day night race on some architectures
Diffstat (limited to 'src/environment.h')
-rw-r--r-- | src/environment.h | 10 |
1 files changed, 6 insertions, 4 deletions
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; }; |