Sha256: 934a63cdb046f5fad4783de2689cc1b6f3b7f55f99d03ab81133a694a5a7652b

Contents?: true

Size: 1 KB

Versions: 41

Compression:

Stored size: 1 KB

Contents

// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)

#pragma once

#include <atomic>
#include <utility>
// null, no cost dummy "mutex" and dummy "atomic" int

namespace spdlog {
namespace details {
struct null_mutex
{
    void lock() const {}
    void unlock() const {}
    bool try_lock() const
    {
        return true;
    }
};

struct null_atomic_int
{
    int value;
    null_atomic_int() = default;

    explicit null_atomic_int(int new_value)
        : value(new_value)
    {}

    int load(std::memory_order = std::memory_order_relaxed) const
    {
        return value;
    }

    void store(int new_value, std::memory_order = std::memory_order_relaxed)
    {
        value = new_value;
    }

    int exchange(int new_value, std::memory_order = std::memory_order_relaxed)
    {
        std::swap(new_value, value);
        return new_value; // return value before the call
    }
};

} // namespace details
} // namespace spdlog

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
couchbase-3.4.5 ext/couchbase/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.4.4 ext/couchbase/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.4.3 ext/couchbase/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.4.2 ext/couchbase/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.4.1 ext/couchbase/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.4.0 ext/couchbase/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.3.0 ext/couchbase/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.2.0-universal-darwin-20 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.2.0 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.1.1 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.1.1-universal-darwin-20 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.1.0 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.0.3 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.0.3-universal-darwin-20 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.0.2 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.0.1-universal-darwin-19 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.0.1 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.0.0-universal-darwin-19 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.0.0 ext/third_party/spdlog/include/spdlog/details/null_mutex.h
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/spdlog/include/spdlog/details/null_mutex.h