1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Use multiple threads for mesh generation (#13062)

Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
x2048 2022-12-27 18:44:18 +01:00 committed by GitHub
parent 03e710160f
commit 89e7f72c92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 183 additions and 57 deletions

View file

@ -491,16 +491,16 @@ u32 TextureSource::getTextureId(const std::string &name)
infostream<<"getTextureId(): Queued: name=\""<<name<<"\""<<std::endl;
// We're gonna ask the result to be put into here
static ResultQueue<std::string, u32, u8, u8> result_queue;
static thread_local ResultQueue<std::string, u32, u8, u8> result_queue;
// Throw a request in
m_get_texture_queue.add(name, 0, 0, &result_queue);
try {
while(true) {
// Wait result for a second
// Wait for result for up to 4 seconds (empirical value)
GetResult<std::string, u32, u8, u8>
result = result_queue.pop_front(1000);
result = result_queue.pop_front(4000);
if (result.key == name) {
return result.item;