zoukankan      html  css  js  c++  java
  • Delphi 判断线程TThread是否释放

    Delphi 判断线程TThread是否释放

    //返回值:0-已释放;1-正在运行;2-已终止但未释放;
    //3-未建立或不存在
    function CheckThreadFreed(aThread: TThread): Byte;
    var
       i: DWord;
       IsQuit: Boolean;
    begin
       if Assigned(aThread) then
       begin
          IsQuit := GetExitCodeThread(aThread.Handle, i);
          if IsQuit then //如果成功,返回非0值,否则返回值 0
          begin
             if i = STILL_ACTIVE then //如果指定的线程尚未终止,返回的终止状态仍为“活动”。
                Result := 1
             else
                Result := 2; //aThread未Free,因为Tthread.Destroy中有执行语句
          end
          else
             Result := 0; //可以用GetLastError取得错误代码
       end
       else
          Result := 3;
    end;
    

      

    创建时间:2020.07.29  更新时间:

  • 相关阅读:
    表格边框
    vue路由守卫
    移动端专用css
    原生js写的的浏览器历史记录
    有趣
    表格边框
    路由
    php安装
    curl
    case when
  • 原文地址:https://www.cnblogs.com/guorongtao/p/13397462.html
Copyright © 2011-2022 走看看