for_developers:thread_safety
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| for_developers:thread_safety [2019/11/01 10:11] – Add link to source code kunz | for_developers:thread_safety [2026/04/12 16:50] (current) – [The solution] ursgraf | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| Concurrency can not be tested by Google Test framework. Therefore, test executables are needed which can be executed manually or via bash scripts. | Concurrency can not be tested by Google Test framework. Therefore, test executables are needed which can be executed manually or via bash scripts. | ||
| - | To provide an example, a test program testing the Gain block is described below. The full source code is available on GitHub at: https:// | + | To provide an example, a test program testing the Gain block is described below. The full source code is available on GitHub at: https:// |
| - | ===== The problem | + | ===== The Problem |
| The following code snipped and image show the issue simulated in the test program. The main thread calls **g1.run()** on the gain object. This method is doing a long calculation. Thread t2 is unfortunately changing the gain by calling **g1.setGain(gM2)** during the main threads calculation. This will finally lead to an unexpected result. | The following code snipped and image show the issue simulated in the test program. The main thread calls **g1.run()** on the gain object. This method is doing a long calculation. Thread t2 is unfortunately changing the gain by calling **g1.setGain(gM2)** during the main threads calculation. This will finally lead to an unexpected result. | ||
| Line 34: | Line 34: | ||
| - | ===== The solution | + | ===== The Solution |
| The Gain block is now implemented thread safe by using the class [[https:// | The Gain block is now implemented thread safe by using the class [[https:// | ||
for_developers/thread_safety.1572599515.txt.gz · Last modified: by kunz
