Debian Codegraph @

headers/thread

raw
1 /* Copyright (C) 2015 Povilas Kanapickas <[email protected]>
2
3 This file is part of cppreference-doc
4
5 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
6 Unported License. To view a copy of this license, visit
7 http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
8 Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
9
10 Permission is granted to copy, distribute and/or modify this document
11 under the terms of the GNU Free Documentation License, Version 1.3 or
12 any later version published by the Free Software Foundation; with no
13 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
14 */
15
16 #ifndef CPPREFERENCE_THREAD_H
17 #define CPPREFERENCE_THREAD_H
18
19 #if CPPREFERENCE_STDVER>= 2011
20
21 namespace std {
22
23 class thread {
24 public:
25 class id {
26 public:
27 id();
28 };
29
30 typedef void* native_handle_type; // actually impl-defined
31
32 thread();
33 thread(const thread&) = delete;
34 thread(thread&& other);
35 template <class Function, class ...Args>
36 explicit thread(Function&& f, Args&& ... args);
37 ~thread();
38
39 thread& operator=(const thread&) = delete;
40 thread& operator=(thread&& t);
41
42 bool joinable() const;
43 id get_id() const;
44 native_handle_type native_handle();
45 static unsigned hardware_concurrency();
46
47 void join();
48 void detach();
49 void swap(thread& t);
50 };
51
52 bool operator==(thread::id lhs, thread::id rhs);
53 bool operator!=(thread::id lhs, thread::id rhs);
54 bool operator<(thread::id lhs, thread::id rhs);
55 bool operator<=(thread::id lhs, thread::id rhs);
56 bool operator>(thread::id lhs, thread::id rhs);
57 bool operator>=(thread::id lhs, thread::id rhs);
58
59 template<class CharT, class Traits>
60 basic_ostream<CharT, Traits>&
61 operator<<(basic_ostream<CharT, Traits>& out, thread::id id);
62
63 void swap(thread& lhs, thread& rhs);
64
65 namespace this_thread {
66 void yield();
67 std::thread::id get_id();
68 template<class Rep, class Period>
69 void sleep_for(const std::chrono::duration<Rep, Period>& sleep_duration);
70 template<class Clock, class Duration>
71 void sleep_until(const std::chrono::time_point<Clock, Duration>& sleep_time);
72
73 } // namespace this_thread
74
75 } // namespace std
76
77 #endif // CPPREFERENCE_STDVER>= 2011
78
79 #endif // CPPREFERENCE_THREAD_H