authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-20 19:36:26-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-20 19:36:26-04:00
log8bb6bf681813893c74d0d67c8862a2fc25ee3124
treecccc0ad14351eddaba0519ff38aaec4bc803b187
parent37a06f4dcf27c6bb5759656d6abc0d8b290f093f
signature Commit is signed but in an unrecognized format.

update libcxx to 9.0.0-rc2

upstream commit 67a4a12d61bfb10b2410b53c5a43ef9b4a03de7d

3 files changed, 89 insertions(+), 72 deletions(-)

lib/libcxx/include/__threading_support+81
......@@ -12,6 +12,7 @@
1212
1313#include <__config>
1414#include <chrono>
15#include <iosfwd>
1516#include <errno.h>
1617
1718#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
......@@ -394,6 +395,86 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
394395
395396#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
396397
398class _LIBCPP_TYPE_VIS thread;
399class _LIBCPP_TYPE_VIS __thread_id;
400
401namespace this_thread
402{
403
404_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
405
406} // this_thread
407
408template<> struct hash<__thread_id>;
409
410class _LIBCPP_TEMPLATE_VIS __thread_id
411{
412 // FIXME: pthread_t is a pointer on Darwin but a long on Linux.
413 // NULL is the no-thread value on Darwin. Someone needs to check
414 // on other platforms. We assume 0 works everywhere for now.
415 __libcpp_thread_id __id_;
416
417public:
418 _LIBCPP_INLINE_VISIBILITY
419 __thread_id() _NOEXCEPT : __id_(0) {}
420
421 friend _LIBCPP_INLINE_VISIBILITY
422 bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT
423 { // don't pass id==0 to underlying routines
424 if (__x.__id_ == 0) return __y.__id_ == 0;
425 if (__y.__id_ == 0) return false;
426 return __libcpp_thread_id_equal(__x.__id_, __y.__id_);
427 }
428 friend _LIBCPP_INLINE_VISIBILITY
429 bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT
430 {return !(__x == __y);}
431 friend _LIBCPP_INLINE_VISIBILITY
432 bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT
433 { // id==0 is always less than any other thread_id
434 if (__x.__id_ == 0) return __y.__id_ != 0;
435 if (__y.__id_ == 0) return false;
436 return __libcpp_thread_id_less(__x.__id_, __y.__id_);
437 }
438 friend _LIBCPP_INLINE_VISIBILITY
439 bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT
440 {return !(__y < __x);}
441 friend _LIBCPP_INLINE_VISIBILITY
442 bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT
443 {return __y < __x ;}
444 friend _LIBCPP_INLINE_VISIBILITY
445 bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT
446 {return !(__x < __y);}
447
448 _LIBCPP_INLINE_VISIBILITY
449 void __reset() { __id_ = 0; }
450
451 template<class _CharT, class _Traits>
452 friend
453 _LIBCPP_INLINE_VISIBILITY
454 basic_ostream<_CharT, _Traits>&
455 operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id);
456
457private:
458 _LIBCPP_INLINE_VISIBILITY
459 __thread_id(__libcpp_thread_id __id) : __id_(__id) {}
460
461 friend __thread_id this_thread::get_id() _NOEXCEPT;
462 friend class _LIBCPP_TYPE_VIS thread;
463 friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>;
464};
465
466namespace this_thread
467{
468
469inline _LIBCPP_INLINE_VISIBILITY
470__thread_id
471get_id() _NOEXCEPT
472{
473 return __libcpp_thread_get_current_id();
474}
475
476} // this_thread
477
397478_LIBCPP_END_NAMESPACE_STD
398479
399480_LIBCPP_POP_MACROS
lib/libcxx/include/mutex+3-3
......@@ -280,7 +280,7 @@ class _LIBCPP_TYPE_VIS recursive_timed_mutex
280280 mutex __m_;
281281 condition_variable __cv_;
282282 size_t __count_;
283 __libcpp_thread_id __id_;
283 __thread_id __id_;
284284public:
285285 recursive_timed_mutex();
286286 ~recursive_timed_mutex();
......@@ -307,9 +307,9 @@ bool
307307recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
308308{
309309 using namespace chrono;
310 __libcpp_thread_id __id = __libcpp_thread_get_current_id();
310 __thread_id __id = this_thread::get_id();
311311 unique_lock<mutex> lk(__m_);
312 if (__libcpp_thread_id_equal(__id, __id_))
312 if (__id == __id_)
313313 {
314314 if (__count_ == numeric_limits<size_t>::max())
315315 return false;
lib/libcxx/include/thread+5-69
......@@ -200,64 +200,6 @@ __thread_specific_ptr<_Tp>::set_pointer(pointer __p)
200200 __libcpp_tls_set(__key_, __p);
201201}
202202
203class _LIBCPP_TYPE_VIS thread;
204class _LIBCPP_TYPE_VIS __thread_id;
205
206namespace this_thread
207{
208
209_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
210
211} // this_thread
212
213template<> struct hash<__thread_id>;
214
215class _LIBCPP_TEMPLATE_VIS __thread_id
216{
217 // FIXME: pthread_t is a pointer on Darwin but a long on Linux.
218 // NULL is the no-thread value on Darwin. Someone needs to check
219 // on other platforms. We assume 0 works everywhere for now.
220 __libcpp_thread_id __id_;
221
222public:
223 _LIBCPP_INLINE_VISIBILITY
224 __thread_id() _NOEXCEPT : __id_(0) {}
225
226 friend _LIBCPP_INLINE_VISIBILITY
227 bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT
228 {return __libcpp_thread_id_equal(__x.__id_, __y.__id_);}
229 friend _LIBCPP_INLINE_VISIBILITY
230 bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT
231 {return !(__x == __y);}
232 friend _LIBCPP_INLINE_VISIBILITY
233 bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT
234 {return __libcpp_thread_id_less(__x.__id_, __y.__id_);}
235 friend _LIBCPP_INLINE_VISIBILITY
236 bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT
237 {return !(__y < __x);}
238 friend _LIBCPP_INLINE_VISIBILITY
239 bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT
240 {return __y < __x ;}
241 friend _LIBCPP_INLINE_VISIBILITY
242 bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT
243 {return !(__x < __y);}
244
245 template<class _CharT, class _Traits>
246 friend
247 _LIBCPP_INLINE_VISIBILITY
248 basic_ostream<_CharT, _Traits>&
249 operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
250 {return __os << __id.__id_;}
251
252private:
253 _LIBCPP_INLINE_VISIBILITY
254 __thread_id(__libcpp_thread_id __id) : __id_(__id) {}
255
256 friend __thread_id this_thread::get_id() _NOEXCEPT;
257 friend class _LIBCPP_TYPE_VIS thread;
258 friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>;
259};
260
261203template<>
262204struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
263205 : public unary_function<__thread_id, size_t>
......@@ -269,17 +211,11 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
269211 }
270212};
271213
272namespace this_thread
273{
274
275inline _LIBCPP_INLINE_VISIBILITY
276__thread_id
277get_id() _NOEXCEPT
278{
279 return __libcpp_thread_get_current_id();
280}
281
282} // this_thread
214template<class _CharT, class _Traits>
215_LIBCPP_INLINE_VISIBILITY
216basic_ostream<_CharT, _Traits>&
217operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
218{return __os << __id.__id_;}
283219
284220class _LIBCPP_TYPE_VIS thread
285221{