threadとは? わかりやすく解説

Thread クラス

スレッド作成および制御し、そのスレッド優先順位設定およびステータス取得行います

名前空間: System.Threading
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.None)> _
Public NotInheritable Class
 Thread
    Inherits CriticalFinalizerObject
    Implements _Thread
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.None)] 
public sealed class Thread : CriticalFinalizerObject,
 _Thread
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType::None)] 
public ref class Thread sealed : public
 CriticalFinalizerObject, _Thread
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.None) */ 
public final class Thread extends CriticalFinalizerObject
 implements _Thread
ComVisibleAttribute(true) 
ClassInterfaceAttribute(ClassInterfaceType.None) 
public final class Thread extends
 CriticalFinalizerObject implements _Thread
解説解説

プロセスは、そのプロセス関連付けられたプログラム コード一部実行する 1 つ上のスレッド作成できますスレッド実行するプログラム コード指定するには、ThreadStart デリゲートまたは ParameterizedThreadStart デリゲート使用しますParameterizedThreadStart デリゲート使用すると、スレッド プロシージャデータを渡すことができます

スレッドは、存在している間は常に、ThreadState で 1 つ以上定義した状態を保ちますスレッドに対しては、ThreadPriority で定義したスケジューリング優先順位要求できますが、その優先順位オペレーティング システムで有効であるかどうか保証されません。

GetHashCode を使用すると、マネージ スレッド識別子の値を取得できますスレッド有効期間の間は、この値の取得元のアプリケーション ドメインに関係なく、他のスレッドの値と衝突することはありません。

メモメモ

オペレーティング システムの ThreadId は、マネージ スレッドとの固定的な関係を一切持ちません。アンマネージ ホストは、マネージ スレッドとアンマネージ スレッドの関係を制御できるためです。たとえば、高度なホストでは、CLR Hosting API使用して同一オペレーティング システム スレッドに対して複数マネージ スレッドスケジュールしたり、1 つマネージ スレッド複数オペレーティング システム スレッド間で移動させたりすることができます

使用例使用例

単純なスレッド機能を示すコード例次に示します

Imports System
Imports System.Threading

' Simple threading scenario:  Start a Shared method running
' on a second thread.
Public Class ThreadExample
    ' The ThreadProc method is called when the thread starts.
    ' It loops ten times, writing to the console and yielding 
    ' the rest of its time slice each time, and then ends.
    Public Shared Sub ThreadProc()
        Dim i As Integer
        For i = 0 To 9
            Console.WriteLine("ThreadProc: {0}", i)
            ' Yield the rest of the time slice.
            Thread.Sleep(0)
        Next
    End Sub

    Public Shared Sub Main()
        Console.WriteLine("Main thread: Start a second thread.")
        ' The constructor for the Thread class requires a ThreadStart
 
        ' delegate.  The Visual Basic AddressOf operator creates this
        ' delegate for you.
        Dim t As New Thread(AddressOf
 ThreadProc)
        ' Start ThreadProc.  On a uniprocessor, the thread does not
 get 
        ' any processor time until the main thread yields.  Uncomment
 
        ' the Thread.Sleep that follows t.Start() to see the difference.
        t.Start()
        'Thread.Sleep(0)

        Dim i As Integer
        For i = 1 To 4
            Console.WriteLine("Main thread: Do some work.")
            Thread.Sleep(0)
        Next

        Console.WriteLine("Main thread: Call Join(), to wait until
 ThreadProc ends.")
        t.Join()
        Console.WriteLine("Main thread: ThreadProc.Join has returned.
  Press Enter to end program.")
        Console.ReadLine()
    End Sub
End Class
using System;
using System.Threading;

// Simple threading scenario:  Start a static method running
// on a second thread.
public class ThreadExample {
    // The ThreadProc method is called when the thread starts.
    // It loops ten times, writing to the console and yielding 
    // the rest of its time slice each time, and then ends.
    public static void ThreadProc()
 {
        for (int i = 0; i < 10; i++) {
            Console.WriteLine("ThreadProc: {0}", i);
            // Yield the rest of the time slice.
            Thread.Sleep(0);
        }
    }

    public static void Main()
 {
        Console.WriteLine("Main thread: Start a second thread.");
        // The constructor for the Thread class requires a ThreadStart
 
        // delegate that represents the method to be executed on the
 
        // thread.  C# simplifies the creation of this delegate.
        Thread t = new Thread(new ThreadStart(ThreadProc));
        // Start ThreadProc.  On a uniprocessor, the thread does not
 get 
        // any processor time until the main thread yields.  Uncomment
 
        // the Thread.Sleep that follows t.Start() to see the difference.
        t.Start();
        //Thread.Sleep(0);

        for (int i = 0; i < 4; i++) {
            Console.WriteLine("Main thread: Do some work.");
            Thread.Sleep(0);
        }

        Console.WriteLine("Main thread: Call Join(), to wait until ThreadProc
 ends.");
        t.Join();
        Console.WriteLine("Main thread: ThreadProc.Join has returned.  Press
 Enter to end program.");
        Console.ReadLine();
    }
}
// [C++]
// Compile using /clr option.
using namespace System;
using namespace System::Threading;

// Simple threading scenario:  Start a Shared method running
// on a second thread.
public ref class ThreadExample
{
public:

   // The ThreadProc method is called when the thread starts.
   // It loops ten times, writing to the console and yielding 
   // the rest of its time slice each time, and then ends.
   static void ThreadProc()
   {
      for ( int i = 0; i < 10; i++ )
      {
         Console::Write(  "ThreadProc: " );
         Console::WriteLine( i );
         
         // Yield the rest of the time slice.
         Thread::Sleep( 0 );

      }
   }

};

int main()
{
   Console::WriteLine( "Main thread: Start a second thread." );
   
   // Create the thread, passing a ThreadStart delegate that
   // represents the ThreadExample::ThreadProc method.  For a 
   // delegate representing a static method, no object is
   // required.
   Thread^ oThread = gcnew Thread( gcnew ThreadStart( &ThreadExample::ThreadProc
 ) );
   
   // Start the thread.  On a uniprocessor, the thread does not get
 
   // any processor time until the main thread yields.  Uncomment
   // the Thread.Sleep that follows t.Start() to see the difference.
   oThread->Start();
   
   //Thread::Sleep(0);
   for ( int i = 0; i < 4; i++ )
   {
      Console::WriteLine(  "Main thread: Do some work." );
      Thread::Sleep( 0 );

   }
   Console::WriteLine(  "Main thread: Call Join(), to wait until ThreadProc
 ends." );
   oThread->Join();
   Console::WriteLine(  "Main thread: ThreadProc.Join has returned.  Press Enter
 to end program." );
   Console::ReadLine();
   return 0;
}

import System.*;
import System.Threading.*;

// Simple threading scenario:  Start a static method running
// on a second thread.
public class ThreadExample
{
    // The ThreadProc method is called when the thread starts.
    // It loops ten times, writing to the console and yielding 
    // the rest of its time slice each time, and then ends.
    public static void ThreadProc()
 throws InterruptedException
    {
        for (int i = 0; i < 10; i++) {
            Console.WriteLine("ThreadProc: {0}", System.Convert.ToString(i));
            // Yield the rest of the time slice.
            Thread.sleep(0);
        }
    } //ThreadProc

    public static void main(String[]
 args) throws InterruptedException
    {
        Console.WriteLine("Main thread: Start a second thread.");

        // The constructor for the Thread class requires a ThreadStart
 
        // delegate that represents the method to be executed on the
 
        // thread.  J# simplifies the creation of this delegate.
        System.Threading.Thread t =
            new System.Threading.Thread(new
 ThreadStart(ThreadProc));

        // Start ThreadProc.  On a uniprocessor, the thread does not
 get 
        // any processor time until the main thread yields.  Uncomment
 
        // the Thread.Sleep that follows t.Start() to see the difference.
        t.Start();
        //Thread.Sleep(0);

        for (int i = 0; i < 4; i++) {
            Console.WriteLine("Main thread: Do some work.");
            Thread.sleep(0);
        }
        Console.WriteLine("Main thread: Call Join(), to wait until "
            + "ThreadProc ends.");
        t.Join();
        Console.WriteLine("Main thread: ThreadProc.Join has returned."
            + "  Press Enter to end program.");
        Console.ReadLine();
    } //main
} //ThreadExample

このコードによって、次のような出力生成されます。

 [VB, C++, C#]
 Main thread: Start a second thread.
 Main thread: Do some work.
 ThreadProc: 0
 Main thread: Do some work.
 ThreadProc: 1
 Main thread: Do some work.
 ThreadProc: 2
 Main thread: Do some work.
 ThreadProc: 3
 Main thread: Call Join(), to wait until ThreadProc ends.
 ThreadProc: 4
 ThreadProc: 5
 ThreadProc: 6
 ThreadProc: 7
 ThreadProc: 8
 ThreadProc: 9
 Main thread: ThreadProc.Join has returned.  Press Enter to end program.
継承階層継承階層
System.Object
   System.Runtime.ConstrainedExecution.CriticalFinalizerObject
    System.Threading.Thread
スレッド セーフスレッド セーフ

この型は、マルチスレッド操作に対して安全です。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Thread コンストラクタ (ParameterizedThreadStart)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

スレッド開始時にオブジェクトスレッドに渡すことを許可するデリゲート指定して、Thread クラス新しインスタンス初期化します。

名前空間: System.Threading
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    start As ParameterizedThreadStart _
)
Dim start As ParameterizedThreadStart

Dim instance As New Thread(start)
public Thread (
    ParameterizedThreadStart start
)
public:
Thread (
    ParameterizedThreadStart^ start
)
public Thread (
    ParameterizedThreadStart start
)
public function Thread (
    start : ParameterizedThreadStart
)

パラメータ

start

このスレッド実行開始するときに呼び出されるメソッドを表す ParameterizedThreadStart デリゲート

例外例外
例外種類条件

ArgumentNullException

startnull 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

静的メソッドおよびインスタンス メソッドParameterizedThreadStart デリゲート作成および使用するための構文コード例次に示します

Imports System
Imports System.Threading

Public Class Work

    <MTAThread> _
    Shared Sub Main()
        ' To start a thread using a shared thread procedure, use
        ' the class name and method name when you create the 
        ' ParameterizedThreadStart delegate. Visual Basic expands
        ' the AddressOf expression to the appropriate delegate 
        ' creation syntax:
        '    New ParameterizedThreadStart(AddressOf Work.DoWork)
        '
        Dim newThread As New
 Thread(AddressOf Work.DoWork)
        
        ' Use the overload of the Start method that has a
        ' parameter of type Object. You can create an object that
        ' contains several pieces of data, or you can pass any 
        ' object or value type. The following code passes the
        ' integer value 42.
        '
        newThread.Start(42)

        ' To start a thread using an instance method for the thread
 
        ' procedure, use the instance variable and method name when
 
        ' you create the ParameterizedThreadStart delegate. Visual 
        ' Basic expands the AddressOf expression to the appropriate
 
        ' delegate creation syntax:
        '    New ParameterizedThreadStart(AddressOf w.DoMoreWork)
        '
        Dim w As New Work()
        newThread = New Thread(New ParameterizedThreadStart(AddressOf
 w.DoMoreWork))
        'newThread = New Thread(AddressOf w.DoMoreWork)
        
        ' Pass an object containing data for the thread.
        '
        newThread.Start("The answer.")
    End Sub
 
    Public Shared Sub DoWork(ByVal
 data As Object)
        Console.WriteLine("Static thread procedure. Data='{0}'",
 _
            data)
    End Sub

    Public Sub DoMoreWork(ByVal
 data As Object) 
        Console.WriteLine("Instance thread procedure. Data='{0}'",
 _
            data)
    End Sub
End Class

' This code example produces the following output (the order 
'   of the lines might vary):
'
'Static thread procedure. Data='42'
'Instance thread procedure. Data='The answer'
using System;
using System.Threading;

public class Work
{
    public static void Main()
    {
        // To start a thread using a shared thread procedure, use
        // the class name and method name when you create the 
        // ParameterizedThreadStart delegate.
        //
        Thread newThread = new Thread(
            new ParameterizedThreadStart(Work.DoWork));
        
        // Use the overload of the Start method that has a
        // parameter of type Object. You can create an object that
        // contains several pieces of data, or you can pass any 
        // reference type or value type. The following code passes
        // the integer value 42.
        //
        newThread.Start(42);

        // To start a thread using an instance method for the thread
 
        // procedure, use the instance variable and method name when
 
        // you create the ParameterizedThreadStart delegate.
        //
        Work w = new Work();
        newThread = new Thread(
            new ParameterizedThreadStart(w.DoMoreWork));
        
        // Pass an object containing data for the thread.
        //
        newThread.Start("The answer.");
    }
 
    public static void DoWork(object
 data)
    {
        Console.WriteLine("Static thread procedure. Data='{0}'",
            data);
    }

    public void DoMoreWork(object data)
    {
        Console.WriteLine("Instance thread procedure. Data='{0}'",
            data);
    }
}

/* This code example produces the following output (the order 
   of the lines might vary):

Static thread procedure. Data='42'
Instance thread procedure. Data='The answer'
*/
using namespace System;
using namespace System::Threading;

namespace SystemThreadingExample
{
    public ref class Work
    {
    public:
        void StartThreads()
        {
              
            // To start a thread using a shared thread procedure, use
            // the class name and method name when you create the 
            // ParameterizedThreadStart delegate.
            //    AddressOf Work.DoWork)
            //
            Thread^ newThread = gcnew 
                Thread(gcnew ParameterizedThreadStart(Work::DoWork));
              
            // Use the overload of the Start method that has a
            // parameter of type Object. You can create an object that
            // contains several pieces of data, or you can pass any
 
            // reference type or value type. The following code passes
            // the integer value 42.
            newThread->Start(42);
              
            // To start a thread using an instance method for the thread
 
            // procedure, use the instance variable and method name when
 
            // you create the ParameterizedThreadStart delegate.
            Work^ someWork = gcnew Work;
            newThread = 
                gcnew Thread(
                gcnew ParameterizedThreadStart(someWork, 
                &Work::DoMoreWork));
              
            // Pass an object containing data for the thread.
            //
            newThread->Start("The answer.");
        }

        static void DoWork(Object^ data)
        {
            Console::WriteLine("Static thread procedure. Data='{0}'", 
                data);
        }

        void DoMoreWork(Object^ data)
        {
            Console::WriteLine("Instance thread procedure. Data='{0}'",
 
                data);
        }
    };
}

//Entry point of example application
int main()
{
    SystemThreadingExample::Work^ samplework = 
        gcnew SystemThreadingExample::Work();
    samplework->StartThreads();
}

// This code example produces the following output (the order 
//   of the lines might vary):

// Static thread procedure. Data='42'
// Instance thread procedure. Data='The answer'

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Thread コンストラクタ (ThreadStart, Int32)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

Thread クラス新しインスタンス初期化してスレッド最大スタック サイズ指定します

名前空間: System.Threading
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    start As ThreadStart, _
    maxStackSize As Integer _
)
Dim start As ThreadStart
Dim maxStackSize As Integer

Dim instance As New Thread(start,
 maxStackSize)
public Thread (
    ThreadStart start,
    int maxStackSize
)
public:
Thread (
    ThreadStart^ start, 
    int maxStackSize
)
public Thread (
    ThreadStart start, 
    int maxStackSize
)
public function Thread (
    start : ThreadStart, 
    maxStackSize : int
)

パラメータ

start

このスレッド実行開始するときに呼び出されるメソッドを表す ThreadStart デリゲート

maxStackSize

スレッド使用する最大スタック サイズ

例外例外
例外種類条件

ArgumentNullException

startnull 参照 (Visual Basic では Nothing) です。

ArgumentOutOfRangeException

maxStackSize が 128K (131,072) 未満です。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Thread コンストラクタ (ParameterizedThreadStart, Int32)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

Thread クラス新しインスタンス初期化してスレッド開始時にオブジェクトスレッドに渡すことを許可するデリゲートとこのスレッド最大スタック サイズ指定します

名前空間: System.Threading
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    start As ParameterizedThreadStart, _
    maxStackSize As Integer _
)
Dim start As ParameterizedThreadStart
Dim maxStackSize As Integer

Dim instance As New Thread(start,
 maxStackSize)
public Thread (
    ParameterizedThreadStart start,
    int maxStackSize
)
public:
Thread (
    ParameterizedThreadStart^ start, 
    int maxStackSize
)
public Thread (
    ParameterizedThreadStart start, 
    int maxStackSize
)
public function Thread (
    start : ParameterizedThreadStart, 
    maxStackSize : int
)

パラメータ

start

このスレッド実行開始するときに呼び出されるメソッドを表す ParameterizedThreadStart デリゲート

maxStackSize

スレッド使用する最大スタック サイズ

例外例外
例外種類条件

ArgumentNullException

startnull 参照 (Visual Basic では Nothing) です。

ArgumentOutOfRangeException

maxStackSize が 128K (131,072) 未満です。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Thread コンストラクタ


Thread コンストラクタ (ThreadStart)

Thread クラス新しインスタンス初期化します。

名前空間: System.Threading
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    start As ThreadStart _
)
Dim start As ThreadStart

Dim instance As New Thread(start)
public Thread (
    ThreadStart start
)
public:
Thread (
    ThreadStart^ start
)
public Thread (
    ThreadStart start
)
public function Thread (
    start : ThreadStart
)

パラメータ

start

このスレッド実行開始するときに呼び出されるメソッドを表す ThreadStart デリゲート

例外例外
例外種類条件

ArgumentNullException

start パラメータnull 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

静的メソッド実行するスレッド作成する方法次のコード例示します

Imports System
Imports System.Threading

Public Class Test
    <MTAThread> _
    Shared Sub Main()
        Dim newThread As New
 Thread(AddressOf Work.DoWork)
        newThread.Start()
    End Sub
End Class

Public Class Work 

    Private Sub New()
    End Sub

    Shared Sub DoWork()
    End Sub

End Class
using System;
using System.Threading;

class Test
{
    static void Main() 
    {
        Thread newThread = 
            new Thread(new ThreadStart(Work.DoWork));
        newThread.Start();
    }
}

class Work 
{
    Work() {}

    public static void DoWork()
 {}
}
using namespace System;
using namespace System::Threading;
ref class Work
{
private:
   Work(){}


public:
   static void DoWork(){}

};

int main()
{
   Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Work::DoWork ) );
   newThread->Start();
}

import System.*;
import System.Threading.*;
import System.Threading.Thread;

class Test
{
    public static void main(String[]
 args)
    {
        Thread newThread = new Thread(new ThreadStart(Work.DoWork));

        newThread.Start();
    } //main
} //Test

class Work
{
    Work()
    {
    } //Work

    public static void DoWork()
    {
    } //DoWork
} //Work

インスタンス メソッド実行するスレッド作成する方法次のコード例示します

Imports System
Imports System.Threading

Public Class Test
    <MTAThread> _
    Shared Sub Main() 
        Dim threadWork As New
 Work()
        Dim newThread As New
 Thread(AddressOf threadWork.DoWork)
        newThread.Start()
    End Sub
End Class

Public Class Work

    Sub New()
    End Sub

    Sub DoWork() 
    End Sub

End Class
using System;
using System.Threading;

class Test
{
    static void Main() 
    {
        Work threadWork = new Work();
        Thread newThread = 
            new Thread(new ThreadStart(threadWork.DoWork));
        newThread.Start();
    }
}

class Work 
{
    public Work() {}

    public void DoWork() {}
}
using namespace System;
using namespace System::Threading;
ref class Work
{
public:
   Work(){}

   void DoWork(){}

};

int main()
{
   Work^ threadWork = gcnew Work;
   Thread^ newThread = gcnew Thread( gcnew ThreadStart( threadWork, &Work::DoWork
 ) );
   newThread->Start();
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Thread プロパティ


Thread メソッド


パブリック メソッドパブリック メソッド

  名前 説明
パブリック メソッド Abort オーバーロードされます。 このメソッド呼び出され対象スレッドで、そのスレッド終了プロセス開始する ThreadAbortException を発生させます。このメソッド呼び出すと、通常スレッド終了します
パブリック メソッド AllocateDataSlot 無名データ スロットすべてのスレッド割り当てます
パブリック メソッド AllocateNamedDataSlot 前付きのデータ スロットすべてのスレッド割り当てます
パブリック メソッド BeginCriticalRegion スレッド中止または処理されない例外影響によりアプリケーション ドメイン内の他のタスク悪影響を受ける可能性があるコード領域実行が入ることをホスト通知します
パブリック メソッド BeginThreadAffinity マネージ コード現在のオペレーティング システム物理スレッドID依存する命令実行開始することをホスト通知します
パブリック メソッド EndCriticalRegion スレッド中止または処理されない例外影響現在のタスクだけに及ぶコード領域実行が入ることをホスト通知します
パブリック メソッド EndThreadAffinity マネージ コード現在のオペレーティング システム物理スレッドID依存する命令実行完了したことをホスト通知します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド FreeNamedDataSlot プロセス内のすべてのスレッドに関して、名前とスロット関連付け解除します
パブリック メソッド GetApartmentState アパートメント状態を示す ApartmentState 値を返します
パブリック メソッド GetCompressedStack 現在のスレッドスタックキャプチャするために使用できる CompressedStack オブジェクト返します
パブリック メソッド GetData 現在のスレッド現在のドメイン内で指定した現在のスレッドスロットから値を取得します
パブリック メソッド GetDomain 現在のスレッド実行されている現在のドメイン返します
パブリック メソッド GetDomainID 一意アプリケーション ドメイン識別子返します
パブリック メソッド GetHashCode オーバーライドされます現在のスレッドハッシュ コード返します
パブリック メソッド GetNamedDataSlot 前付データ スロット検索します
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド Interrupt WaitSleepJoin スレッド状態のスレッド中断します
パブリック メソッド Join オーバーロードされますスレッド終了するまで、呼び出し元のスレッドブロックします
パブリック メソッド MemoryBarrier メモリ同期します。結果として現在のスレッド実行しているプロセッサで、キャッシュ メモリ内容メイン メモリフラッシュされます
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ResetAbort 現在のスレッドに対して要求されAbortキャンセルします
パブリック メソッド Resume 中断されスレッド再開します
パブリック メソッド SetApartmentState スレッド開始する前にスレッドアパートメント状態を設定します
パブリック メソッド SetCompressedStack キャプチャした CompressedStack現在のスレッド適用します。
パブリック メソッド SetData 現在実行中のスレッド上にある指定されスロット内のデータを、そのスレッド現在のドメイン設定します
パブリック メソッド Sleep オーバーロードされます指定したミリ秒数の間現在のスレッドブロックします
パブリック メソッド SpinWait スレッドiterations パラメータ定義した時間の間待機させます
パブリック メソッド Start オーバーロードされますスレッド実行スケジュールます。
パブリック メソッド Suspend スレッド中断しますスレッドが既に中断されている場合無効です。
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
パブリック メソッド TrySetApartmentState スレッド開始する前にスレッドアパートメント状態を設定します
パブリック メソッド VolatileRead オーバーロードされますフィールドの値を読み取ります。この値は、プロセッサの数やプロセッサ キャッシュの状態にかかわらずコンピュータ内のいずれかプロセッサによって書き込まれ最新の値です。
パブリック メソッド VolatileWrite オーバーロードされます。 値をフィールドにすぐに書き込みます。値はコンピュータ内のすべてのプロセッサに対して可視なります
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Runtime.InteropServices._Thread.GetIDsOfNames 一連の名前を対応する一連のディスパッチ識別子割り当てます
インターフェイスの明示的な実装 System.Runtime.InteropServices._Thread.GetTypeInfo オブジェクト型情報取得しますその後は、インターフェイス型情報取得使用できます
インターフェイスの明示的な実装 System.Runtime.InteropServices._Thread.GetTypeInfoCount オブジェクト提供する型情報インターフェイスの数 (0 または 1) を取得します
インターフェイスの明示的な実装 System.Runtime.InteropServices._Thread.Invoke オブジェクト公開するプロパティおよびメソッドアクセスできるようにします。
参照参照

関連項目

Thread クラス
System.Threading 名前空間

その他の技術情報

スレッドおよびスレッド処理
スレッド使用スレッド処理

Thread メンバ

スレッド作成および制御し、そのスレッド優先順位設定およびステータス取得行います

Thread データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
  名前 説明
パブリック メソッド Abort オーバーロードされます。 このメソッド呼び出され対象スレッドで、そのスレッド終了プロセス開始する ThreadAbortException を発生させます。このメソッド呼び出すと、通常スレッド終了します
パブリック メソッド AllocateDataSlot 無名データ スロットすべてのスレッド割り当てます
パブリック メソッド AllocateNamedDataSlot 前付きのデータ スロットすべてのスレッド割り当てます
パブリック メソッド BeginCriticalRegion スレッド中止または処理されない例外影響によりアプリケーション ドメイン内の他のタスク悪影響を受ける可能性があるコード領域実行が入ることをホスト通知します
パブリック メソッド BeginThreadAffinity マネージ コード現在のオペレーティング システム物理スレッドID依存する命令実行開始することをホスト通知します
パブリック メソッド EndCriticalRegion スレッド中止または処理されない例外影響現在のタスクだけに及ぶコード領域実行が入ることをホスト通知します
パブリック メソッド EndThreadAffinity マネージ コード現在のオペレーティング システム物理スレッドID依存する命令実行完了したことをホスト通知します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド FreeNamedDataSlot プロセス内のすべてのスレッドに関して、名前とスロット関連付け解除します
パブリック メソッド GetApartmentState アパートメント状態を示す ApartmentState 値を返します
パブリック メソッド GetCompressedStack 現在のスレッドスタックキャプチャするために使用できる CompressedStack オブジェクト返します
パブリック メソッド GetData 現在のスレッド現在のドメイン内で指定した現在のスレッドスロットから値を取得します
パブリック メソッド GetDomain 現在のスレッド実行されている現在のドメイン返します
パブリック メソッド GetDomainID 一意アプリケーション ドメイン識別子返します
パブリック メソッド GetHashCode オーバーライドされます現在のスレッドハッシュ コード返します
パブリック メソッド GetNamedDataSlot 前付データ スロット検索します
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド Interrupt WaitSleepJoin スレッド状態のスレッド中断します
パブリック メソッド Join オーバーロードされますスレッド終了するまで、呼び出し元のスレッドブロックします
パブリック メソッド MemoryBarrier メモリ同期します。結果として現在のスレッド実行しているプロセッサで、キャッシュ メモリ内容メイン メモリフラッシュされます
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ResetAbort 現在のスレッドに対して要求されAbortキャンセルします
パブリック メソッド Resume 中断されスレッド再開します
パブリック メソッド SetApartmentState スレッド開始する前にスレッドアパートメント状態を設定します
パブリック メソッド SetCompressedStack キャプチャした CompressedStack現在のスレッド適用します。
パブリック メソッド SetData 現在実行中のスレッド上にある指定されスロット内のデータを、そのスレッド現在のドメイン設定します
パブリック メソッド Sleep オーバーロードされます指定したミリ秒数の間現在のスレッドブロックします
パブリック メソッド SpinWait スレッドiterations パラメータ定義した時間の間待機させます
パブリック メソッド Start オーバーロードされますスレッド実行スケジュールます。
パブリック メソッド Suspend スレッド中断しますスレッドが既に中断されている場合無効です。
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
パブリック メソッド TrySetApartmentState スレッド開始する前にスレッドアパートメント状態を設定します
パブリック メソッド VolatileRead オーバーロードされますフィールドの値を読み取ります。この値は、プロセッサの数やプロセッサ キャッシュの状態にかかわらずコンピュータ内のいずれかプロセッサによって書き込まれ最新の値です。
パブリック メソッド VolatileWrite オーバーロードされます。 値をフィールドにすぐに書き込みます。値はコンピュータ内のすべてのプロセッサに対して可視なります
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Runtime.InteropServices._Thread.GetIDsOfNames 一連の名前を対応する一連のディスパッチ識別子割り当てます
インターフェイスの明示的な実装 System.Runtime.InteropServices._Thread.GetTypeInfo オブジェクト型情報取得しますその後は、インターフェイス型情報取得使用できます
インターフェイスの明示的な実装 System.Runtime.InteropServices._Thread.GetTypeInfoCount オブジェクト提供する型情報インターフェイスの数 (0 または 1) を取得します
インターフェイスの明示的な実装 System.Runtime.InteropServices._Thread.Invoke オブジェクト公開するプロパティおよびメソッドアクセスできるようにします。
参照参照

関連項目

Thread クラス
System.Threading 名前空間

その他の技術情報

スレッドおよびスレッド処理
スレッド使用スレッド処理

_Thread インターフェイス

メモ : このインターフェイスは、.NET Framework version 2.0新しく追加されたものです。

System.Threading.Thread クラスアンマネージ コード公開します

 

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
<ComVisibleAttribute(True)> _
<GuidAttribute("C281C7F1-4AA9-3517-961A-463CFED57E75")>
 _
<CLSCompliantAttribute(False)> _
Public Interface _Thread
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] 
[ComVisibleAttribute(true)] 
[GuidAttribute("C281C7F1-4AA9-3517-961A-463CFED57E75")] 
[CLSCompliantAttribute(false)] 
public interface _Thread
[InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIUnknown)] 
[ComVisibleAttribute(true)] 
[GuidAttribute(L"C281C7F1-4AA9-3517-961A-463CFED57E75")] 
[CLSCompliantAttribute(false)] 
public interface class _Thread
/** @attribute InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) */ 
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute GuidAttribute("C281C7F1-4AA9-3517-961A-463CFED57E75") */
 
/** @attribute CLSCompliantAttribute(false) */ 
public interface _Thread
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) 
ComVisibleAttribute(true) 
GuidAttribute("C281C7F1-4AA9-3517-961A-463CFED57E75") 
CLSCompliantAttribute(false) 
public interface _Thread
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
_Thread メンバ
System.Runtime.InteropServices 名前空間

_Thread メソッド


_Thread メンバ



このページでは「.NET Framework クラス ライブラリ リファレンス」からthreadを検索した結果を表示しています。
Weblioに収録されているすべての辞書からthreadを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からthreadを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「thread」の関連用語

threadのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



threadのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS