-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support lus thread_pool changes #4127
support lus thread_pool changes #4127
Conversation
@@ -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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from https://github.com/bshoshany/thread-pool/releases/tag/v4.0.0
- API migration: Use the new names of the functions:
push_task()
->detach_task()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API migration: Enclose all tasks with arguments inside a lambda expression. All submitted tasks must have no arguments, but they can still have return values.
Alternatively, std::bind can also be used, if the old syntax is preferred to a lambda. Just wrap it around the task and its arguments: instead of detach_task(task, args...), write detach_task(std::bind(task, args...)). This achieves the same effect, and can be used to easily convert v3.x.x code to v4.0.0
@@ -1091,7 +1091,7 @@ void SaveManager::LoadFile(int fileNum) { | |||
|
|||
void SaveManager::ThreadPoolWait() { | |||
if (smThreadPool) { | |||
smThreadPool->wait_for_tasks(); | |||
smThreadPool->wait(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from https://github.com/bshoshany/thread-pool/releases/tag/v4.0.0
- API migration: Use the new names of the functions:
wait_for_tasks()
->wait()
#define BS_THREAD_POOL_ENABLE_PRIORITY | ||
#define BS_THREAD_POOL_ENABLE_PAUSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use these in LUS, we get errors if we include the header without them before including it in LUS with them
from https://github.com/bshoshany/thread-pool/releases/tag/v4.0.0
by default, the thread pool is in "light mode". Optional features that may affect performance due to additional checks or more complicated algorithms must be enabled by defining suitable macros before including the library:
BS_THREAD_POOL_ENABLE_PAUSE
to enable pausing.
BS_THREAD_POOL_ENABLE_PRIORITY
to enable task priority.
already using upstream LUS
Build Artifacts