mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
ASyncRunStep doesn't need to lock when do setTimeOfDaySpeed.
* setTimeOfDaySpeed already lock a mutex when modify the value, we don't need to lock all environment. * add a fine grain lock for getTimeOfDay and setTimeOfDay to solve environment multithread modifications on this value
This commit is contained in:
@@ -81,22 +81,13 @@ public:
|
||||
u32 getDayNightRatio();
|
||||
|
||||
// 0-23999
|
||||
virtual void setTimeOfDay(u32 time)
|
||||
{
|
||||
m_time_of_day = time;
|
||||
m_time_of_day_f = (float)time / 24000.0;
|
||||
}
|
||||
|
||||
u32 getTimeOfDay()
|
||||
{ return m_time_of_day; }
|
||||
|
||||
float getTimeOfDayF()
|
||||
{ return m_time_of_day_f; }
|
||||
virtual void setTimeOfDay(u32 time);
|
||||
u32 getTimeOfDay();
|
||||
float getTimeOfDayF();
|
||||
|
||||
void stepTimeOfDay(float dtime);
|
||||
|
||||
void setTimeOfDaySpeed(float speed);
|
||||
|
||||
float getTimeOfDaySpeed();
|
||||
|
||||
void setDayNightRatioOverride(bool enable, u32 value)
|
||||
@@ -134,7 +125,8 @@ protected:
|
||||
bool m_cache_enable_shaders;
|
||||
|
||||
private:
|
||||
JMutex m_lock;
|
||||
JMutex m_timeofday_lock;
|
||||
JMutex m_time_lock;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user