#include <pthread.h>
#include <signal.h>
#include <sched.h>
#include <unistd.h>
#include <ostream>
Go to the source code of this file.
Classes | |
class | mutex |
Mutex class. More... | |
class | recursive_mutex |
Recursive mutex class. More... | |
class | lock_guard< T > |
Lock guard class. More... | |
class | condition_variable |
Condition variable class. More... | |
class | thread |
Thread class. More... | |
class | id |
Thread ID. More... | |
class | ratio< N, D > |
Minimal implementation of the ratio class. More... | |
class | duration< _Rep, _Period > |
Duration template class. More... | |
Namespaces | |
namespace | tthread |
Main name space for TinyThread++. | |
namespace | tthread::chrono |
Minimal implementation of the | |
namespace | tthread::this_thread |
The namespace | |
Defines | |
#define | TINYTHREAD_VERSION_MAJOR 1 |
TinyThread++ version (major number). | |
#define | TINYTHREAD_VERSION_MINOR 0 |
TinyThread++ version (minor number). | |
#define | TINYTHREAD_VERSION (TINYTHREAD_VERSION_MAJOR * 100 + TINYTHREAD_VERSION_MINOR) |
TinyThread++ version (full version). | |
#define | thread_local |
Thread local storage keyword. | |
Typedefs | |
typedef duration< __intmax_t, ratio< 1, 1000000000 > > | nanoseconds |
Duration with the unit nanoseconds. | |
typedef duration< __intmax_t, ratio< 1, 1000000 > > | microseconds |
Duration with the unit microseconds. | |
typedef duration< __intmax_t, ratio< 1, 1000 > > | milliseconds |
Duration with the unit milliseconds. | |
typedef duration< __intmax_t > | seconds |
Duration with the unit seconds. | |
typedef duration< __intmax_t, ratio< 60 > > | minutes |
Duration with the unit minutes. | |
typedef duration< __intmax_t, ratio< 3600 > > | hours |
Duration with the unit hours. | |
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. |
#define thread_local |
Thread local storage keyword.
A variable that is declared with the thread_local
keyword makes the value of the variable local to each thread (known as thread-local storage, or TLS). Example usage:
// This variable is local to each thread. thread_local int variable;
thread_local
keyword is a macro that maps to the corresponding compiler directive (e.g. __declspec(thread)
). While the C++0x standard allows for non-trivial types (e.g. classes with constructors and destructors) to be declared with the thread_local
keyword, most pre-C++0x compilers only allow for trivial types (e.g. int
). So, to guarantee portable code, only use trivial types for thread local storage.