Fix rare world lighting thread race
This commit is contained in:
parent
cb1390e9f3
commit
7d847fcd6a
@ -92,6 +92,7 @@ WorldClient::~WorldClient() {
|
|||||||
m_lightingCond.broadcast();
|
m_lightingCond.broadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_lightingThread.finish();
|
||||||
clearWorld();
|
clearWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1446,11 +1447,10 @@ void WorldClient::lightingTileGather() {
|
|||||||
|
|
||||||
void WorldClient::lightingMain() {
|
void WorldClient::lightingMain() {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
MutexLocker locker(m_lightingMutex);
|
||||||
if (m_stopLightingThread)
|
if (m_stopLightingThread)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MutexLocker locker(m_lightingMutex);
|
|
||||||
|
|
||||||
if (m_renderData) {
|
if (m_renderData) {
|
||||||
int64_t start = Time::monotonicMilliseconds();
|
int64_t start = Time::monotonicMilliseconds();
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ private:
|
|||||||
mutable Mutex m_lightingMutex;
|
mutable Mutex m_lightingMutex;
|
||||||
mutable ConditionVariable m_lightingCond;
|
mutable ConditionVariable m_lightingCond;
|
||||||
mutable WorldRenderData* m_renderData;
|
mutable WorldRenderData* m_renderData;
|
||||||
bool m_stopLightingThread;
|
atomic<bool> m_stopLightingThread;
|
||||||
|
|
||||||
SkyPtr m_sky;
|
SkyPtr m_sky;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user