mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Fix deadlock if MeshUpdateThread asks new textures while it is being stopped (happened if texture data was transferred slowly)
This commit is contained in:
parent
8b8ef8acc0
commit
b6539399f4
@ -1519,7 +1519,12 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
|||||||
std::istringstream is(datastring, std::ios_base::binary);
|
std::istringstream is(datastring, std::ios_base::binary);
|
||||||
|
|
||||||
// Stop threads while updating content definitions
|
// Stop threads while updating content definitions
|
||||||
m_mesh_update_thread.stop();
|
m_mesh_update_thread.setRun(false);
|
||||||
|
// Process the remaining TextureSource queue to let MeshUpdateThread
|
||||||
|
// get it's remaining textures and thus let it stop
|
||||||
|
while(m_mesh_update_thread.IsRunning()){
|
||||||
|
m_tsrc->processQueue();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
u16 command
|
u16 command
|
||||||
@ -1595,7 +1600,12 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
|||||||
m_tooldef_received = true;
|
m_tooldef_received = true;
|
||||||
|
|
||||||
// Stop threads while updating content definitions
|
// Stop threads while updating content definitions
|
||||||
m_mesh_update_thread.stop();
|
m_mesh_update_thread.setRun(false);
|
||||||
|
// Process the remaining TextureSource queue to let MeshUpdateThread
|
||||||
|
// get it's remaining textures and thus let it stop
|
||||||
|
while(m_mesh_update_thread.IsRunning()){
|
||||||
|
m_tsrc->processQueue();
|
||||||
|
}
|
||||||
|
|
||||||
std::istringstream tmp_is(deSerializeLongString(is), std::ios::binary);
|
std::istringstream tmp_is(deSerializeLongString(is), std::ios::binary);
|
||||||
m_tooldef->deSerialize(tmp_is);
|
m_tooldef->deSerialize(tmp_is);
|
||||||
@ -1644,7 +1654,12 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
|||||||
m_craftitemdef_received = true;
|
m_craftitemdef_received = true;
|
||||||
|
|
||||||
// Stop threads while updating content definitions
|
// Stop threads while updating content definitions
|
||||||
m_mesh_update_thread.stop();
|
m_mesh_update_thread.setRun(false);
|
||||||
|
// Process the remaining TextureSource queue to let MeshUpdateThread
|
||||||
|
// get it's remaining textures and thus let it stop
|
||||||
|
while(m_mesh_update_thread.IsRunning()){
|
||||||
|
m_tsrc->processQueue();
|
||||||
|
}
|
||||||
|
|
||||||
std::istringstream tmp_is(deSerializeLongString(is), std::ios::binary);
|
std::istringstream tmp_is(deSerializeLongString(is), std::ios::binary);
|
||||||
m_craftitemdef->deSerialize(tmp_is);
|
m_craftitemdef->deSerialize(tmp_is);
|
||||||
|
Loading…
Reference in New Issue
Block a user