Michael Schnell wrote:

If I may add, I am using the thread to read data from a modem from the RS232, but now I have more than one modem connected to the system that I need to read from at once and having it run in one thread gets slower as I add one modem extra to the thread, I want to use the second instance, TMyThread2 to control the modem 2.

The main problem will be to do the communication between the multiple threads and the main thread.

Here IMHO a good idea is to do the basic receive-protocol in a thread (that most of the time will be blocked waiting for input from the serial interface), and to the more complex stuff (that needs data from and sends data to multiple serial interfaces) in the main thread.

Although it's difficult to make definite points without knowing how the code is interfacing to the port. For example, if it's in a tight loop polling for input then of course things will slow down.

Something like Synaser is a good starting point. Or if you have to use the standard serial.pp at least get the modified version from http://mantis.freepascal.org/view.php?id=18946 which fixes a couple of badly-implemented functions (and adds Windows support).

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to