30 Thread support library [thread]

30.3 Threads [thread.threads]

30.3.2 Namespace this_thread [thread.thread.this]

namespace std {
  namespace this_thread {
    thread::id get_id() noexcept;

    void yield() noexcept;
    template <class Clock, class Duration>
      void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
    template <class Rep, class Period>
      void sleep_for(const chrono::duration<Rep, Period>& rel_time);
  }
}

thread::id this_thread::get_id() noexcept;

Returns: An object of type thread::id that uniquely identifies the current thread of execution. No other thread of execution shall have this id and this thread of execution shall always have this id. The object returned shall not compare equal to a default constructed thread::id.

void this_thread::yield() noexcept;

Effects: Offers the implementation the opportunity to reschedule.

Synchronization: None.

template <class Clock, class Duration> void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);

Effects: Blocks the calling thread for the absolute timeout ([thread.req.timing]) specified by abs_time.

Synchronization: None.

Throws: Nothing if Clock satisfies the TrivialClock requirements ([time.clock.req]) and operations of Duration do not throw exceptions. [ Note: instantiations of time point types and clocks supplied by the implementation as specified in [time.clock] do not throw exceptions.  — end note ]

template <class Rep, class Period> void sleep_for(const chrono::duration<Rep, Period>& rel_time);

Effects: Blocks the calling thread for the relative timeout ([thread.req.timing]) specified by rel_time.

Synchronization: None.

Throws: Nothing if operations of chrono::duration<Rep, Period> do not throw exceptions. [ Note: instantiations of duration types supplied by the implementation as specified in [time.clock] do not throw exceptions.  — end note ]