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

Make WaitForMultipleEvents atomic when waitAll is true #20

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Nov 17, 2022

  1. Add failing test for atomicity of WaitForMultipleEvents w/ waitAll

    Test contributed by @qwertymaster617, see [0] for associated issue.
    
    [0]: #9
    mqudsi committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    511b79d View commit details
    Browse the repository at this point in the history
  2. Make WaitForMultipleEvents atomic when waitAll is true

    This patch significantly changes the behavior (and to an extent, the
    performance) of pevents to more closely mimic the documented behavior of
    `WaitForMultipleObjects` and `WaitForMultipleObjectsEx`.
    
    As reported in #9, the previous behavior did not make any atomicity
    guarantees when a call to `WaitForMultipleEvents()` was made with
    `waitAll = true`, and WFME would attempt to serially obtain the events
    in question, which could lead to a deadlock in case of circular locking
    and auto-reset events.
    
    The WFMO behavior documented on MSDN makes it clear that the Windows
    implementation does not modify the signalled state of any of the manual
    or auto reset events being awaited until the WFMO call is ready to
    return, at which point either the one event in question or all the
    events being awaited (dependent on `waitAll`) are atomically awaited.
    mqudsi committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    2eadf10 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1a0d930 View commit details
    Browse the repository at this point in the history
  4. Remove technically incorrect assertion

    If the initial number of events was zero and waitAll was set, this
    assertion would fail incorrectly.
    mqudsi committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    016cece View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4476e8f View commit details
    Browse the repository at this point in the history
  6. Remove unused header include

    mqudsi committed Nov 17, 2022
    Configuration menu
    Copy the full SHA
    bc97237 View commit details
    Browse the repository at this point in the history