this_thread 名前空間

説明

this_thread 名前空間には、スレッド化に関連するグローバル関数が含まれます。

メンバー

 namepace tbb {
        namespace this_thread {
            thread::id get_id();
            void yield();
            void sleep( const tick_count::interval_t );
        }
    }
     
次の表は、このテンプレート・クラスのメンバーの詳細な情報を提供します。
メンバー 説明
thread::id get_id()

戻り値: 現在のスレッドの ID。

void yield()

別のスレッドが実行できるように現在のスレッドを休止します。

void sleep_for( const tick_count::interval_t & i)

現在のスレッドを少なくとも i 秒間ブロックします。

サンプル

            using namespace tbb;
     
    void Foo() {
        // 30 秒スリープ
        this_thread::sleep_for( tick_count::interval_t(30) );
    }