diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-02-10 16:46:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:30 +0300 |
commit | 4b839d0704ee9be1dabb0310a1f03af24963637b (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/cxxsupp/libcxx/src/random_shuffle.cpp | |
parent | f773626848a7c7456803654292e716b83d69cc12 (diff) | |
download | ydb-4b839d0704ee9be1dabb0310a1f03af24963637b.tar.gz |
Restoring authorship annotation for Andrey Khalyavin <halyavin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/src/random_shuffle.cpp')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/src/random_shuffle.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/src/random_shuffle.cpp b/contrib/libs/cxxsupp/libcxx/src/random_shuffle.cpp index 11e77d453c..be2c47fa0d 100644 --- a/contrib/libs/cxxsupp/libcxx/src/random_shuffle.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/random_shuffle.cpp @@ -1,61 +1,61 @@ -//===----------------------- random_shuffle.cpp ---------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "algorithm" -#include "random" -#ifndef _LIBCPP_HAS_NO_THREADS -# include "mutex" -# if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) -# pragma comment(lib, "pthread") -# endif -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#ifndef _LIBCPP_HAS_NO_THREADS -_LIBCPP_SAFE_STATIC static __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; -#endif -unsigned __rs_default::__c_ = 0; - -__rs_default::__rs_default() -{ -#ifndef _LIBCPP_HAS_NO_THREADS - __libcpp_mutex_lock(&__rs_mut); -#endif - __c_ = 1; -} - -__rs_default::__rs_default(const __rs_default&) -{ - ++__c_; -} - -__rs_default::~__rs_default() -{ -#ifndef _LIBCPP_HAS_NO_THREADS - if (--__c_ == 0) - __libcpp_mutex_unlock(&__rs_mut); -#else - --__c_; -#endif -} - -__rs_default::result_type -__rs_default::operator()() -{ - static mt19937 __rs_g; - return __rs_g(); -} - -__rs_default -__rs_get() -{ - return __rs_default(); -} - -_LIBCPP_END_NAMESPACE_STD +//===----------------------- random_shuffle.cpp ---------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "algorithm" +#include "random" +#ifndef _LIBCPP_HAS_NO_THREADS +# include "mutex" +# if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) +# pragma comment(lib, "pthread") +# endif +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_HAS_NO_THREADS +_LIBCPP_SAFE_STATIC static __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; +#endif +unsigned __rs_default::__c_ = 0; + +__rs_default::__rs_default() +{ +#ifndef _LIBCPP_HAS_NO_THREADS + __libcpp_mutex_lock(&__rs_mut); +#endif + __c_ = 1; +} + +__rs_default::__rs_default(const __rs_default&) +{ + ++__c_; +} + +__rs_default::~__rs_default() +{ +#ifndef _LIBCPP_HAS_NO_THREADS + if (--__c_ == 0) + __libcpp_mutex_unlock(&__rs_mut); +#else + --__c_; +#endif +} + +__rs_default::result_type +__rs_default::operator()() +{ + static mt19937 __rs_g; + return __rs_g(); +} + +__rs_default +__rs_get() +{ + return __rs_default(); +} + +_LIBCPP_END_NAMESPACE_STD |