如何销毁一个线程对象 ?

graycarl 2001-10-13 02:01:38
也就是把一个Tthread对象freeandnil
问题是调用是总出来个非法操作 怪哉怪哉
...全文
210 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
graycarl 2001-10-17
  • 打赏
  • 举报
回复
找到出错语句了
大家平分吧
gototop99 2001-10-15
  • 打赏
  • 举报
回复
是的哦
dycdyc123 2001-10-15
  • 打赏
  • 举报
回复
Yes

I also have ....EAccessViolation
yk1028 2001-10-13
  • 打赏
  • 举报
回复
FreeOnterminate:=true写在Execute事件中
machin 2001-10-13
  • 打赏
  • 举报
回复

用terminate吧。。。
Old_Cow 2001-10-13
  • 打赏
  • 举报
回复
用ExitThread,希望下面的帮助对你有帮助

Unit
Windows.Pas

Syntax
ExitThread(
dwExitCode: DWORD {exit code for the thread}
); {this procedure does not return a value}

Description
This procedure will end a thread and clean up any associated DLLs. If this is the last thread of the process, the process will also end. Any threads that have been waiting for the thread in question to terminate will be released, and the thread in question will become signaled.


A successful call to this procedure causes the following:
1. All object handles opened by the thread are closed.
2. All threads in the started by the thread terminate.
3. The state of the thread becomes signaled, satisfying any threads that have been waiting for the thread.
4. The states of all threads within the thread become signaled, satisfying any threads that have been waiting for the threads.
5. The termination status is changed from STILL_ACTIVE to the exit code specified by the uExitCode parameter.

Parameters
dwExitCode: Specifies the exit code for the process, and for all threads that are terminated as a result of this call. Use the GetExitCodeThread function to retrieve this value.

szchengyu 2001-10-13
  • 打赏
  • 举报
回复
gz
graycarl 2001-10-13
  • 打赏
  • 举报
回复
主线程中调用了线程的waitfor
也就是线程已经结束了
graycarl 2001-10-13
  • 打赏
  • 举报
回复
都不行
线程终止以后关闭程序时出现runtime error 216 EAccessViolation

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧