mirror of
				https://github.com/boostorg/smart_ptr.git
				synced 2025-11-04 01:31:51 +01:00 
			
		
		
		
	Compare commits
	
		
			40 Commits
		
	
	
		
			boost-1.66
			...
			boost-1.68
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					e37cd4154f | ||
| 
						 | 
					8563fc5c4e | ||
| 
						 | 
					67fab5c9ec | ||
| 
						 | 
					f16fbdce26 | ||
| 
						 | 
					c3b3835a58 | ||
| 
						 | 
					d1600b8abc | ||
| 
						 | 
					5885763287 | ||
| 
						 | 
					9bb12692b3 | ||
| 
						 | 
					773ef80f5d | ||
| 
						 | 
					704de2bd67 | ||
| 
						 | 
					1caa233faa | ||
| 
						 | 
					605d4a2789 | ||
| 
						 | 
					6ab9b93088 | ||
| 
						 | 
					4129bb6a5c | ||
| 
						 | 
					3b64e5ecb3 | ||
| 
						 | 
					4025698fe8 | ||
| 
						 | 
					2d7ab197a7 | ||
| 
						 | 
					5877b08490 | ||
| 
						 | 
					ffe5b46f75 | ||
| 
						 | 
					4abc74fe28 | ||
| 
						 | 
					12a646c607 | ||
| 
						 | 
					937a3e0e93 | ||
| 
						 | 
					258fa75a7e | ||
| 
						 | 
					93d0d69f5e | ||
| 
						 | 
					f173f9c0fb | ||
| 
						 | 
					6a5942f55f | ||
| 
						 | 
					293a4ee009 | ||
| 
						 | 
					8e3aa3a565 | ||
| 
						 | 
					78bebd5166 | ||
| 
						 | 
					a47cf35b0f | ||
| 
						 | 
					8d0afb670f | ||
| 
						 | 
					77a35856c6 | ||
| 
						 | 
					693109361e | ||
| 
						 | 
					6735806863 | ||
| 
						 | 
					b0dc300154 | ||
| 
						 | 
					adc998469a | ||
| 
						 | 
					4252ed31de | ||
| 
						 | 
					279372a784 | ||
| 
						 | 
					2553a71b79 | ||
| 
						 | 
					5dfcd2a6e4 | 
							
								
								
									
										93
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										93
									
								
								.travis.yml
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2016, 2017 Peter Dimov
 | 
			
		||||
# Copyright 2016, 2017, 2018 Peter Dimov
 | 
			
		||||
# Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
 | 
			
		||||
 | 
			
		||||
@@ -24,7 +24,27 @@ matrix:
 | 
			
		||||
  include:
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: g++
 | 
			
		||||
      env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
 | 
			
		||||
      env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11 VARIANT=debug,release
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: g++-4.4
 | 
			
		||||
      env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
            - g++-4.4
 | 
			
		||||
          sources:
 | 
			
		||||
            - ubuntu-toolchain-r-test
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: g++-4.6
 | 
			
		||||
      env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
            - g++-4.6
 | 
			
		||||
          sources:
 | 
			
		||||
            - ubuntu-toolchain-r-test
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: g++-4.7
 | 
			
		||||
@@ -76,9 +96,18 @@ matrix:
 | 
			
		||||
            - ubuntu-toolchain-r-test
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      dist: trusty
 | 
			
		||||
      compiler: g++-7
 | 
			
		||||
      env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
 | 
			
		||||
      env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 VARIANT=release
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
            - g++-7
 | 
			
		||||
          sources:
 | 
			
		||||
            - ubuntu-toolchain-r-test
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: g++-7
 | 
			
		||||
      env: UBSAN=1 TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
@@ -88,7 +117,23 @@ matrix:
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: clang++
 | 
			
		||||
      env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
 | 
			
		||||
      env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11 VARIANT=debug,release
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: /usr/bin/clang++
 | 
			
		||||
      env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
            - clang-3.3
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: /usr/bin/clang++
 | 
			
		||||
      env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
            - clang-3.4
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: clang++-3.5
 | 
			
		||||
@@ -161,7 +206,7 @@ matrix:
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: clang++-5.0
 | 
			
		||||
      env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
 | 
			
		||||
      env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z VARIANT=release
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
@@ -170,6 +215,33 @@ matrix:
 | 
			
		||||
            - ubuntu-toolchain-r-test
 | 
			
		||||
            - llvm-toolchain-trusty-5.0
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: clang++-5.0
 | 
			
		||||
      env: UBSAN=1 TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
            - clang-5.0
 | 
			
		||||
          sources:
 | 
			
		||||
            - ubuntu-toolchain-r-test
 | 
			
		||||
            - llvm-toolchain-trusty-5.0
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: clang++-libc++
 | 
			
		||||
      env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z VARIANT=release
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
            - libc++-dev
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
      compiler: clang++-libc++
 | 
			
		||||
      env: UBSAN=1 TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
 | 
			
		||||
      addons:
 | 
			
		||||
        apt:
 | 
			
		||||
          packages:
 | 
			
		||||
            - libc++-dev
 | 
			
		||||
 | 
			
		||||
    - os: osx
 | 
			
		||||
      compiler: clang++
 | 
			
		||||
      env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
 | 
			
		||||
@@ -183,16 +255,15 @@ install:
 | 
			
		||||
  - git submodule init libs/assert
 | 
			
		||||
  - git submodule init libs/atomic
 | 
			
		||||
  - git submodule init libs/config
 | 
			
		||||
  - git submodule init libs/container_hash
 | 
			
		||||
  - git submodule init libs/core
 | 
			
		||||
  - git submodule init libs/detail
 | 
			
		||||
  - git submodule init libs/functional
 | 
			
		||||
  - git submodule init libs/integer
 | 
			
		||||
  - git submodule init libs/move
 | 
			
		||||
  - git submodule init libs/predef
 | 
			
		||||
  - git submodule init libs/preprocessor
 | 
			
		||||
  - git submodule init libs/static_assert
 | 
			
		||||
  - git submodule init libs/throw_exception
 | 
			
		||||
  - git submodule init libs/type_traits
 | 
			
		||||
  - git submodule init libs/detail
 | 
			
		||||
  - git submodule init libs/integer
 | 
			
		||||
  - git submodule init tools/build
 | 
			
		||||
  - git submodule update
 | 
			
		||||
  - cp -r $TRAVIS_BUILD_DIR/* libs/smart_ptr
 | 
			
		||||
@@ -202,7 +273,7 @@ install:
 | 
			
		||||
script:
 | 
			
		||||
  - |-
 | 
			
		||||
    echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
 | 
			
		||||
  - ./b2 -j 3 libs/smart_ptr/test toolset=$TOOLSET cxxstd=$CXXSTD
 | 
			
		||||
  - ./b2 -j3 libs/smart_ptr/test toolset=$TOOLSET cxxstd=$CXXSTD ${VARIANT:+variant=$VARIANT} ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
 | 
			
		||||
 | 
			
		||||
notifications:
 | 
			
		||||
  email:
 | 
			
		||||
 
 | 
			
		||||
@@ -2,5 +2,5 @@
 | 
			
		||||
 | 
			
		||||
Branch   | Travis | Appveyor
 | 
			
		||||
---------|--------|---------
 | 
			
		||||
Develop  | [](https://travis-ci.org/boostorg/smart_ptr) | [](https://ci.appveyor.com/project/pdimov/smart_ptr)
 | 
			
		||||
Master   | [](https://travis-ci.org/boostorg/smart_ptr) | [](https://ci.appveyor.com/project/pdimov/smart_ptr)
 | 
			
		||||
Develop  | [](https://travis-ci.org/boostorg/smart_ptr) | [](https://ci.appveyor.com/project/pdimov/smart-ptr)
 | 
			
		||||
Master   | [](https://travis-ci.org/boostorg/smart_ptr) | [](https://ci.appveyor.com/project/pdimov/smart-ptr)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								appveyor.yml
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								appveyor.yml
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2016, 2017 Peter Dimov
 | 
			
		||||
# Copyright 2016-2018 Peter Dimov
 | 
			
		||||
# Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
 | 
			
		||||
 | 
			
		||||
@@ -18,9 +18,27 @@ environment:
 | 
			
		||||
      TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
 | 
			
		||||
      TOOLSET: msvc-14.0
 | 
			
		||||
      ADDRMD: 32,64
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
 | 
			
		||||
      TOOLSET: msvc-14.1
 | 
			
		||||
      CXXSTD: 14,17
 | 
			
		||||
      ADDRMD: 32,64
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
 | 
			
		||||
      ADDPATH: C:\cygwin\bin;
 | 
			
		||||
      TOOLSET: gcc
 | 
			
		||||
      CXXSTD: 03,11,14,1z
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
 | 
			
		||||
      ADDPATH: C:\cygwin64\bin;
 | 
			
		||||
      TOOLSET: gcc
 | 
			
		||||
      CXXSTD: 03,11,14,1z
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
 | 
			
		||||
      ADDPATH: C:\mingw\bin;
 | 
			
		||||
      TOOLSET: gcc
 | 
			
		||||
      CXXSTD: 03,11,14,1z
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
 | 
			
		||||
      ADDPATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;
 | 
			
		||||
      TOOLSET: gcc
 | 
			
		||||
      CXXSTD: 03,11,14,1z
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
  - set BOOST_BRANCH=develop
 | 
			
		||||
@@ -32,24 +50,25 @@ install:
 | 
			
		||||
  - git submodule init libs/assert
 | 
			
		||||
  - git submodule init libs/atomic
 | 
			
		||||
  - git submodule init libs/config
 | 
			
		||||
  - git submodule init libs/container_hash
 | 
			
		||||
  - git submodule init libs/core
 | 
			
		||||
  - git submodule init libs/detail
 | 
			
		||||
  - git submodule init libs/functional
 | 
			
		||||
  - git submodule init libs/integer
 | 
			
		||||
  - git submodule init libs/move
 | 
			
		||||
  - git submodule init libs/predef
 | 
			
		||||
  - git submodule init libs/preprocessor
 | 
			
		||||
  - git submodule init libs/static_assert
 | 
			
		||||
  - git submodule init libs/throw_exception
 | 
			
		||||
  - git submodule init libs/type_traits
 | 
			
		||||
  - git submodule init libs/detail
 | 
			
		||||
  - git submodule init libs/integer
 | 
			
		||||
  - git submodule init tools/build
 | 
			
		||||
  - git submodule update
 | 
			
		||||
  - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\smart_ptr
 | 
			
		||||
  - cmd /c bootstrap
 | 
			
		||||
  - b2 headers
 | 
			
		||||
  - b2 -d0 headers
 | 
			
		||||
 | 
			
		||||
build: off
 | 
			
		||||
 | 
			
		||||
test_script:
 | 
			
		||||
  - PATH=%ADDPATH%%PATH%
 | 
			
		||||
  - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
 | 
			
		||||
  - b2 -j 3 libs/smart_ptr/test toolset=%TOOLSET% %CXXSTD%
 | 
			
		||||
  - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
 | 
			
		||||
  - b2 -j3 libs/smart_ptr/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ int main()
 | 
			
		||||
 | 
			
		||||
    clock_t t = clock();
 | 
			
		||||
 | 
			
		||||
    pthread_t a[ m ];
 | 
			
		||||
    boost::detail::lw_thread_t a[ m ];
 | 
			
		||||
 | 
			
		||||
    for( int i = 0; i < m; ++i )
 | 
			
		||||
    {
 | 
			
		||||
@@ -71,7 +71,7 @@ int main()
 | 
			
		||||
 | 
			
		||||
    for( int j = 0; j < m; ++j )
 | 
			
		||||
    {
 | 
			
		||||
        pthread_join( a[j], 0 );
 | 
			
		||||
        boost::detail::lw_thread_join( a[j] );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    t = clock() - t;
 | 
			
		||||
 
 | 
			
		||||
@@ -228,7 +228,7 @@ int main( int ac, char const * av[] )
 | 
			
		||||
 | 
			
		||||
    clock_t t = clock();
 | 
			
		||||
 | 
			
		||||
    std::vector<pthread_t> a( m );
 | 
			
		||||
    std::vector<boost::detail::lw_thread_t> a( m );
 | 
			
		||||
 | 
			
		||||
    for( int i = 0; i < m; ++i )
 | 
			
		||||
    {
 | 
			
		||||
@@ -237,7 +237,7 @@ int main( int ac, char const * av[] )
 | 
			
		||||
 | 
			
		||||
    for( int j = 0; j < m; ++j )
 | 
			
		||||
    {
 | 
			
		||||
        pthread_join( a[ j ], 0 );
 | 
			
		||||
        boost::detail::lw_thread_join( a[ j ] );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    t = clock() - t;
 | 
			
		||||
 
 | 
			
		||||
@@ -165,7 +165,7 @@ int main()
 | 
			
		||||
 | 
			
		||||
    clock_t t = clock();
 | 
			
		||||
 | 
			
		||||
    pthread_t a[ mr+mw ];
 | 
			
		||||
    boost::detail::lw_thread_t a[ mr+mw ];
 | 
			
		||||
 | 
			
		||||
    for( int i = 0; i < mr; ++i )
 | 
			
		||||
    {
 | 
			
		||||
@@ -179,7 +179,7 @@ int main()
 | 
			
		||||
 | 
			
		||||
    for( int j = 0; j < mr+mw; ++j )
 | 
			
		||||
    {
 | 
			
		||||
        pthread_join( a[ j ], 0 );
 | 
			
		||||
        boost::detail::lw_thread_join( a[ j ] );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    t = clock() - t;
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ int main()
 | 
			
		||||
 | 
			
		||||
    clock_t t = clock();
 | 
			
		||||
 | 
			
		||||
    pthread_t a[ m ];
 | 
			
		||||
    boost::detail::lw_thread_t a[ m ];
 | 
			
		||||
 | 
			
		||||
    for( int i = 0; i < m; ++i )
 | 
			
		||||
    {
 | 
			
		||||
@@ -111,7 +111,7 @@ int main()
 | 
			
		||||
 | 
			
		||||
    for( int j = 0; j < m; ++j )
 | 
			
		||||
    {
 | 
			
		||||
        pthread_join( a[j], 0 );
 | 
			
		||||
        boost::detail::lw_thread_join( a[j] );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    t = clock() - t;
 | 
			
		||||
 
 | 
			
		||||
@@ -10,30 +10,59 @@
 | 
			
		||||
//  boost/detail/lightweight_thread.hpp
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
 | 
			
		||||
//  Copyright (c) 2008 Peter Dimov
 | 
			
		||||
//  Copyright (c) 2008, 2018 Peter Dimov
 | 
			
		||||
//
 | 
			
		||||
//  Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
//  See accompanying file LICENSE_1_0.txt or copy at
 | 
			
		||||
//  http://www.boost.org/LICENSE_1_0.txt
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//  typedef /*...*/ lw_thread_t; // as pthread_t
 | 
			
		||||
//  template<class F> int lw_thread_create( lw_thread_t & th, F f );
 | 
			
		||||
//  void lw_thread_join( lw_thread_t th );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <cerrno>
 | 
			
		||||
 | 
			
		||||
// pthread_create, pthread_join
 | 
			
		||||
 | 
			
		||||
#if defined( BOOST_HAS_PTHREADS )
 | 
			
		||||
 | 
			
		||||
#include <pthread.h>
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
namespace boost
 | 
			
		||||
{
 | 
			
		||||
namespace detail
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
typedef ::pthread_t lw_thread_t;
 | 
			
		||||
 | 
			
		||||
inline int lw_thread_create_( lw_thread_t* thread, const pthread_attr_t* attr, void* (*start_routine)( void* ), void* arg )
 | 
			
		||||
{
 | 
			
		||||
    return ::pthread_create( thread, attr, start_routine, arg );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void lw_thread_join( lw_thread_t th )
 | 
			
		||||
{
 | 
			
		||||
    ::pthread_join( th, 0 );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace detail
 | 
			
		||||
} // namespace boost
 | 
			
		||||
 | 
			
		||||
#else // defined( BOOST_HAS_PTHREADS )
 | 
			
		||||
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#include <process.h>
 | 
			
		||||
 | 
			
		||||
typedef HANDLE pthread_t;
 | 
			
		||||
namespace boost
 | 
			
		||||
{
 | 
			
		||||
namespace detail
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg )
 | 
			
		||||
typedef HANDLE lw_thread_t;
 | 
			
		||||
 | 
			
		||||
inline int lw_thread_create_( lw_thread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg )
 | 
			
		||||
{
 | 
			
		||||
    HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 );
 | 
			
		||||
 | 
			
		||||
@@ -48,20 +77,20 @@ int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * star
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pthread_join( pthread_t thread, void ** /*value_ptr*/ )
 | 
			
		||||
inline void lw_thread_join( lw_thread_t thread )
 | 
			
		||||
{
 | 
			
		||||
    ::WaitForSingleObject( thread, INFINITE );
 | 
			
		||||
    ::CloseHandle( thread );
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
} // namespace detail
 | 
			
		||||
} // namespace boost
 | 
			
		||||
 | 
			
		||||
#endif // defined( BOOST_HAS_PTHREADS )
 | 
			
		||||
 | 
			
		||||
// template<class F> int lw_thread_create( pthread_t & pt, F f );
 | 
			
		||||
 | 
			
		||||
namespace boost
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
namespace detail
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@@ -77,8 +106,16 @@ public:
 | 
			
		||||
 | 
			
		||||
extern "C" void * lw_thread_routine( void * pv )
 | 
			
		||||
{
 | 
			
		||||
#if defined(BOOST_NO_CXX11_SMART_PTR)
 | 
			
		||||
 | 
			
		||||
    std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    std::unique_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    pt->run();
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
@@ -88,8 +125,16 @@ extern "C" void * lw_thread_routine( void * pv )
 | 
			
		||||
 | 
			
		||||
unsigned __stdcall lw_thread_routine( void * pv )
 | 
			
		||||
{
 | 
			
		||||
#if defined(BOOST_NO_CXX11_SMART_PTR)
 | 
			
		||||
 | 
			
		||||
    std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    std::unique_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    pt->run();
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
@@ -115,11 +160,19 @@ private:
 | 
			
		||||
    F f_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
template<class F> int lw_thread_create( pthread_t & pt, F f )
 | 
			
		||||
template<class F> int lw_thread_create( lw_thread_t & th, F f )
 | 
			
		||||
{
 | 
			
		||||
#if defined(BOOST_NO_CXX11_SMART_PTR)
 | 
			
		||||
 | 
			
		||||
    std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) );
 | 
			
		||||
 | 
			
		||||
    int r = pthread_create( &pt, 0, lw_thread_routine, p.get() );
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    std::unique_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) );
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    int r = lw_thread_create_( &th, 0, lw_thread_routine, p.get() );
 | 
			
		||||
 | 
			
		||||
    if( r == 0 )
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -353,9 +353,9 @@ public:
 | 
			
		||||
    typedef A type;
 | 
			
		||||
 | 
			
		||||
    template<class U>
 | 
			
		||||
    sp_array_state(const U& allocator, std::size_t size) BOOST_SP_NOEXCEPT
 | 
			
		||||
        : allocator_(allocator),
 | 
			
		||||
          size_(size) { }
 | 
			
		||||
    sp_array_state(const U& _allocator, std::size_t _size) BOOST_SP_NOEXCEPT
 | 
			
		||||
        : allocator_(_allocator),
 | 
			
		||||
          size_(_size) { }
 | 
			
		||||
 | 
			
		||||
    A& allocator() BOOST_SP_NOEXCEPT {
 | 
			
		||||
        return allocator_;
 | 
			
		||||
@@ -376,8 +376,8 @@ public:
 | 
			
		||||
    typedef A type;
 | 
			
		||||
 | 
			
		||||
    template<class U>
 | 
			
		||||
    sp_size_array_state(const U& allocator, std::size_t) BOOST_SP_NOEXCEPT
 | 
			
		||||
        : allocator_(allocator) { }
 | 
			
		||||
    sp_size_array_state(const U& _allocator, std::size_t) BOOST_SP_NOEXCEPT
 | 
			
		||||
        : allocator_(_allocator) { }
 | 
			
		||||
 | 
			
		||||
    A& allocator() BOOST_SP_NOEXCEPT {
 | 
			
		||||
        return allocator_;
 | 
			
		||||
 
 | 
			
		||||
@@ -97,7 +97,13 @@ public:
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    shared_ptr<T> load( int = 0 ) const BOOST_SP_NOEXCEPT
 | 
			
		||||
    shared_ptr<T> load() const BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::spinlock::scoped_lock lock( l_ );
 | 
			
		||||
        return p_;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<class M> shared_ptr<T> load( M ) const BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::spinlock::scoped_lock lock( l_ );
 | 
			
		||||
        return p_;
 | 
			
		||||
@@ -109,13 +115,19 @@ public:
 | 
			
		||||
        return p_;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void store( shared_ptr<T> r, int = 0 ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    void store( shared_ptr<T> r ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::spinlock::scoped_lock lock( l_ );
 | 
			
		||||
        p_.swap( r );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    shared_ptr<T> exchange( shared_ptr<T> r, int = 0 ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    template<class M> void store( shared_ptr<T> r, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::spinlock::scoped_lock lock( l_ );
 | 
			
		||||
        p_.swap( r );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    shared_ptr<T> exchange( shared_ptr<T> r ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        {
 | 
			
		||||
            boost::detail::spinlock::scoped_lock lock( l_ );
 | 
			
		||||
@@ -133,44 +145,82 @@ public:
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w, int, int ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    template<class M> shared_ptr<T> exchange( shared_ptr<T> r, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        {
 | 
			
		||||
            boost::detail::spinlock::scoped_lock lock( l_ );
 | 
			
		||||
            p_.swap( r );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
        return std::move( r );
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
        return r;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<class M> bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w, M, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, w );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w, int = 0 ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    template<class M> bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, w );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w, int, int ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    bool compare_exchange_weak( shared_ptr<T>& v, const shared_ptr<T>& w ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, w );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w, int = 0 ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    template<class M> bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w, M, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, w );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<class M> bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, w );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_strong( shared_ptr<T>& v, const shared_ptr<T>& w ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, w );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w, int, int ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    template<class M> bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w, M, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, std::move( w ) );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w, int = 0 ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    template<class M> bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, std::move( w ) );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w, int, int ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    bool compare_exchange_weak( shared_ptr<T>& v, shared_ptr<T>&& w ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, std::move( w ) );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w, int = 0 ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    template<class M> bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w, M, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, std::move( w ) );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<class M> bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w, M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, std::move( w ) );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool compare_exchange_strong( shared_ptr<T>& v, shared_ptr<T>&& w ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        return compare_exchange( v, std::move( w ) );
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,9 @@ extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRIT
 | 
			
		||||
extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *);
 | 
			
		||||
extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *);
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
typedef ::_RTL_CRITICAL_SECTION rtl_critical_section;
 | 
			
		||||
 | 
			
		||||
#else // #ifndef BOOST_USE_WINDOWS_H
 | 
			
		||||
 | 
			
		||||
typedef ::CRITICAL_SECTION critical_section;
 | 
			
		||||
 | 
			
		||||
@@ -74,6 +76,8 @@ using ::EnterCriticalSection;
 | 
			
		||||
using ::LeaveCriticalSection;
 | 
			
		||||
using ::DeleteCriticalSection;
 | 
			
		||||
 | 
			
		||||
typedef ::CRITICAL_SECTION rtl_critical_section;
 | 
			
		||||
 | 
			
		||||
#endif // #ifndef BOOST_USE_WINDOWS_H
 | 
			
		||||
 | 
			
		||||
class lightweight_mutex
 | 
			
		||||
@@ -90,15 +94,15 @@ public:
 | 
			
		||||
    lightweight_mutex()
 | 
			
		||||
    {
 | 
			
		||||
#if BOOST_PLAT_WINDOWS_RUNTIME
 | 
			
		||||
        boost::detail::InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_), 4000, 0);
 | 
			
		||||
        boost::detail::InitializeCriticalSectionEx(reinterpret_cast< rtl_critical_section* >(&cs_), 4000, 0);
 | 
			
		||||
#else
 | 
			
		||||
        boost::detail::InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_));
 | 
			
		||||
        boost::detail::InitializeCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_));
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ~lightweight_mutex()
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_));
 | 
			
		||||
        boost::detail::DeleteCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    class scoped_lock;
 | 
			
		||||
@@ -117,12 +121,12 @@ public:
 | 
			
		||||
 | 
			
		||||
        explicit scoped_lock(lightweight_mutex & m): m_(m)
 | 
			
		||||
        {
 | 
			
		||||
            boost::detail::EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_));
 | 
			
		||||
            boost::detail::EnterCriticalSection(reinterpret_cast< rtl_critical_section* >(&m_.cs_));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ~scoped_lock()
 | 
			
		||||
        {
 | 
			
		||||
            boost::detail::LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_));
 | 
			
		||||
            boost::detail::LeaveCriticalSection(reinterpret_cast< rtl_critical_section* >(&m_.cs_));
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -70,8 +70,8 @@ private:
 | 
			
		||||
    sp_counted_base( sp_counted_base const & );
 | 
			
		||||
    sp_counted_base & operator= ( sp_counted_base const & );
 | 
			
		||||
 | 
			
		||||
    atomic_int_least32_t use_count_;	// #shared
 | 
			
		||||
    atomic_int_least32_t weak_count_;	// #weak + (#shared != 0)
 | 
			
		||||
    atomic_int_least32_t use_count_;    // #shared
 | 
			
		||||
    atomic_int_least32_t weak_count_;   // #weak + (#shared != 0)
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,9 @@ inline void atomic_increment( int * pw )
 | 
			
		||||
    (
 | 
			
		||||
        "0:\n\t"
 | 
			
		||||
        ".set push\n\t"
 | 
			
		||||
#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6)
 | 
			
		||||
        ".set mips2\n\t"
 | 
			
		||||
#endif
 | 
			
		||||
        "ll %0, %1\n\t"
 | 
			
		||||
        "addiu %0, 1\n\t"
 | 
			
		||||
        "sc %0, %1\n\t"
 | 
			
		||||
@@ -59,7 +61,9 @@ inline int atomic_decrement( int * pw )
 | 
			
		||||
    (
 | 
			
		||||
        "0:\n\t"
 | 
			
		||||
        ".set push\n\t"
 | 
			
		||||
#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6)
 | 
			
		||||
        ".set mips2\n\t"
 | 
			
		||||
#endif
 | 
			
		||||
        "ll %1, %2\n\t"
 | 
			
		||||
        "addiu %0, %1, -1\n\t"
 | 
			
		||||
        "sc %0, %2\n\t"
 | 
			
		||||
@@ -85,7 +89,9 @@ inline int atomic_conditional_increment( int * pw )
 | 
			
		||||
    (
 | 
			
		||||
        "0:\n\t"
 | 
			
		||||
        ".set push\n\t"
 | 
			
		||||
#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6)
 | 
			
		||||
        ".set mips2\n\t"
 | 
			
		||||
#endif
 | 
			
		||||
        "ll %0, %2\n\t"
 | 
			
		||||
        "beqz %0, 1f\n\t"
 | 
			
		||||
        "addiu %1, %0, 1\n\t"
 | 
			
		||||
 
 | 
			
		||||
@@ -64,8 +64,8 @@ private:
 | 
			
		||||
    sp_counted_base( sp_counted_base const & );
 | 
			
		||||
    sp_counted_base & operator= ( sp_counted_base const & );
 | 
			
		||||
 | 
			
		||||
    std::atomic_int_least32_t use_count_;	// #shared
 | 
			
		||||
    std::atomic_int_least32_t weak_count_;	// #weak + (#shared != 0)
 | 
			
		||||
    std::atomic_int_least32_t use_count_;   // #shared
 | 
			
		||||
    std::atomic_int_least32_t weak_count_;  // #weak + (#shared != 0)
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,11 @@
 | 
			
		||||
// MinGW-w64 provides intrin.h for both 32 and 64-bit targets.
 | 
			
		||||
# define BOOST_SP_HAS_INTRIN_H
 | 
			
		||||
 | 
			
		||||
#elif defined( __LP64__ )
 | 
			
		||||
 | 
			
		||||
// We have to use intrin.h on Cygwin 64
 | 
			
		||||
# define BOOST_SP_HAS_INTRIN_H
 | 
			
		||||
 | 
			
		||||
// Intel C++ on Windows on VC10+ stdlib
 | 
			
		||||
#elif defined( BOOST_INTEL_WIN ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -60,18 +60,24 @@ namespace detail
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME
 | 
			
		||||
#if !BOOST_COMP_CLANG || !defined __MINGW32__
 | 
			
		||||
  extern "C" void __stdcall Sleep( unsigned long ms );
 | 
			
		||||
 | 
			
		||||
#if defined(__clang__) && defined(__x86_64__)
 | 
			
		||||
// clang x64 warns that __stdcall is ignored
 | 
			
		||||
# define BOOST_SP_STDCALL
 | 
			
		||||
#else
 | 
			
		||||
#include <_mingw.h>
 | 
			
		||||
#if !defined __MINGW64_VERSION_MAJOR
 | 
			
		||||
  extern "C" void __stdcall Sleep( unsigned long ms );
 | 
			
		||||
# define BOOST_SP_STDCALL __stdcall
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(__LP64__) // Cygwin 64
 | 
			
		||||
  extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned int ms );
 | 
			
		||||
#else
 | 
			
		||||
  extern "C" __declspec(dllimport) void __stdcall Sleep( unsigned long ms );
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
  extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned long ms );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#undef BOOST_SP_STDCALL
 | 
			
		||||
 | 
			
		||||
#endif // !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME
 | 
			
		||||
 | 
			
		||||
inline void yield( unsigned k )
 | 
			
		||||
{
 | 
			
		||||
    if( k < 4 )
 | 
			
		||||
 
 | 
			
		||||
@@ -239,9 +239,9 @@ public:
 | 
			
		||||
 | 
			
		||||
    template< class Y, class D >
 | 
			
		||||
    local_shared_ptr( boost::movelib::unique_ptr< Y, D > r ); // !
 | 
			
		||||
    //	: px( r.get() ), pn( new boost::detail::local_counted_impl( shared_ptr<T>( std::move(r) ) ) )
 | 
			
		||||
    //  : px( r.get() ), pn( new boost::detail::local_counted_impl( shared_ptr<T>( std::move(r) ) ) )
 | 
			
		||||
    //{
 | 
			
		||||
    //	boost::detail::sp_assert_convertible< Y, T >();
 | 
			
		||||
    //    boost::detail::sp_assert_convertible< Y, T >();
 | 
			
		||||
    //}
 | 
			
		||||
 | 
			
		||||
    // copy constructor
 | 
			
		||||
 
 | 
			
		||||
@@ -1080,7 +1080,7 @@ template<class T> shared_ptr<T> atomic_load( shared_ptr<T> const * p ) BOOST_SP_
 | 
			
		||||
    return *p;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<class T> inline shared_ptr<T> atomic_load_explicit( shared_ptr<T> const * p, /*memory_order mo*/ int ) BOOST_SP_NOEXCEPT
 | 
			
		||||
template<class T, class M> inline shared_ptr<T> atomic_load_explicit( shared_ptr<T> const * p, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
{
 | 
			
		||||
    return atomic_load( p );
 | 
			
		||||
}
 | 
			
		||||
@@ -1091,7 +1091,7 @@ template<class T> void atomic_store( shared_ptr<T> * p, shared_ptr<T> r ) BOOST_
 | 
			
		||||
    p->swap( r );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<class T> inline void atomic_store_explicit( shared_ptr<T> * p, shared_ptr<T> r, /*memory_order mo*/ int ) BOOST_SP_NOEXCEPT
 | 
			
		||||
template<class T, class M> inline void atomic_store_explicit( shared_ptr<T> * p, shared_ptr<T> r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
{
 | 
			
		||||
    atomic_store( p, r ); // std::move( r )
 | 
			
		||||
}
 | 
			
		||||
@@ -1107,7 +1107,7 @@ template<class T> shared_ptr<T> atomic_exchange( shared_ptr<T> * p, shared_ptr<T
 | 
			
		||||
    return r; // return std::move( r )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<class T> shared_ptr<T> inline atomic_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> r, /*memory_order mo*/ int ) BOOST_SP_NOEXCEPT
 | 
			
		||||
template<class T, class M> shared_ptr<T> inline atomic_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
{
 | 
			
		||||
    return atomic_exchange( p, r ); // std::move( r )
 | 
			
		||||
}
 | 
			
		||||
@@ -1137,7 +1137,7 @@ template<class T> bool atomic_compare_exchange( shared_ptr<T> * p, shared_ptr<T>
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w, /*memory_order success*/ int, /*memory_order failure*/ int ) BOOST_SP_NOEXCEPT
 | 
			
		||||
template<class T, class M> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w, /*memory_order success*/ M, /*memory_order failure*/ M ) BOOST_SP_NOEXCEPT
 | 
			
		||||
{
 | 
			
		||||
    return atomic_compare_exchange( p, v, w ); // std::move( w )
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								test/Jamfile
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								test/Jamfile
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
			
		||||
#  Boost.SmartPtr Library test Jamfile
 | 
			
		||||
#
 | 
			
		||||
#  Copyright (c) 2003-2017 Peter Dimov
 | 
			
		||||
#  Copyright (c) 2003-2018 Peter Dimov
 | 
			
		||||
#  Copyright (c) 2003 Dave Abrahams
 | 
			
		||||
#
 | 
			
		||||
#  Distributed under the Boost Software License, Version 1.0. (See
 | 
			
		||||
@@ -51,7 +51,11 @@ run yield_k_test.cpp : : : <threading>multi : yield_k_test.mt ;
 | 
			
		||||
run spinlock_test.cpp ;
 | 
			
		||||
run spinlock_try_test.cpp ;
 | 
			
		||||
run spinlock_try_test.cpp : : : <threading>multi : spinlock_try_test.mt ;
 | 
			
		||||
run spinlock_pool_test.cpp ;
 | 
			
		||||
run spinlock_pool_test.cpp : : :
 | 
			
		||||
    # msvc-8.0, 9.0 optimizer codegen bug for `x % 41`
 | 
			
		||||
    <toolset>msvc-8.0,<variant>release:<build>no
 | 
			
		||||
    <toolset>msvc-9.0,<variant>release:<build>no ;
 | 
			
		||||
 | 
			
		||||
run make_shared_test.cpp ;
 | 
			
		||||
run make_shared_move_emulation_test.cpp ;
 | 
			
		||||
run make_shared_perfect_forwarding_test.cpp ;
 | 
			
		||||
@@ -68,7 +72,7 @@ run sp_recursive_assign_test.cpp ;
 | 
			
		||||
run sp_recursive_assign2_test.cpp ;
 | 
			
		||||
run sp_recursive_assign_rv_test.cpp ;
 | 
			
		||||
run sp_recursive_assign2_rv_test.cpp ;
 | 
			
		||||
compile-fail auto_ptr_lv_fail.cpp ;
 | 
			
		||||
compile-fail auto_ptr_lv_fail.cpp : <toolset>gcc-4.4.7:<build>no ;
 | 
			
		||||
run atomic_count_test2.cpp ;
 | 
			
		||||
run sp_typeinfo_test.cpp ;
 | 
			
		||||
compile make_shared_fp_test.cpp ;
 | 
			
		||||
@@ -149,13 +153,13 @@ compile-fail array_fail_member_access.cpp ;
 | 
			
		||||
compile-fail array_fail_array_access.cpp ;
 | 
			
		||||
 | 
			
		||||
run make_shared_array_test.cpp ;
 | 
			
		||||
run make_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
 | 
			
		||||
run make_shared_arrays_test.cpp ; # <cxxflags>-fno-deduce-init-list no longer needed for gcc-4.6
 | 
			
		||||
run make_shared_array_throws_test.cpp ;
 | 
			
		||||
run make_shared_array_esft_test.cpp ;
 | 
			
		||||
run make_shared_array_noinit_test.cpp ;
 | 
			
		||||
run make_shared_array_value_test.cpp ;
 | 
			
		||||
run allocate_shared_array_test.cpp ;
 | 
			
		||||
run allocate_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
 | 
			
		||||
run allocate_shared_arrays_test.cpp ; # <cxxflags>-fno-deduce-init-list no longer needed for gcc-4.6
 | 
			
		||||
run allocate_shared_array_throws_test.cpp ;
 | 
			
		||||
run allocate_shared_array_esft_test.cpp ;
 | 
			
		||||
run allocate_shared_array_noinit_test.cpp ;
 | 
			
		||||
@@ -164,7 +168,7 @@ run allocate_shared_array_construct_test.cpp ;
 | 
			
		||||
 | 
			
		||||
run make_unique_test.cpp ;
 | 
			
		||||
run make_unique_args_test.cpp ;
 | 
			
		||||
run make_unique_value_test.cpp ;
 | 
			
		||||
run make_unique_value_test.cpp : : : <toolset>gcc-4.6:<cxxflags>-fno-deduce-init-list ;
 | 
			
		||||
run make_unique_noinit_test.cpp ;
 | 
			
		||||
run make_unique_throws_test.cpp ;
 | 
			
		||||
run make_unique_array_test.cpp ;
 | 
			
		||||
@@ -266,3 +270,9 @@ run lsp_convertible_test.cpp ;
 | 
			
		||||
run lsp_convertible_test2.cpp ;
 | 
			
		||||
 | 
			
		||||
run make_shared_array_tmp_test.cpp ;
 | 
			
		||||
 | 
			
		||||
run lw_thread_test.cpp : : : <threading>multi ;
 | 
			
		||||
 | 
			
		||||
compile sp_windows_h_test.cpp ;
 | 
			
		||||
compile spinlock_windows_h_test.cpp ;
 | 
			
		||||
compile yield_k_windows_h_test.cpp ;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
//
 | 
			
		||||
// atomic_sp_constexpr_test.cpp
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2017 Peter Dimov
 | 
			
		||||
// Copyright 2017, 2018 Peter Dimov
 | 
			
		||||
//
 | 
			
		||||
// Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
// See accompanying file LICENSE_1_0.txt or copy at
 | 
			
		||||
@@ -9,32 +9,37 @@
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
#include <boost/detail/workaround.hpp>
 | 
			
		||||
 | 
			
		||||
#define HAVE_CONSTEXPR_INIT
 | 
			
		||||
#include <boost/config/workaround.hpp>
 | 
			
		||||
#include <boost/config/pragma_message.hpp>
 | 
			
		||||
#include <boost/config/helper_macros.hpp>
 | 
			
		||||
 | 
			
		||||
#if defined( BOOST_NO_CXX11_CONSTEXPR )
 | 
			
		||||
# undef HAVE_CONSTEXPR_INIT
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 )
 | 
			
		||||
# undef HAVE_CONSTEXPR_INIT
 | 
			
		||||
#endif
 | 
			
		||||
BOOST_PRAGMA_MESSAGE("Skipping test due to BOOST_NO_CXX11_CONSTEXPR")
 | 
			
		||||
int main() {}
 | 
			
		||||
 | 
			
		||||
#if defined(__clang__) && defined( BOOST_NO_CXX14_CONSTEXPR )
 | 
			
		||||
# undef HAVE_CONSTEXPR_INIT
 | 
			
		||||
#endif
 | 
			
		||||
#elif BOOST_WORKAROUND( BOOST_MSVC, < 1920 )
 | 
			
		||||
 | 
			
		||||
// MSVC does not implement static initialization for constexpr
 | 
			
		||||
BOOST_PRAGMA_MESSAGE("Skipping test due to BOOST_MSVC < 1920")
 | 
			
		||||
int main() {}
 | 
			
		||||
 | 
			
		||||
#elif defined(__clang__) && defined( BOOST_NO_CXX14_CONSTEXPR )
 | 
			
		||||
 | 
			
		||||
// Clang only implements static initialization for constexpr in C++14 mode
 | 
			
		||||
BOOST_PRAGMA_MESSAGE("Skipping test due to __clang__ and BOOST_NO_CXX14_CONSTEXPR")
 | 
			
		||||
int main() {}
 | 
			
		||||
 | 
			
		||||
#elif defined( _LIBCPP_VERSION ) && ( _LIBCPP_VERSION < 6000 )
 | 
			
		||||
 | 
			
		||||
#if defined( _LIBCPP_VERSION ) && ( _LIBCPP_VERSION < 5000 )
 | 
			
		||||
// in libc++, atomic_flag has a non-constexpr constructor from bool
 | 
			
		||||
# undef HAVE_CONSTEXPR_INIT
 | 
			
		||||
#endif
 | 
			
		||||
BOOST_PRAGMA_MESSAGE("Skipping test due to _LIBCPP_VERSION " BOOST_STRINGIZE(_LIBCPP_VERSION))
 | 
			
		||||
int main() {}
 | 
			
		||||
 | 
			
		||||
#if !defined( HAVE_CONSTEXPR_INIT ) || defined( BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX )
 | 
			
		||||
#elif defined( BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX )
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
BOOST_PRAGMA_MESSAGE("Skipping test due to BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX")
 | 
			
		||||
int main() {}
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
@@ -69,4 +74,4 @@ int main()
 | 
			
		||||
    return boost::report_errors();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // #if defined( BOOST_NO_CXX11_CONSEXPR )
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								test/lw_thread_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								test/lw_thread_test.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
 | 
			
		||||
// lw_thread_test.cpp
 | 
			
		||||
//
 | 
			
		||||
// Copyright 2018 Peter Dimov
 | 
			
		||||
// Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
 | 
			
		||||
#include <boost/detail/lightweight_thread.hpp>
 | 
			
		||||
#include <boost/detail/lightweight_test.hpp>
 | 
			
		||||
#include <boost/smart_ptr/detail/atomic_count.hpp>
 | 
			
		||||
 | 
			
		||||
boost::detail::atomic_count count( 0 );
 | 
			
		||||
 | 
			
		||||
void f()
 | 
			
		||||
{
 | 
			
		||||
    ++count;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
    int const N = 4;
 | 
			
		||||
    boost::detail::lw_thread_t th[ N ] = {};
 | 
			
		||||
 | 
			
		||||
    for( int i = 0; i < N; ++i )
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::lw_thread_create( th[ i ], f );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for( int i = 0; i < N; ++i )
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::lw_thread_join( th[ i ] );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    BOOST_TEST_EQ( count, N );
 | 
			
		||||
 | 
			
		||||
    return boost::report_errors();
 | 
			
		||||
}
 | 
			
		||||
@@ -14,6 +14,8 @@
 | 
			
		||||
//  20 Jul 99  header name changed to .hpp
 | 
			
		||||
//  20 Apr 99  additional error tests added.
 | 
			
		||||
 | 
			
		||||
#define _CRT_SECURE_NO_WARNINGS
 | 
			
		||||
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
 | 
			
		||||
#if defined(BOOST_MSVC)
 | 
			
		||||
 
 | 
			
		||||
@@ -13,9 +13,20 @@
 | 
			
		||||
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
 | 
			
		||||
#include <boost/detail/lightweight_test.hpp>
 | 
			
		||||
 | 
			
		||||
#ifndef __LP64__
 | 
			
		||||
 | 
			
		||||
typedef long long_type;
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
// On Cygwin 64, long is 64 bit
 | 
			
		||||
typedef int long_type;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
    long x = 0, r;
 | 
			
		||||
    long_type x = 0, r;
 | 
			
		||||
 | 
			
		||||
    r = BOOST_SP_INTERLOCKED_INCREMENT( &x );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								test/sp_windows_h_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/sp_windows_h_test.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
// Copyright 2018 Peter Dimov
 | 
			
		||||
// Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 | 
			
		||||
# include <windows.h>
 | 
			
		||||
# include <boost/shared_ptr.hpp>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								test/spinlock_windows_h_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/spinlock_windows_h_test.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
// Copyright 2018 Peter Dimov
 | 
			
		||||
// Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 | 
			
		||||
# include <windows.h>
 | 
			
		||||
# include <boost/smart_ptr/detail/spinlock.hpp>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								test/yield_k_windows_h_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/yield_k_windows_h_test.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
// Copyright 2018 Peter Dimov
 | 
			
		||||
// Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 | 
			
		||||
# include <windows.h>
 | 
			
		||||
# include <boost/smart_ptr/detail/yield_k.hpp>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user