各位大虾,,如何在线程中调用线程外的函数,有没有这种可能或变通的方法,,多谢多谢
解决方案 »
- 如何实现 delphi sock5 代理设置与更换
- delphi使用 idftp 创建文件夹失败怎么处理
- richedit中文本高亮显示,且可点击的问题
- 简单题,关于SQL查询~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 苦求select语句的写法
- 都来看看某著名网站的网管的职业道德吧!!!斑竹勿删
- 怎样更快的忘记一个人?
- 如何用dephi实现sql的数据表自动导出成dbf数据库?
- 看看啊,好多的自定义函数……
- delphi6的有关数值方面的问题,请教高手!
- Object Pascal 语法的一个问题??
- 我是新手,问一个简单的问题,谢谢
procedure Synchronize(Method: TThreadMethod);DescriptionSynchronize causes the call specified by Method to be executed using the main VCL thread, thereby avoiding multi-thread conflicts. If you are unsure whether a method call is thread-safe, call it from within the main VCL thread by passing it to the Synchronize method.Execution of the thread is suspended while Method is executing in the main VCL thread.Note: You can also protect unsafe methods using critical sections or the multi-read exclusive-write synchronizer.
var
lockxy:TCriticalSection; //lockxy必须是全局变量,以便对所有线程起作用。
... ...LockXY.Acquire; { 获取临界区}
try
Y := sin(X); //调用线程外函数
finally
LockXY.Release; //{交还临界区}
end;
解决办法如楼上所说...