Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename moodycamel namespace #737

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/ylt/coro_io/detail/client_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "ylt/util/concurrentqueue.h"
namespace coro_io::detail {
using namespace ylt::detail;
template <typename client_t>
class client_queue {
moodycamel::ConcurrentQueue<client_t> queue_[2];
Expand Down
2 changes: 1 addition & 1 deletion include/ylt/easylog/appender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class appender {

std::mutex que_mtx_;

moodycamel::ConcurrentQueue<record_t> queue_;
ylt::detail::moodycamel::ConcurrentQueue<record_t> queue_;
std::thread write_thd_;
std::condition_variable cnd_;
std::atomic<bool> stop_ = false;
Expand Down
5 changes: 3 additions & 2 deletions include/ylt/metric/summary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ class summary_t : public metric_t {

struct block_t {
std::atomic<bool> stop_ = false;
moodycamel::ConcurrentQueue<double> sample_queue_;
ylt::detail::moodycamel::ConcurrentQueue<double> sample_queue_;
std::shared_ptr<TimeWindowQuantiles> quantile_values_;
std::uint64_t count_;
double sum_;
};

struct labels_block_t {
std::atomic<bool> stop_ = false;
moodycamel::ConcurrentQueue<summary_label_sample> sample_queue_;
ylt::detail::moodycamel::ConcurrentQueue<summary_label_sample>
sample_queue_;
metric_hash_map<std::shared_ptr<TimeWindowQuantiles>>
label_quantile_values_;
metric_hash_map<uint64_t> label_count_;
Expand Down
32 changes: 16 additions & 16 deletions include/ylt/util/concurrentqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

// Platform-specific definitions of a numeric thread ID type and an invalid
// value
namespace moodycamel {
namespace ylt::detail::moodycamel {
namespace details {
template <typename thread_id_t>
struct thread_id_converter {
Expand All @@ -109,22 +109,22 @@ struct thread_id_converter {
static thread_id_hash_t prehash(thread_id_t const& x) { return x; }
};
} // namespace details
} // namespace moodycamel
} // namespace ylt::detail::moodycamel
#if defined(MCDBGQ_USE_RELACY)
namespace moodycamel {
namespace ylt::detail::moodycamel {
namespace details {
typedef std::uint32_t thread_id_t;
static const thread_id_t invalid_thread_id = 0xFFFFFFFFU;
static const thread_id_t invalid_thread_id2 = 0xFFFFFFFEU;
static inline thread_id_t thread_id() { return rl::thread_index(); }
} // namespace details
} // namespace moodycamel
} // namespace ylt::detail::moodycamel
#elif defined(_WIN32) || defined(__WINDOWS__) || defined(__WIN32__)
// No sense pulling in windows.h in a header, we'll manually declare the
// function we use and rely on backwards-compatibility for this not to break
extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(
void);
namespace moodycamel {
namespace ylt::detail::moodycamel {
namespace details {
static_assert(sizeof(unsigned long) == sizeof(std::uint32_t),
"Expected size of unsigned long to be 32 bits on Windows");
Expand All @@ -139,11 +139,11 @@ static inline thread_id_t thread_id() {
return static_cast<thread_id_t>(::GetCurrentThreadId());
}
} // namespace details
} // namespace moodycamel
} // namespace ylt::detail::moodycamel
#elif defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || \
(defined(__APPLE__) && TARGET_OS_IPHONE) || \
defined(MOODYCAMEL_NO_THREAD_LOCAL)
namespace moodycamel {
namespace ylt::detail::moodycamel {
namespace details {
static_assert(sizeof(std::thread::id) == 4 || sizeof(std::thread::id) == 8,
"std::thread::id is expected to be either 4 or 8 bytes");
Expand Down Expand Up @@ -199,7 +199,7 @@ struct thread_id_converter<thread_id_t> {
// Assume C++11 compliant compiler
#define MOODYCAMEL_THREADLOCAL thread_local
#endif
namespace moodycamel {
namespace ylt::detail::moodycamel {
namespace details {
typedef std::uintptr_t thread_id_t;
static const thread_id_t invalid_thread_id = 0; // Address can't be nullptr
Expand Down Expand Up @@ -330,7 +330,7 @@ inline thread_id_t thread_id() {
#endif
#endif

namespace moodycamel {
namespace ylt::detail::moodycamel {
namespace details {
#ifndef MOODYCAMEL_ALIGNAS
// VS2013 doesn't support alignas or alignof, and align() requires a constant
Expand Down Expand Up @@ -390,7 +390,7 @@ struct identity {
#endif
#endif
} // namespace details
} // namespace moodycamel
} // namespace ylt::detail::moodycamel

// TSAN can false report races in lock-free code. To enable TSAN to be used
// from projects that use this one, we can apply per-function compile-time
Expand All @@ -405,7 +405,7 @@ struct identity {
#endif // TSAN

// Compiler-specific likely/unlikely hints
namespace moodycamel {
namespace ylt::detail::moodycamel {
namespace details {
#if defined(__GNUC__)
static inline bool(likely)(bool x) { return __builtin_expect((x), true); }
Expand All @@ -415,13 +415,13 @@ static inline bool(likely)(bool x) { return x; }
static inline bool(unlikely)(bool x) { return x; }
#endif
} // namespace details
} // namespace moodycamel
} // namespace ylt::detail::moodycamel

#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG
#include "internal/concurrentqueue_internal_debug.h"
#endif

namespace moodycamel {
namespace ylt::detail::moodycamel {
namespace details {
template <typename T>
struct const_numeric_max {
Expand Down Expand Up @@ -937,8 +937,8 @@ inline void swap(typename ConcurrentQueue<T, Traits>::ImplicitProducerKVP& a,
template <typename T, typename Traits = ConcurrentQueueDefaultTraits>
class ConcurrentQueue {
public:
typedef ::moodycamel::ProducerToken producer_token_t;
typedef ::moodycamel::ConsumerToken consumer_token_t;
typedef ::ylt::detail::moodycamel::ProducerToken producer_token_t;
typedef ::ylt::detail::moodycamel::ConsumerToken consumer_token_t;

typedef typename Traits::index_t index_t;
typedef typename Traits::size_t size_t;
Expand Down Expand Up @@ -4388,7 +4388,7 @@ inline void swap(typename ConcurrentQueue<T, Traits>::ImplicitProducerKVP& a,
a.swap(b);
}

} // namespace moodycamel
} // namespace ylt::detail::moodycamel

#if defined(_MSC_VER) && (!defined(_HAS_CXX17) || !_HAS_CXX17)
#pragma warning(pop)
Expand Down
2 changes: 1 addition & 1 deletion src/metric/tests/test_metric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ TEST_CASE("test serialize with multiple threads") {
#if defined(__GNUC__)
TEST_CASE("test system metric") {
start_system_metric();
detail::ylt_stat();
metric::detail::ylt_stat();

auto s = system_metric_manager::instance().serialize_static();
std::cout << s;
Expand Down
Loading