thread.hpp File Reference

C++11 thread drop in replacement. More...

Detailed Description

C++11 thread drop in replacement.

See also
std::thread, std::this_thread
Raphael Hiesgen <raphael.hiesgen (at)>

Definition in file thread.hpp.

#include "time.h"
#include "thread.h"
#include <array>
#include <tuple>
#include <atomic>
#include <memory>
#include <utility>
#include <exception>
#include <stdexcept>
#include <functional>
#include <type_traits>
#include "riot/mutex.hpp"
#include "riot/chrono.hpp"
#include "riot/condition_variable.hpp"
#include "riot/detail/thread_util.hpp"
+ Include dependency graph for thread.hpp:

Go to the source code of this file.

Data Structures

struct  riot::thread_data
 Holds context data for the thread. More...
struct  riot::thread_data_deleter
 This deleter prevents our thread data from being destroyed if the thread object is destroyed before the thread had a chance to run. More...
class  riot::thread_id
 implementation of thread::id More...
class  riot::thread
 C++11 compliant implementation of thread, however uses the time point from out chrono header instead of the specified one. More...


template<class T , class Traits >
std::basic_ostream< T, Traits > & riot::operator<< (std::basic_ostream< T, Traits > &out, thread_id id)
 Enable printing of thread ids using output streams.
thread_id riot::this_thread::get_id () noexcept
 Access the id of the currently running thread.
void riot::this_thread::yield () noexcept
 Yield the currently running thread.
void riot::this_thread::sleep_for (const std::chrono::nanoseconds &ns)
 Puts the current thread to sleep. More...
template<class Rep , class Period >
void riot::this_thread::sleep_for (const std::chrono::duration< Rep, Period > &sleep_duration)
 Puts the current thread to sleep. More...
void riot::this_thread::sleep_until (const riot::time_point &sleep_time)
 Puts the current thread to sleep. More...
void riot::swap (thread &lhs, thread &rhs) noexcept
 Swaps two threads. More...

Function Documentation

◆ sleep_for() [1/2]

void riot::this_thread::sleep_for ( const std::chrono::nanoseconds &  ns)

Puts the current thread to sleep.

[in]nsDuration to sleep in nanoseconds.

◆ sleep_for() [2/2]

template<class Rep , class Period >
void riot::this_thread::sleep_for ( const std::chrono::duration< Rep, Period > &  sleep_duration)

Puts the current thread to sleep.

[in]sleep_durationThe duration to sleep.

Definition at line 183 of file thread.hpp.

◆ sleep_until()

void riot::this_thread::sleep_until ( const riot::time_point sleep_time)

Puts the current thread to sleep.

[in]sleep_timeA point in time that specifies when the thread should wake up.

Definition at line 204 of file thread.hpp.

◆ swap()

void riot::swap ( thread lhs,
thread rhs 

Swaps two threads.

[in,out]lhsReference to one thread.
[in,out]rhsReference to the other thread.

Definition at line 379 of file thread.hpp.