Avoid EvtSync data being removed#29
Conversation
There was a problem hiding this comment.
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.
|
@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. |
Update EvtSync in the following ways: