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 [2024/06/11 09:15] – [Thread Safety] ursgraf | for_developers:thread_safety [2026/04/12 16:50] (current) – [The solution] ursgraf | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| 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.1718090115.txt.gz · Last modified: by ursgraf
