TinyThread++: tthread::this_thread Namespace Reference

# tthread::this_thread Namespace Reference

The namespace `this_thread` provides methods for dealing with the calling thread. More...

## Functions
thread::id | get_id ()
| Return the thread ID of the calling thread.
void | yield ()
| Yield execution to another thread.
template<class _Rep , class _Period >
void | sleep_for (const chrono::duration< _Rep, _Period > &aTime)
| Blocks the calling thread for a period of time.

## Detailed Description

The namespace `this_thread` provides methods for dealing with the calling thread.

## Function Documentation

void tthread::this_thread::sleep_for | ( | const chrono::duration< _Rep, _Period > & | aTime | ) | `[inline]`

Blocks the calling thread for a period of time.

Parameters:

  `[in]` | aTime | Minimum time to put the thread to sleep. Example usage:
       // Sleep for 100 milliseconds
       this_thread::sleep_for(chrono::milliseconds(100));

Note:
  Supported duration types are: nanoseconds, microseconds, milliseconds, seconds, minutes and hours.

void tthread::this_thread::yield | ( |  | ) | `[inline]`

Yield execution to another thread.

Offers the operating system the opportunity to schedule another thread that is ready to run on the current processor.