Skip to content

run all ble operations which involve peripheral in its own thread#830

Closed
Andrey1994 wants to merge 1 commit intomasterfrom
ble_windows_thread
Closed

run all ble operations which involve peripheral in its own thread#830
Andrey1994 wants to merge 1 commit intomasterfrom
ble_windows_thread

Conversation

@Andrey1994
Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +607 to +610
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); });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@Andrey1994 Andrey1994 closed this Apr 29, 2026
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.

1 participant