[Development] QTimer question
Thiago Macieira
thiago.macieira at intel.com
Wed May 31 02:24:34 CEST 2023
On Tuesday, 30 May 2023 17:10:11 PDT Ilya Fedin wrote:
> On Tue, 30 May 2023 16:55:51 -0700
>
> Thiago Macieira <thiago.macieira at intel.com> wrote:
> > After trying myself, it turns out the problem is not QTimer or the
> >
> > event dispatcher, but the Windows API. The following test:
> > https://codereview.qt-project.org/c/qt/qtbase/+/480705
> >
> > passes on Linux (glib and native), macOS but fails on Windows, all of
> > them Core and Gui.
>
> While talking about Windows timer bugs, want to remind about
> QTBUG-95034 which causes crashes in highly concurrent applications
> since at least 2 years already.
If we choose to use a single timer source per thread and keep changing its
timeout, like we do everywhere else, then it would get fixed.
It might be as simple as replacing that INFINITE in:
emit aboutToBlock();
MsgWaitForMultipleObjectsEx(0, NULL, INFINITE, QS_ALLINPUT,
MWMO_ALERTABLE | MWMO_INPUTAVAILABLE);
emit awake();
with a value obtained from QTimerInfoList::timerWait, then calling
QTimerInfoList::activateTimers().
This should be easier after the work by Ahmad to use <chrono> in
QTimerInfoList lands. QDeadlineTimer is already using
std::chrono::steady_clock on Windows.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230530/91656baf/attachment.bin>
More information about the Development
mailing list