Skip to content
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

bluetooth: host: Added support for unregistering bt_conn callbacks #18237

Closed
wants to merge 1 commit into from
Closed

Conversation

mtpr-ot
Copy link
Collaborator

@mtpr-ot mtpr-ot commented Aug 13, 2019

Added function bt_conn_cb_unregister for unregistering callback from
monitoring the state of a connection.

Signed-off-by: Morten Priess mtpr@oticon.com

Added function bt_conn_cb_unregister for unregistering callback from
monitoring the state of a connection.

Signed-off-by: Morten Priess <mtpr@oticon.com>
{
struct bt_conn_cb *cb, *prev_cb;

for (cb = callback_list, prev_cb = NULL; cb; cb = cb->_next) {
Copy link
Contributor

@Vudentz Vudentz Aug 14, 2019

Choose a reason for hiding this comment

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

Perhaps we should convert to use sys_slist_t instead of keeping the custom list implementation, it hasn't been a problem for now since we didn't have to remove items but now that are doing it maybe it is work changing it.

Copy link
Member

Choose a reason for hiding this comment

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

I was just going to say the same. The struct size will stay the same and there's no need to go implementing linked list manipulation routines ourselves.

Copy link
Contributor

Choose a reason for hiding this comment

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

Adding and removing should also be protected, since these APIs can be called from a preemptible thread, and callbacks can be called from RX thread.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree with your comments. I will check whether I have time for doing this now - in the context of this PR - or if we should create an issue on it.

{
struct bt_conn_cb *cb, *prev_cb;

for (cb = callback_list, prev_cb = NULL; cb; cb = cb->_next) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding and removing should also be protected, since these APIs can be called from a preemptible thread, and callbacks can be called from RX thread.

@mtpr-ot
Copy link
Collaborator Author

mtpr-ot commented Aug 15, 2019

Will not have time to implement suggested changes in the context of this PR. Closing the PR and have created issue #18316

@mtpr-ot mtpr-ot closed this Aug 15, 2019
@mtpr-ot mtpr-ot deleted the host_unreg_cb branch August 15, 2019 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: Bluetooth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants