Cleanup: Use QThread::msleep to sleep instead of select

The old code used select with all-zero parameters and a timeval struct
configured to wait for 50ms. This can be drastically simplified by just
calling QThread::msleep which makes the intention much more clear.

Change-Id: I115b56ae67ae2c2cd03354e16a7bfdf56f8c15b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
bb10
Milian Wolff 2017-12-18 16:48:19 +01:00
parent 152033bec0
commit e2c10e99db
1 changed files with 1 additions and 4 deletions

View File

@ -899,10 +899,7 @@ xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t win, int
connection()->flush();
// sleep 50 ms, so we don't use up CPU cycles all the time.
struct timeval usleep_tv;
usleep_tv.tv_sec = 0;
usleep_tv.tv_usec = 50000;
select(0, 0, 0, 0, &usleep_tv);
QThread::msleep(50);
} while (timer.elapsed() < timeout);
return 0;