Skip to content

Avoid EvtSync data being removed#29

Merged
juhhov merged 2 commits intoembedded-community:masterfrom
paivialapeteri:evt-sync-in-ble-adapter
Dec 5, 2025
Merged

Avoid EvtSync data being removed#29
juhhov merged 2 commits intoembedded-community:masterfrom
paivialapeteri:evt-sync-in-ble-adapter

Conversation

@paivialapeteri
Copy link

Update EvtSync in the following ways:

  • use per-event data storage (self.data[evt]) instead of single shared self.data
  • wait() checks if data already arrived before blocking
  • returned data is read into a local variable before clearing the data storage in the event

@paivialapeteri paivialapeteri changed the title Avoid EvtSync data being replaced with NoneType Avoid EvtSync data being replaced with None Dec 2, 2025
@paivialapeteri paivialapeteri changed the title Avoid EvtSync data being replaced with None Avoid EvtSync data being removed Dec 2, 2025
@jupe jupe requested a review from Copilot December 2, 2025 18:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the EvtSync class to prevent race conditions where event data could be overwritten or removed before being consumed. The implementation moves from a single shared self.data variable to per-event data storage using self.data[evt], and adds an optimization to avoid blocking if data has already arrived.

Key changes:

  • Changed from single shared data storage to per-event dictionary-based storage
  • Added early return in wait() if data is already available before blocking
  • Data is now read into a local variable before being cleared to prevent premature removal

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@juhhov
Copy link

juhhov commented Dec 4, 2025

@paivialapeteri has this been tested with HW?

@paivialapeteri
Copy link
Author

paivialapeteri commented Dec 4, 2025

@paivialapeteri has this been tested with HW?

I used these changes as a patch and ran the CI jobs in a PR. There was one failure with PPK2Exception but all the other HW tests passed. Unfortunately I already deleted the PR so I don't have the exact results anymore.

@juhhov juhhov merged commit cd24437 into embedded-community:master Dec 5, 2025
25 checks passed
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.

4 participants