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

Move the --pending and cv.notify_all() inside the critical section to prevent the notification from going unobserved #4727

Merged
merged 1 commit into from
Mar 21, 2023

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Mar 20, 2023

Category:

Bug fix (non-breaking change which fixes an issue)

Description:

Previously it could so happen that the order of execution was:

Thread A            Thread B
--pending > 0   
lock(m);
                    --pending == 0
                    cv.notify_all()
cv.wait() <-- hang, ^^^ went unnoticed

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

Tests:

Imgcodec tests

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

…rom being missed.

Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [7647617]: BUILD STARTED

@mzient mzient changed the title Move the --pending inside the critical section to prevent cv.notify_all() from being unobserved Move the --pending and cv.notify_all() inside the critical section to prevent the notification from going unobserved Mar 20, 2023
@stiepan stiepan self-assigned this Mar 20, 2023
@klecki klecki self-assigned this Mar 20, 2023
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [7647617]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [7647617]: BUILD PASSED

@mzient mzient merged commit def392f into NVIDIA:main Mar 21, 2023
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.

6 participants