設定執行緒名稱 SetThreadName

2021-04-20 06:06:54 字數 354 閱讀 4440

以下為微軟的"設定執行緒名稱"**,其利用 windows 平台特有的 0x406d1388 異常設定執行緒名稱,在 windows 平台的 debug 模式下都啟作用(包括 vc環境和windbg),對於其他平台無效。

//// usage: setthreadname (-1, "mainthread");

//typedef struct tagthreadname_info

threadname_info;

void setthreadname( dword dwthreadid, lpcstr szthreadname)

except(exception_continue_execution)

}

取得和設定執行緒的名稱

package getname import j a.util.missingformatargumentexception 寫乙個demo 設定執行緒名稱和獲得當前執行緒的名稱 thread 的方法 string getname 返回該執行緒的名稱。static thread currentthr...

java 2獲取和設定執行緒名稱

string getname 獲取執行緒的名稱。這個方法是放在寫在自定義執行緒類中的,也即是thread的子類 public class mythread extends thread setname string name 方法1 無參構造 set public class mythreaddem...

第六章 多執行緒 設定以及獲取執行緒名稱

設定以及獲取執行緒名稱 1 用thread設定多執行緒中,設定並獲取執行緒名稱 package com.jh.www public class demo1 t.setname 灰太狼 t.start private static void demo start 2 runnable中設定並獲取執行緒...