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

Fix race condition in set_and_wait_for_value #457

Merged
merged 6 commits into from
Jul 29, 2024

Conversation

DominicOram
Copy link
Contributor

Fixes #453

  • Fixes the original race condition as discussed
  • Adds a new set_and_wait_for_other_value for monitoring a different value than setting

…lue than you set and fix potential race condition
@DominicOram DominicOram marked this pull request as draft July 16, 2024 12:08
Copy link
Collaborator

@coretl coretl left a comment

Choose a reason for hiding this comment

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

I spend half an hour playing with typing, and I now see why you made it two functions. I think this is a pretty teachable API, so happy with the signature. Spotted a further possible race condition (which would only manifest with a heavily loaded IOC and network congestion), which we might want to consider...

src/ophyd_async/core/signal.py Outdated Show resolved Hide resolved
tests/core/test_signal.py Outdated Show resolved Hide resolved
@DominicOram DominicOram marked this pull request as ready for review July 17, 2024 14:53
@DominicOram DominicOram requested a review from coretl July 17, 2024 14:56
Copy link
Collaborator

@coretl coretl left a comment

Choose a reason for hiding this comment

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

Sorry, just thought of another edge case! Could either merge as is and make a new issue to handle, or fix it here...

src/ophyd_async/core/signal.py Outdated Show resolved Hide resolved
@DominicOram DominicOram merged commit ff87963 into main Jul 29, 2024
18 checks passed
@DominicOram DominicOram deleted the 453_wait_for_value_take_generator branch July 29, 2024 17:28
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.

Allow wait_for_value to take existing generator
2 participants