this_thread Namespace



This feature is deprecated and will be removed in the future.

Namespace this_thread contains global functions related to threading.


 namespace std {
     namespace this_thread {
         thread::id get_id();
         void yield();
         void sleep( const tbb::tick_count::interval_t& );
The following table provides additional information on the functions in this namespace.
Member Description
thread::id get_id()

Returns: Id of the current thread.

void yield()

Offers to suspend current thread so that another thread may run.

void sleep_for( const tick_count::interval_t & i)

Current thread blocks for at least time interval i.


    void Foo() {
        // Sleep 30 seconds
        std::this_thread::sleep_for( tbb::tick_count::interval_t(30) );
For more complete information about compiler optimizations, see our Optimization Notice.