mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00: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:
parent
1b2f64473e
commit
7f8f9785d7
3 changed files with 40 additions and 35 deletions
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue