[Lazarus] Help: Multithreading
Clinton Shane Wright
clintonabco at gmail.com
Wed Aug 15 17:20:36 CEST 2012
Hi everyone,
I hope that someone can help me understand a little bit better on how to
work with threads in Lazarus. I am still learning so please forgive my
ignorance in any matter here. I am using the multithreading.lpi example
supplied with lazarus and I create a type TMyThread of class TThread and I
have the Execute and other procedures made for the TMyThread thread. I have
got the thread running well, but now I dont understand how to make another
instance of the same thread and how write my code to identify which
instance is running so that I can assign different tasks to each thread
individually.
On Form Create Procedure I have (as in the mulithreading example), MyThread
:= TMyThread.Create(False); This creates and instance of the type
TMyThread. I got that. I got that working. Now with the same procedures if
I go ahead and create another instance in the On Form Create Procedure,
MyThread2 := TMyThread.Create(False); How do I use this second instance to
do different work in the same procedures. I hope that whoever reads this
can get what I am saying. I will post a link to the code below and I hope
that someone can advise me. Any help is much appreciated.
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.
http://www.heypasteit.com/clip/0FVU
Please I am desperate to know how to use this correctly.
Thank you kindly.
Clinton Wright
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120815/65479182/attachment-0002.html>
More information about the Lazarus
mailing list