Skip to content

Commit

Permalink
support lus thread_pool changes (HarbourMasters#4127)
Browse files Browse the repository at this point in the history
  • Loading branch information
briaguya-ai committed May 9, 2024
1 parent 3bcf178 commit b0b0447
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 @@ -1249,7 +1249,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 @@ -1340,7 +1340,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 @@ -40,7 +40,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 b0b0447

Please sign in to comment.