Skip to content

Conversation

@XITRIX
Copy link
Collaborator

@XITRIX XITRIX commented Mar 19, 2025

Issue:
In Moonlight-Switch app I could have 5 tabs with Hosts, on Tab's screen opening, it starts host status check by async CURL request. If I need to open 5th Tab I'll need to scroll throw other 4 tabs which with current solution will cause a chain of requests waiting for each other to complete.

Solution is to introduce ThreadPool which will be able to run tasks not in serial queue, but in parallel.

I introduced it as part of async function by default so it will not require any modifications in existing code, which will allow to utilise multithreading out of the box, but it also could introduce issues if any part of code relies on current serial queue behaviour, so I think it could be a good approach to make default behaviour configurable, to not break any other apps before their developers will check that it works fine in their solutions.

@xfangfang
Copy link
Owner

I just tested the content compiled by CI using psv, and the log shows: terminate called without an active exception, and the software fails to open.

I suspect it has something to do with std::condition_variable. psv's threads have always had various issues, and I'm not really willing to spend time figuring out the exact cause. So, I'm thinking it might be better to let developers maintain their own thread pool.

Right now, I'm using the thread pool from CPR, which works well across all platforms. Or, when I have time, I'll try out the BS::thread_pool. If it passes compatibility tests on all platforms, I'll integrate BS_thread_pool.hpp into Borealis directly, so developers who need it can use it right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants