dinput/tests: Wait for the expected report to actually be pending.
commit606dc246ff0e6ac710288e4d9dc2fcf55568b1af
authorRémi Bernon <rbernon@codeweavers.com>
Fri, 6 May 2022 13:10:03 +0000 (6 15:10 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 11 May 2022 09:40:35 +0000 (11 11:40 +0200)
treef98426a00f0585aa814c41d7bd2a3f2e2f5bdc2a
parentb7fa00be65363132f1fd8686bfa0a81b394c0dba
dinput/tests: Wait for the expected report to actually be pending.

There is a race otherwise where we try to complete a pending IRP but
because the async is writing the report from another thread we didn't
find it and instead ignored it.

Instead we need to atomically check if there was a pending IRP, and if
the queue is empty, or queue the wait.

Later, when a report is going to be marked as pending, and if there's
someone waiting for it already, we instead complete it immediately.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/dinput/tests/dinput_test.h
dlls/dinput/tests/driver_bus.c
dlls/dinput/tests/driver_hid.h
dlls/dinput/tests/force_feedback.c
dlls/dinput/tests/hid.c