[WIN32SS:USER] Some minimal work and fixes concerning message queues timeouts.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 29 Dec 2019 14:10:19 +0000 (15:10 +0100)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 29 Dec 2019 15:14:15 +0000 (16:14 +0100)
commita8e7defb015adc5d986f9e60815a1babb1b232ba
tree52f578656a8e17d2b9c39674258ce9dda45706fa
parent0d26bbf4b5c63ff58bd0e229753b6ff185e128cb
[WIN32SS:USER] Some minimal work and fixes concerning message queues timeouts.
CORE-15147

- Rename CLIENTTHREADINFO::tickLastMsgChecked into timeLastRead as
  documented in https://reactos.org/wiki/Techwiki:Win32k/CLIENTTHREADINFO .
  This is the last time the message queue was read.

- This is the structure member one must compare against the current tick
  count timestamp in order to heuristically determine whether a message
  queue thread is hung!! Fix MsqIsHung() in accordance, add extra debug
  logging in order to help us determining which of our code present
  regular GUI hangs, and add as well an extra "TimeOut" parameter so as
  not to hardcode a fixed value within that function but instead
  allowing its caller to specify possible different values.

- THREADINFO::timeLast is on the contrary the last message time stamp,
  and will definitively differ from CLIENTTHREADINFO::timeLastRead .
  It should only be used for information purposes!

- Accordingly, in NtUserGetThreadState()::THREADSTATE_UPTIMELASTREAD
  and in InitThreadCallback(), only (re-)initialize the timeLastRead
  member of the CLIENTTHREADINFO structure of the THREADINFO of interest.

- In co_IntPeekMessage(), update more often the timeLastRead timestamp
  whenever the current message queue has been read (but NOT timeLast!!
  That one will be updated ONLY WHEN a message is found!).

- In co_IntSendMessageTimeoutSingle() first check whether the window to
  which we send the message is being destroyed, before checking for
  queue hangs etc. Collapse the logic checks for queue hang and increase
  the hang timeout check to 4 times MSQ_HUNG (== 4 * 5 seconds) and
  display a debug trace.
12 files changed:
win32ss/include/ntuser.h
win32ss/user/ntuser/ghost.c
win32ss/user/ntuser/main.c
win32ss/user/ntuser/message.c
win32ss/user/ntuser/misc.c
win32ss/user/ntuser/msgqueue.c
win32ss/user/ntuser/msgqueue.h
win32ss/user/ntuser/painting.c
win32ss/user/ntuser/simplecall.c
win32ss/user/ntuser/win32.h
win32ss/user/ntuser/window.c
win32ss/user/user32/windows/message.c