Skip to content

Commit

Permalink
support lus thread_pool changes (#4127)
Browse files Browse the repository at this point in the history
  • Loading branch information
briaguya-ai authored May 7, 2024
1 parent 8d3902a commit 52fad95
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions soh/soh/SaveManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ void SaveManager::SaveSection(int fileNum, int sectionID, bool threaded) {
auto saveContext = new SaveContext;
memcpy(saveContext, &gSaveContext, sizeof(gSaveContext));
if (threaded) {
smThreadPool->push_task_back(&SaveManager::SaveFileThreaded, this, fileNum, saveContext, sectionID);
smThreadPool->detach_task(std::bind(&SaveManager::SaveFileThreaded, this, fileNum, saveContext, sectionID));
} else {
SaveFileThreaded(fileNum, saveContext, sectionID);
}
Expand Down Expand Up @@ -1091,7 +1091,7 @@ void SaveManager::LoadFile(int fileNum) {

void SaveManager::ThreadPoolWait() {
if (smThreadPool) {
smThreadPool->wait_for_tasks();
smThreadPool->wait();
}
}

Expand Down
5 changes: 4 additions & 1 deletion soh/soh/SaveManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ typedef struct {
#include <functional>
#include <vector>
#include <filesystem>
#include "thread-pool/BS_thread_pool.hpp"

#define BS_THREAD_POOL_ENABLE_PRIORITY
#define BS_THREAD_POOL_ENABLE_PAUSE
#include <BS_thread_pool.hpp>

#include "z64save.h"

Expand Down

0 comments on commit 52fad95

Please sign in to comment.