run all ble operations which involve peripheral in its own thread#830
run all ble operations which involve peripheral in its own thread#830Andrey1994 wants to merge 1 commit intomasterfrom
Conversation
Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2335beaae2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return run_on_simpleble_thread ([func, handle] () { return func (handle); }); | ||
| #else | ||
| return ::simpleble_peripheral_connect (handle); | ||
| return run_on_simpleble_thread ( | ||
| [handle] () { return ::simpleble_peripheral_connect (handle); }); |
There was a problem hiding this comment.
Route every peripheral API call through dispatcher
This patch moves only a subset of simpleble_peripheral_* calls onto run_on_simpleble_thread; simpleble_peripheral_address and simpleble_peripheral_identifier still run on the caller thread, but their handles are later used by dispatched calls like connect/read/write. In current call flows (for example scan callbacks in src/board_controller/openbci/ganglion_native.cpp and src/board_controller/brainalive/brainalive.cpp), the same simpleble_peripheral_t is touched from callback thread(s) and then from the dispatcher thread, which can still violate Windows COM/thread-affinity expectations and cause the same class of failures this change is intended to prevent.
Useful? React with 👍 / 👎.
No description provided.