qt6-bb10/examples/corelib/threads
Giuseppe D'Angelo 3a449bbb69 Wait conditions example: code tidies
In no particular order:

* Clean up #includes.

* Document what is protected by the mutex.

* Use explicit, nullptr.

* Use lock managers, not manual calls to lock/unlock.

* Unlock the mutex before notifying the condition variables.

* Condition variables are always meant to be used in a while loop, and
  never with a plain if, because of spurious wakeups.

* Don't lock a mutex just to protect a plain integer. We have atomics
  for that use case.

* Remove an unneeded signal, therefore also the need of using
  Q_OBJECT and the inclusion of the moc-generated file.

Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-108860
Change-Id: I2afc77955b95de8aa5fb88048cd9feb217f83b4f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-06 06:30:55 +01:00
..
doc Wait conditions example: code tidies 2022-12-06 06:30:55 +01:00
mandelbrot Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
queuedcustomtype Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
semaphores Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
waitconditions Wait conditions example: code tidies 2022-12-06 06:30:55 +01:00
CMakeLists.txt Examples: Use Qt6:: to qualify Qt CMake packages 2022-11-17 19:59:11 +01:00
README
threads.pro

README

This folder contains examples for the use of the threading-related classes
in Qt Core. For examples using the higher-level Qt Concurrent module,
check out the "qtconcurrent" folder instead.

Documentation for examples can be found via the Examples and Tutorials link
in the main Qt documentation. The examples and their documentation can also
be opened from the Examples tab of Qt Creator's Welcome mode.