mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
commit
faeab5f649
@ -1,15 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <boost/operators.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
/** https://svn.boost.org/trac/boost/ticket/5182
|
||||
*/
|
||||
|
||||
template <class T, class Tag>
|
||||
struct StrongTypedef
|
||||
: boost::totally_ordered1< StrongTypedef<T, Tag>
|
||||
, boost::totally_ordered2< StrongTypedef<T, Tag>, T> >
|
||||
{
|
||||
private:
|
||||
using Self = StrongTypedef;
|
||||
|
2
contrib/llvm
vendored
2
contrib/llvm
vendored
@ -1 +1 @@
|
||||
Subproject commit 5dab18f4861677548b8f7f6815f49384480ecead
|
||||
Subproject commit 4bb9d5c58d92baf4f043ee5258bcdfa8ac567545
|
2
contrib/rapidjson
vendored
2
contrib/rapidjson
vendored
@ -1 +1 @@
|
||||
Subproject commit 01950eb7acec78818d68b762efc869bba2420d82
|
||||
Subproject commit 8f4c021fa2f1e001d2376095928fc0532adf2ae6
|
@ -1,5 +1,6 @@
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include <atomic>
|
||||
|
||||
#include <common/sleep.h>
|
||||
|
||||
@ -20,31 +21,31 @@ int main(int argc, char ** argv)
|
||||
|
||||
std::cerr << (DB::ThreadFuzzer::instance().isEffective() ? "ThreadFuzzer is enabled.\n" : "ThreadFuzzer is not enabled.\n");
|
||||
|
||||
volatile size_t counter1 = 0;
|
||||
volatile size_t counter2 = 0;
|
||||
std::atomic<size_t> counter1 = 0;
|
||||
std::atomic<size_t> counter2 = 0;
|
||||
|
||||
/// These threads are synchronized by sleep (that's intentionally incorrect).
|
||||
|
||||
std::thread t1([&]
|
||||
{
|
||||
for (size_t i = 0; i < num_iterations; ++i)
|
||||
++counter1;
|
||||
counter1.store(counter1.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed);
|
||||
|
||||
sleepForNanoseconds(100000000);
|
||||
|
||||
for (size_t i = 0; i < num_iterations; ++i)
|
||||
++counter2;
|
||||
counter2.store(counter2.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed);
|
||||
});
|
||||
|
||||
std::thread t2([&]
|
||||
{
|
||||
for (size_t i = 0; i < num_iterations; ++i)
|
||||
++counter2;
|
||||
counter2.store(counter2.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed);
|
||||
|
||||
sleepForNanoseconds(100000000);
|
||||
|
||||
for (size_t i = 0; i < num_iterations; ++i)
|
||||
++counter1;
|
||||
counter1.store(counter1.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed);
|
||||
});
|
||||
|
||||
t1.join();
|
||||
|
@ -524,8 +524,8 @@ public:
|
||||
bool tryGet(const StringRef & name, String & value) const;
|
||||
|
||||
/// Compares two collections of settings.
|
||||
bool operator ==(const Derived & rhs) const;
|
||||
bool operator!=(const Derived & rhs) const { return !(*this == rhs); }
|
||||
bool operator ==(const SettingsCollection & rhs) const;
|
||||
bool operator!=(const SettingsCollection & rhs) const { return !(*this == rhs); }
|
||||
|
||||
/// Gathers all changed values (e.g. for applying them later to another collection of settings).
|
||||
SettingsChanges changes() const;
|
||||
|
@ -173,19 +173,19 @@ bool SettingsCollection<Derived>::tryGet(const StringRef & name, String & value)
|
||||
|
||||
|
||||
template <class Derived>
|
||||
bool SettingsCollection<Derived>::operator ==(const Derived & rhs) const
|
||||
bool SettingsCollection<Derived>::operator ==(const SettingsCollection<Derived> & rhs) const
|
||||
{
|
||||
const auto & the_members = members();
|
||||
for (size_t i = 0; i != the_members.size(); ++i)
|
||||
{
|
||||
const auto & member = the_members[i];
|
||||
bool left_changed = member.is_changed(castToDerived());
|
||||
bool right_changed = member.is_changed(rhs);
|
||||
bool right_changed = member.is_changed(rhs.castToDerived());
|
||||
if (left_changed || right_changed)
|
||||
{
|
||||
if (left_changed != right_changed)
|
||||
return false;
|
||||
if (member.get_field(castToDerived()) != member.get_field(rhs))
|
||||
if (member.get_field(castToDerived()) != member.get_field(rhs.castToDerived()))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user