Recent

Author Topic: Multi-Threading???  (Read 4554 times)

talkia

  • Newbie
  • Posts: 3
Multi-Threading???
« on: September 09, 2011, 01:14:43 pm »
I want to ask, in Lazarus, how can I make a multi-threading???

That's mean I want the program to control more than 1 job in the same time.

For example, the program can still sense the change of a TEdit, and in the same time, I can execute a procedure with looping.

fabienwang

  • Sr. Member
  • ****
  • Posts: 449
  • Lazarus is the best
    • My blog
Re: Multi-Threading???
« Reply #1 on: September 09, 2011, 01:31:06 pm »
You have to extend a class of TThread, then implement the Execute function.
It's not very complex, unless you want to use a lot of datas from your Form1.

Please have a look at your Lazarus Folder, then go in examples\multithreading\ folder.
You'll find what you need.
I'm using Arch Linux.
Known for: CPickSniff, OpenGrabby
Contributed to: LazPaint

Zoran

  • Hero Member
  • *****
  • Posts: 1948
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Multi-Threading???
« Reply #2 on: September 09, 2011, 02:57:25 pm »
In Lazarus wiki there is an article about using threads: http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

talkia

  • Newbie
  • Posts: 3
Re: Multi-Threading???
« Reply #3 on: September 15, 2011, 12:25:12 pm »
Seems that it is not work in my program. Anyway, Thx a lot

Laksen

  • Hero Member
  • *****
  • Posts: 794
    • J-Software
Re: Multi-Threading???
« Reply #4 on: September 15, 2011, 02:15:35 pm »
If you're on Linux remember to have cthreads as the first unit in the program's uses section

Leledumbo

  • Hero Member
  • *****
  • Posts: 8799
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Multi-Threading???
« Reply #5 on: September 15, 2011, 07:19:08 pm »
and please use the forum's search function before asking

 

TinyPortal © 2005-2018