Multithreaded Application Tutorial/zh CN

From Lazarus wiki
Revision as of 16:25, 19 September 2012 by Pengtu (talk | contribs) (开头)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

多线程应用的教程

(本页面目前不是 Multithreaded Application Tutorial的翻译,是我自己写的。User:Pengtu)

有个线程类 TThread,用来创建额外线程,并听命于默认主线程。

1.0自带4个例子,位于 \Lazarus\examples\multithreading\

for Windows

TThread是个虚类,要实例化,尤其是执行方法要实例化。


for Linux

需要引用一两个单元

uses
{$ifdef unix}
  cthreads,
  cmem, // the c memory manager is on some systems much faster for multi-threading
{$endif}
  Interfaces, // this includes the LCL widgetset
  Forms

TThread类的使用方法同Windows。