summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2022-09-27 09:51:24 +0200
committerDominik Holland <dominik.holland@qt.io>2022-10-11 14:55:23 +0200
commit0e1ce757d530c5e84d4c3ad070fd8ebf47c2e3d2 (patch)
tree8929aee1c1f84fbfef1777aef8047e14ae65900c /src/corelib/kernel
parent35ff45640783aa3a8b9061bb2be08fe7a6612724 (diff)
Add a configure option to exit on poll errors
If an error is returned from qt_safe_poll inside the event dispatcher the error is currently printed and ignored. For most cases this behavior seems to be fine, but when used in critical systems e.g. automotive or medical, a error might indicate a more severe problem and the application should be stopped instead. The system can then decide itself what to do e.g. restarting the application using a watchdog. Change-Id: Iaf5abb20bb3941eaeff19d14e41c395c88fa088d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 94ed8c74ad..af0b0d03d2 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -466,7 +466,11 @@ bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags)
switch (qt_safe_poll(d->pollfds.data(), d->pollfds.size(), tm)) {
case -1:
+#ifdef QT_POLL_EXIT_ON_ERROR
+ qFatal("qt_safe_poll errno: %i error: %ls", errno, qUtf16Printable(qt_error_string()));
+#else
perror("qt_safe_poll");
+#endif
break;
case 0:
break;