zoukankan      html  css  js  c++  java
  • delphi判断线程状态函数(使用GetExitCodeThread API函数去判断线程的句柄)

    //判断线程是否释放
    //返回值: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 //If the function succeeds, the return value is nonzero.
                                     //If the function fails, the return value is zero.
          begin
             if i = STILL_ACTIVE then //If the specified thread has not terminated,
                                     //the termination status returned is STILL_ACTIVE.
                Result := 1
             else
                Result := 2; //aThread未Free,因为Tthread.Destroy中有执行语句
          end
          else
             Result := 0; //可以用GetLastError取得错误代码
       end
       else
          Result := 3;
    end;

    http://www.cnblogs.com/azhqiang/p/3955490.html

  • 相关阅读:
    合并本地多次commit为一个commit
    git 取消文件跟踪
    遍历进程 遍历窗口
    linux查看程序运行参数
    ubuntu下载地址
    将博客搬至CSDN
    extern"C"的使用
    ESP32-NVS存储(非易失性存储库)
    ESP32-EEPROM存储
    c语言简单数据类型
  • 原文地址:https://www.cnblogs.com/findumars/p/7147699.html
Copyright © 2011-2022 走看看