mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-11-15 23:09:41 +01:00
Compare commits
5 Commits
feature/re
...
feature/is
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3de75e7f57 | ||
|
|
f48fe044f3 | ||
|
|
8a27c4de9c | ||
|
|
0caaead2ec | ||
|
|
907965333f |
@@ -226,6 +226,20 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
|||||||
"g++-15-multilib",
|
"g++-15-multilib",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 16.04 Clang 3.5",
|
||||||
|
"cppalliance/droneubuntu1604:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-3.5', CXXSTD: '11' },
|
||||||
|
"clang-3.5",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 16.04 Clang 3.6",
|
||||||
|
"cppalliance/droneubuntu1604:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-3.6', CXXSTD: '11,14' },
|
||||||
|
"clang-3.6",
|
||||||
|
),
|
||||||
|
|
||||||
linux_pipeline(
|
linux_pipeline(
|
||||||
"Linux 16.04 Clang 3.7",
|
"Linux 16.04 Clang 3.7",
|
||||||
"cppalliance/droneubuntu1604:1",
|
"cppalliance/droneubuntu1604:1",
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ environment:
|
|||||||
TOOLSET: msvc-14.1
|
TOOLSET: msvc-14.1
|
||||||
CXXSTD: 14,17
|
CXXSTD: 14,17
|
||||||
ADDRMD: 32,64
|
ADDRMD: 32,64
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
TOOLSET: clang-win
|
||||||
|
CXXSTD: 14,17,latest
|
||||||
|
ADDRMD: 64
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
TOOLSET: msvc-14.2
|
TOOLSET: msvc-14.2
|
||||||
CXXSTD: 14
|
CXXSTD: 14
|
||||||
|
|||||||
@@ -13,6 +13,25 @@ http://www.boost.org/LICENSE_1_0.txt
|
|||||||
:toc-title:
|
:toc-title:
|
||||||
:idprefix: changelog_
|
:idprefix: changelog_
|
||||||
|
|
||||||
|
## Changes in 1.90.0
|
||||||
|
|
||||||
|
* The functionality enabled by the deprecated macros
|
||||||
|
`BOOST_SP_ENABLE_DEBUG_HOOKS`, `BOOST_SP_USE_STD_ALLOCATOR`,
|
||||||
|
and `BOOST_SP_USE_QUICK_ALLOCATOR` has been removed.
|
||||||
|
* The header `<boost/smart_ptr/detail/quick_allocator.hpp>` has
|
||||||
|
been marked deprecated and will be removed in a future release.
|
||||||
|
* Configurations that define `BOOST_NO_CXX11_HDR_ATOMIC` are no
|
||||||
|
longer supported; a conforming {cpp}11 `<atomic>` is now required.
|
||||||
|
* Consequently, Clang 3.5 and 3.6 are no longer supported.
|
||||||
|
* The deprecated macros `BOOST_AC_USE_SPINLOCK`, `BOOST_AC_USE_PTHREADS`,
|
||||||
|
`BOOST_SP_USE_SPINLOCK`, and `BOOST_SP_USE_PTHREADS` are no longer
|
||||||
|
functional.
|
||||||
|
* Platform-specific implementations of `atomic_count`, `sp_counted_base`
|
||||||
|
and `spinlock` are no longer used and have been removed.
|
||||||
|
* Configurations that define `BOOST_NO_CXX11_HDR_MUTEX` are no
|
||||||
|
longer supported; a conforming {cpp}11 `<mutex>` is now required.
|
||||||
|
* Some unused headers in `boost/smart_ptr/detail/` have been removed.
|
||||||
|
|
||||||
## Changes in 1.88.0
|
## Changes in 1.88.0
|
||||||
|
|
||||||
* Fix `operator<<` for wide streams (accidentally broken in 1.87.0)
|
* Fix `operator<<` for wide streams (accidentally broken in 1.87.0)
|
||||||
|
|||||||
@@ -29,6 +29,16 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/smart_ptr/detail/deprecated_macros.hpp>
|
#include <boost/smart_ptr/detail/deprecated_macros.hpp>
|
||||||
#include <boost/smart_ptr/detail/spinlock_std_atomic.hpp>
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
|
||||||
|
// Old Clang versions have trouble with ATOMIC_FLAG_INIT
|
||||||
|
# include <boost/smart_ptr/detail/spinlock_gcc_atomic.hpp>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
# include <boost/smart_ptr/detail/spinlock_std_atomic.hpp>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED
|
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED
|
||||||
|
|||||||
94
include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp
Normal file
94
include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED
|
||||||
|
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Copyright 2008, 2020 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/smart_ptr/detail/yield_k.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
||||||
|
|
||||||
|
#include <boost/config/pragma_message.hpp>
|
||||||
|
BOOST_PRAGMA_MESSAGE("Using __atomic spinlock")
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
class spinlock
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// `bool` alignment is required for Apple PPC32
|
||||||
|
// https://github.com/boostorg/smart_ptr/issues/105
|
||||||
|
// https://github.com/PurpleI2P/i2pd/issues/1726
|
||||||
|
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107590
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
unsigned char v_;
|
||||||
|
bool align_;
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
bool try_lock()
|
||||||
|
{
|
||||||
|
return __atomic_test_and_set( &v_, __ATOMIC_ACQUIRE ) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lock()
|
||||||
|
{
|
||||||
|
for( unsigned k = 0; !try_lock(); ++k )
|
||||||
|
{
|
||||||
|
boost::detail::yield( k );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void unlock()
|
||||||
|
{
|
||||||
|
__atomic_clear( &v_, __ATOMIC_RELEASE );
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
class scoped_lock
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
spinlock & sp_;
|
||||||
|
|
||||||
|
scoped_lock( scoped_lock const & );
|
||||||
|
scoped_lock & operator=( scoped_lock const & );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit scoped_lock( spinlock & sp ): sp_( sp )
|
||||||
|
{
|
||||||
|
sp.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
~scoped_lock()
|
||||||
|
{
|
||||||
|
sp_.unlock();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#define BOOST_DETAIL_SPINLOCK_INIT {{0}}
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED
|
||||||
Reference in New Issue
Block a user