-
-
Notifications
You must be signed in to change notification settings - Fork 34
Thread pool #712
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
Thread pool #712
Conversation
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.
Pull Request Overview
Introduces a lock-free single-producer thread pool and integrates it into PromiseVendor to offload asynchronous promise work from ad-hoc std::thread creation.
- Adds ThreadPool with load balancer and worker threads using SPSC channels.
- Replaces per-promise detached thread creation with pooled task scheduling.
- Adds configurable constants for thread pool sizing.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| audioapi/utils/ThreadPool.hpp | New thread pool implementation (load balancer + worker queues). |
| audioapi/jsi/JsiPromise.h | Integrates a shared ThreadPool into PromiseVendor. |
| audioapi/jsi/JsiPromise.cpp | Uses ThreadPool->schedule instead of spawning detached threads. |
| audioapi/core/utils/Constants.h | Adds sizing constants for the thread pool. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/react-native-audio-api/common/cpp/audioapi/utils/ThreadPool.hpp
Outdated
Show resolved
Hide resolved
packages/react-native-audio-api/common/cpp/audioapi/utils/ThreadPool.hpp
Outdated
Show resolved
Hide resolved
|
LGTM |
michalsek
left a comment
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.
one nit, good job! :)
Closes RNAA-263
Closes RNAA-259
Implemented simple thread pool which allows for blazingly fast task dispatch. It has some limitations and allow dispatch only from one thread. It is not thread safe. To make it safer while mantaining the speed multi-producer multi-consumer queue/channel would be required. But for now it seems sufficient cuz we want to mostly offload audio thread and still we can create multiple PromiseVendors.
Introduced changes
Checklist