On Tue, 27 Oct 2020 21:25:55 +0000, Graeme Geldenhuys via lazarus <lazarus@lists.lazarus-ide.org> wrote:
>In the long term I would highly suggest converting that code / tasks >to multiple theads. From what you described, they sound like good >candidates for a thread based system. Yes, I agree, but... The code is pretty big and very hard to follow these many years since it was created... I wanted to get it running first with as small changes as possible and I thought I had that nailed until I started an actual execution on the hardware and found that I could set it up properly and start it but then nothing more is happening. So there are probably other places where events are important, I guess, and I have to track down these as well... I am now thinking of creating some kind of general purpose thread object in order to track progress on the hardware but without doing much else, because the timer event was there in order to detatch the task execution from the body of the program so that it could run other things meanwhile. Some tasks take hours to execute... But initializing a run takes only some seconds so that could remain in mainline code if only the progress monitoring is handled in the thread. Of course I have to communicate the state of affairs to mainline from the thread... Could be done by changing boolean variable states (I assume a boolean which is just a single bit should be inherently thread-safe). Or else having an event in the thread to message into the mainline code using Synchronize(). -- Bo Berglund Developer in Sweden -- _______________________________________________ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus