VxWorks, at least as used in the 6.8 CI, has a problem with move-only lambdas passed to QThread::create(). This might have been the reason for the resurrection of the cxx11_future feature in 408430a543ef605157963b1a894847c7ba9f9956. This patch tries to work around the issue by not moving the promise into the lambda capture, but caputuring it by reference, and then moving it into a local stack variable. In all cases, the ThreadWrapper is created after the promise, so, since the ThreadWrapper dtor join()s (like jthread), the promise out-lives the thread, and the destruction of the promise happens-after the join() with the thread. So, no data races. Code mustn't touch the promise object from the main thread once the ThreadWrapper has started, but that's the case already and the test functions are small enough for any such future use to be obvious in review. Amends 385f0732d927f0eba8ecf990ee9bc19936475edd and 4e1b20893aeeb9580bc6b52ac4baea297675bfee. It appears that dev no longer has the problem¹, but apply this to dev, too, to maintain consistency with the test in last three LTS releases. ¹ 4e1b20893aeeb9580bc6b52ac4baea297675bfee passed, but its cherry-pick to 6.8 did not Pick-to: 6.5 6.2 Change-Id: If1feba9d3a7f8677789d45fa9f4990cf44145709 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 4d6cf54664a98e01d4caab42431c62d6deb9f86e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%