Alexandre Julliard julliard@winehq.org wrote:
I may have one, once I understand what you are trying to fix. What is the actual problem that prompted you to write the tests and the fix?
The problem is described in the first test for sending inter-thread messages: https://www.winehq.org/pipermail/wine-patches/2015-April/138750.html My original guess was that the problem is caused by internal message handling in Wine, and the tests I created confirmed that there is a problem in that area. The patch we are discussing fixes the problem discovered by these tests.
I still don't understand why internal messages would be different. Is that because you get only one inter-thread message instead of several?
The problem is that once Get/PeekMessage handles an internal message it doesn't yield control to another thread and checks the message queue immediately, this misses a sent message from another thread and instead returns a previously posted one. I admit that this is a pure artificial thing that I stumbled upon, but it reveals a real bug in Wine with internal message handling.
I think it would be better to try to write a test that replicates the problem you are seeing.
I tried to simplify the tests since calling EndDialog+GetMessage+DestroyMessage from different threads may create pretty complicated scenarios, and most obvious (to me) things to test are SendMessage+Get/PeekMessage and SetWindowPos+ Get/PeekMessage from different threads are two cases that should cover things that I think may lead to the observed bug(s).
I can sertainly add more tests, but only when already sent ones are accepted to avoid creating conflicts and resending them again.
In particular, testing GetQueueStatus instead of message sequences is not very convincing to me, since it doesn't properly show what's going on.
I tried to test both as much as possible, did I miss some cases where one of GetQueueStatus or a message sequence is not tested?