/usr/local/lib64/python3.6/site-packages/pyarrow/include/arrow/util
Edit: /usr/local/lib64/python3.6/site-packages/pyarrow/include/arrow/util/atomic_shared_ptr.h (3640B)
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#pragma once
#include
#include
#include
#include "arrow/type_traits.h"
namespace arrow {
namespace internal {
// Atomic shared_ptr operations only appeared in libstdc++ since GCC 5,
// emulate them with unsafe ops if unavailable.
// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57250
template
struct is_atomic_load_shared_ptr_available : std::false_type {};
template
struct is_atomic_load_shared_ptr_available<
T, void_t*>()))>>
: std::true_type {};
template
using enable_if_atomic_load_shared_ptr_available =
enable_if_t::value, T>;
template
using enable_if_atomic_load_shared_ptr_unavailable =
enable_if_t::value, T>;
template
enable_if_atomic_load_shared_ptr_available> atomic_load(
const std::shared_ptr* p) {
return std::atomic_load(p);
}
template
enable_if_atomic_load_shared_ptr_unavailable> atomic_load(
const std::shared_ptr* p) {
return *p;
}
template
struct is_atomic_store_shared_ptr_available : std::false_type {};
template
struct is_atomic_store_shared_ptr_available<
T, void_t*>(),
std::declval>()))>>
: std::true_type {};
template
using enable_if_atomic_store_shared_ptr_available =
enable_if_t::value, T>;
template
using enable_if_atomic_store_shared_ptr_unavailable =
enable_if_t::value, T>;
template
void atomic_store(enable_if_atomic_store_shared_ptr_available*> p,
std::shared_ptr r) {
std::atomic_store(p, std::move(r));
}
template
void atomic_store(enable_if_atomic_store_shared_ptr_unavailable*> p,
std::shared_ptr r) {
*p = r;
}
template
bool atomic_compare_exchange_strong(
enable_if_atomic_store_shared_ptr_available*> p,
std::shared_ptr* expected, std::shared_ptr desired) {
return std::atomic_compare_exchange_strong(p, expected, std::move(desired));
}
template
bool atomic_compare_exchange_strong(
enable_if_atomic_store_shared_ptr_unavailable*> p,
std::shared_ptr* expected, std::shared_ptr desired) {
if (*p == *expected) {
*p = std::move(desired);
return true;
} else {
*expected = *p;
return false;
}
}
} // namespace internal
} // namespace arrow