次の方法で共有


方法 : マネージ コードのスレッド名を設定する

スレッド名の設定は、Visual Studio のどのエディションでも実行できます。 スレッド名を設定すると、[スレッド] ウィンドウでスレッドを追跡する際に役立ちます。 Visual Studio Express Edition では [スレッド] ウィンドウを使用できないため、このエディションではスレッド名を設定してもほとんど役に立ちません。

マネージ コードのスレッド名を設定するには、Name プロパティを使用します。

使用例

Public Class Needle
    ' This method will be called when the thread is started.
    Sub Baz()
        Console.WriteLine("Needle Baz is running on another thread")
    End Sub
End Class

Sub Main()
    Console.WriteLine("Thread Simple Sample")
    Dim oNeedle As New Needle()
   ' Create a Thread object. 
    Dim oThread As New System.Threading.Thread(AddressOf oNeedle.Baz)
    ' Set the Thread name to "MainThread".
    oThread.Name = "MainThread"
    ' Starting the thread invokes the ThreadStart delegate
    oThread.Start()
End Sub

参照

処理手順

方法 : ネイティブ コードのスレッド名を設定する

その他の技術情報

マルチスレッド アプリケーションのデバッグ