set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+if(CDS_BIN_ROOT)
+ set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CDS_BIN_ROOT})
+ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CDS_BIN_ROOT})
+else()
+ set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+endif()
+message(STATUS "Binary output path: ${EXECUTABLE_OUTPUT_PATH}")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Default build type to Debug" FORCE)
src/dllmain.cpp)
add_library(${CDS_SHARED_LIBRARY} SHARED ${SOURCES})
+set_target_properties( ${CDS_SHARED_LIBRARY} PROPERTIES VERSION ${PROJECT_VERSION})
add_library(${CDS_STATIC_LIBRARY} STATIC ${SOURCES})
-target_link_libraries(${CDS_SHARED_LIBRARY} PRIVATE ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
-target_link_libraries(${CDS_STATIC_LIBRARY} PRIVATE ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(${CDS_SHARED_LIBRARY} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(${CDS_STATIC_LIBRARY} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS ${CDS_SHARED_LIBRARY} DESTINATION lib COMPONENT ${LIBRARIES_COMPONENT})
install(TARGETS ${CDS_STATIC_LIBRARY} DESTINATION lib COMPONENT ${LIBRARIES_COMPONENT})
if(WITH_TESTS)
enable_testing()
+ add_subdirectory(${CMAKE_SOURCE_DIR}/test)
add_subdirectory(${CMAKE_SOURCE_DIR}/tests)
message(STATUS "Build tests: activated")
endif(WITH_TESTS)
typedef typename traits::stat stat; ///< Internal statistics
typedef typename traits::back_off back_off; ///< back-off strategy
+ /// How many Hazard pointers is required for Treiber's stack implementation
+ static CDS_CONSTEXPR size_t const c_nHazardPtrCount = 1;
+
public: // related to elimination back-off
/// Elimination back-off is enabled or not
/// Constructs empty stack and initializes elimination back-off data
/**
This form should be used if you use elimination back-off with dynamically allocated collision array, i.e
- \p Options... contains cds::opt::buffer< cds::opt::v::dynamic_buffer >.
+ \p Traits contains <tt>typedef cds::opt::v::dynamic_buffer buffer</tt>.
\p nCollisionCapacity parameter specifies the capacity of collision array.
*/
TreiberStack( size_t nCollisionCapacity )
{408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
EndProjectSection\r
EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdr-test-stack", "hdr-test-stack.vcxproj", "{E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}"\r
- ProjectSection(ProjectDependencies) = postProject\r
- {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81}\r
- {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
- EndProjectSection\r
-EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdr-test-striped-set", "hdr-test-striped-set.vcxproj", "{A38E5597-6916-4480-A343-C9846EF544E4}"\r
ProjectSection(ProjectDependencies) = postProject\r
{61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81}\r
{E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7}.Release|Win32.Build.0 = Release|Win32\r
{E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7}.Release|x64.ActiveCfg = Release|x64\r
{E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7}.Release|x64.Build.0 = Release|x64\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.Debug|Win32.ActiveCfg = Debug|Win32\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.Debug|Win32.Build.0 = Debug|Win32\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.Debug|x64.ActiveCfg = Debug|x64\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.Debug|x64.Build.0 = Debug|x64\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.DebugVLD|Win32.Build.0 = DebugVLD|Win32\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.DebugVLD|x64.ActiveCfg = DebugVLD|x64\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.DebugVLD|x64.Build.0 = DebugVLD|x64\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.Release|Win32.ActiveCfg = Release|Win32\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.Release|Win32.Build.0 = Release|Win32\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.Release|x64.ActiveCfg = Release|x64\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}.Release|x64.Build.0 = Release|x64\r
{A38E5597-6916-4480-A343-C9846EF544E4}.Debug|Win32.ActiveCfg = Debug|Win32\r
{A38E5597-6916-4480-A343-C9846EF544E4}.Debug|Win32.Build.0 = Debug|Win32\r
{A38E5597-6916-4480-A343-C9846EF544E4}.Debug|x64.ActiveCfg = Debug|x64\r
{90192F7D-5850-41DD-AE89-62D26B387162} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{33664E63-8D24-4FF4-A744-9782EB711509} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
- {E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{A38E5597-6916-4480-A343-C9846EF544E4} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{6F834EAD-7B94-4979-A0F1-A662E3D30145} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{20B6C380-E96A-4CFF-BC17-D88AAE581919} = {B30CA283-1796-4763-92C3-2E4848D443F7}\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="..\..\..\test\unit\stack\fcstack.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\stack\intrusive_fcstack.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\stack\intrusive_treiber_stack_dhp.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\stack\intrusive_treiber_stack_hp.cpp" />\r
<ClCompile Include="..\..\..\test\unit\stack\main.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\stack\treiber_stack_dhp.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\stack\treiber_stack_hp.cpp" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\test\unit\stack\test_intrusive_treiber_stack.h" />\r
+ <ClInclude Include="..\..\..\test\unit\stack\test_treiber_stack.h" />\r
</ItemGroup>\r
<PropertyGroup Label="Globals">\r
<ProjectGuid>{5407E9D2-67D9-4266-976E-7A90BDE2541D}</ProjectGuid>\r
<ClCompile Include="..\..\..\test\unit\stack\main.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\stack\intrusive_fcstack.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\stack\intrusive_treiber_stack_hp.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\stack\intrusive_treiber_stack_dhp.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\stack\treiber_stack_hp.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\stack\treiber_stack_dhp.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\test\unit\stack\test_intrusive_treiber_stack.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\test\unit\stack\test_treiber_stack.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="DebugVLD|Win32">\r
- <Configuration>DebugVLD</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="DebugVLD|x64">\r
- <Configuration>DebugVLD</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectGuid>{E3F2927A-6ED6-4B18-BDE6-B3B760E1AF18}</ProjectGuid>\r
- <RootNamespace>hdrteststack</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>MultiByte</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>MultiByte</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">false</LinkIncremental>\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_d</TargetName>\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_d</TargetName>\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">$(ProjectName)_d</TargetName>\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">$(ProjectName)_d</TargetName>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r
- <CallingConvention>Cdecl</CallingConvention>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <RandomizedBaseAddress>false</RandomizedBaseAddress>\r
- <DataExecutionPrevention>\r
- </DataExecutionPrevention>\r
- <TargetMachine>MachineX86</TargetMachine>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <CallingConvention>Cdecl</CallingConvention>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <RandomizedBaseAddress>false</RandomizedBaseAddress>\r
- <DataExecutionPrevention>\r
- </DataExecutionPrevention>\r
- <TargetMachine>MachineX64</TargetMachine>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Full</Optimization>\r
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
- <IntrinsicFunctions>true</IntrinsicFunctions>\r
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
- <OmitFramePointers>false</OmitFramePointers>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <StringPooling>true</StringPooling>\r
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
- <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <CallingConvention>Cdecl</CallingConvention>\r
- <EnablePREfast>false</EnablePREfast>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <OptimizeReferences>true</OptimizeReferences>\r
- <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
- <RandomizedBaseAddress>false</RandomizedBaseAddress>\r
- <DataExecutionPrevention>\r
- </DataExecutionPrevention>\r
- <TargetMachine>MachineX86</TargetMachine>\r
- <Profile>true</Profile>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Full</Optimization>\r
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
- <IntrinsicFunctions>true</IntrinsicFunctions>\r
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
- <OmitFramePointers>false</OmitFramePointers>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <StringPooling>true</StringPooling>\r
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <CallingConvention>Cdecl</CallingConvention>\r
- <EnablePREfast>false</EnablePREfast>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <OptimizeReferences>true</OptimizeReferences>\r
- <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>\r
- <RandomizedBaseAddress>false</RandomizedBaseAddress>\r
- <DataExecutionPrevention>\r
- </DataExecutionPrevention>\r
- <TargetMachine>MachineX64</TargetMachine>\r
- <Profile>true</Profile>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r
- <CallingConvention>Cdecl</CallingConvention>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <RandomizedBaseAddress>false</RandomizedBaseAddress>\r
- <DataExecutionPrevention>\r
- </DataExecutionPrevention>\r
- <TargetMachine>MachineX86</TargetMachine>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <CallingConvention>Cdecl</CallingConvention>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <RandomizedBaseAddress>false</RandomizedBaseAddress>\r
- <DataExecutionPrevention>\r
- </DataExecutionPrevention>\r
- <TargetMachine>MachineX64</TargetMachine>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClInclude Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_treiber_stack.h" />\r
- <ClInclude Include="..\..\..\tests\test-hdr\stack\hdr_treiber_stack.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_elimination_stack_dhp.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_elimination_stack_hp.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_fcstack.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_elimination_stack_dhp.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_elimination_stack_hp.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_fcstack.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_treiber_stack_dhp.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_treiber_stack_hp.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_treiber_stack_dhp.cpp" />\r
- <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_treiber_stack_hp.cpp" />\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-\r
- CDS_LIBRARY_VERSION := 2.2.0\r
- LOCAL_PATH := $(call my-dir)\r
- CDS_ROOT_DIR = $(LOCAL_PATH)/../../..\r
-\r
- BOOST_LIBS := -lboost_thread -lboost_system\r
- BOOST_LIB_PATH := $(BOOST_ROOT)/stage32-android/lib\r
-\r
- CDS_TESTHDR_INCLUDE := $(LOCAL_PATH)/../../.. \\r
- $(LOCAL_PATH)/../../../tests \\r
- $(LOCAL_PATH)/../../../tests/test-hdr \\r
- $(BOOST_ROOT)\r
-# libcds\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := cds\r
- LOCAL_MODULE_FILENAME = libcds-$(CDS_LIBRARY_VERSION)\r
- include $(CDS_ROOT_DIR)/projects/source.libcds.mk\r
- LOCAL_SRC_FILES := $(CDS_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../.. $(BOOST_ROOT)\r
- LOCAL_CPP_FEATURES := exceptions\r
-\r
- include $(BUILD_SHARED_LIBRARY)\r
-\r
-#test-hdr-map\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-map\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_MAP:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_MAP:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
-\r
-#test-hdr-deque\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-deque\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_DEQUE:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_DEQUE:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
-\r
-#test-hdr-ordlist\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-ordlist\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_ORDLIST:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_ORDLIST:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
-\r
-#test-hdr-pqueue\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-pqueue\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_PQUEUE:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
-# LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_PQUEUE:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
-\r
-#test-hdr-queue\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-queue\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_QUEUE:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_QUEUE:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
-\r
-#test-hdr-set\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-set\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_SET:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_SET:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
-\r
-#test-hdr-stack\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-stack\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_STACK:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_STACK:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
-\r
-#test-hdr-tree\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-tree\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_TREE:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_TREE:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
-\r
-#test-hdr-misc\r
- include $(CLEAR_VARS)\r
-\r
- LOCAL_MODULE := test-hdr-misc\r
- include $(CDS_ROOT_DIR)/projects/source.test-common.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.mk\r
- include $(CDS_ROOT_DIR)/projects/source.test-hdr.offsetof.mk\r
- LOCAL_SRC_FILES := $(CDS_TESTCOMMON_SOURCES:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_SRC_FILES += $(CDS_TESTHDR_MISC:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
-# LOCAL_SRC_FILES += $(CDS_TESTHDR_OFFSETOF_MISC:%.cpp=$(CDS_ROOT_DIR)/%.cpp)\r
- LOCAL_C_INCLUDES := $(CDS_TESTHDR_INCLUDE)\r
- LOCAL_SHARED_LIBRARIES := cds\r
- LOCAL_CPP_FEATURES := exceptions\r
- LOCAL_CPPFLAGS := -Wno-invalid-offsetof -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS\r
- LOCAL_LDLIBS := $(BOOST_LIBS)\r
- LOCAL_LDFLAGS := -L$(BOOST_LIB_PATH)\r
- include $(BUILD_EXECUTABLE)\r
+++ /dev/null
-
-APP_MODULES := cds test-hdr-map test-hdr-deque test-hdr-ordlist test_hdr_pqueue
-APP_MODULES += test-hdr-queue test-hdr-set test-hdr-stack test-hdr-tree test-hdr-misc
-APP_ABI := armeabi-v7a
-APP_OPTIM := debug
-APP_STL := gnustl_shared
-APP_CPPFLAGS := -std=c++0x -frtti -pedantic -Wall -Wno-unused-local-typedefs
-#APP_LDFLAGS :=
-APP_GNUSTL_FORCE_CPP_FEATURES := exceptions
-NDK_TOOLCHAIN_VERSION := 4.8
+++ /dev/null
-#!/bin/sh
-
-BOOST_ROOT=~/works/libs/boost_1_53_0 $NDK/ndk-build -j 1 2>&1 |tee arm-build.log
tests/test-hdr/set/hdr_striped_hashset_slist.cpp \
tests/test-hdr/set/hdr_striped_hashset_vector.cpp
-CDS_TESTHDR_STACK := \
- tests/test-hdr/stack/hdr_intrusive_fcstack.cpp \
- tests/test-hdr/stack/hdr_treiber_stack_hp.cpp \
- tests/test-hdr/stack/hdr_treiber_stack_dhp.cpp \
- tests/test-hdr/stack/hdr_elimination_stack_hp.cpp \
- tests/test-hdr/stack/hdr_elimination_stack_dhp.cpp \
- tests/test-hdr/stack/hdr_fcstack.cpp
-
CDS_TESTHDR_TREE := \
tests/test-hdr/tree/hdr_tree_reg.cpp \
tests/test-hdr/tree/hdr_intrusive_ellen_bintree_hp.cpp \
CDS_TESTHDR_SOURCES := \
$(CDS_TESTHDR_QUEUE) \
$(CDS_TESTHDR_PQUEUE) \
- $(CDS_TESTHDR_STACK) \
$(CDS_TESTHDR_MAP) \
$(CDS_TESTHDR_DEQUE) \
$(CDS_TESTHDR_LIST) \
--- /dev/null
+
+find_package(GTest REQUIRED)
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${GTEST_INCLUDE_DIRS}
+)
+
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit)
--- /dev/null
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stack)
--- /dev/null
+set(PACKAGE_NAME unit-stack)
+
+set(CDSGTEST_STACK_SOURCES
+ fcstack.cpp
+ intrusive_fcstack.cpp
+ intrusive_treiber_stack_dhp.cpp
+ intrusive_treiber_stack_hp.cpp
+ main.cpp
+ treiber_stack_dhp.cpp
+ treiber_stack_hp.cpp
+)
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+add_executable(${PACKAGE_NAME} ${CDSGTEST_STACK_SOURCES})
+target_link_libraries(${PACKAGE_NAME}
+ ${CDS_SHARED_LIBRARY}
+ ${GTEST_LIBRARY}
+ ${Boost_THREAD_LIBRARY}
+ ${Boost_SYSTEM_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+)
+
+add_test(NAME ${PACKAGE_NAME} COMMAND ${PACKAGE_NAME} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
\ No newline at end of file
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <gtest/gtest.h>
+#include <cds/intrusive/fcstack.h>
+
+#include <boost/intrusive/list.hpp>
+
+namespace {
+ class IntrusiveFCStack : public ::testing::Test
+ {
+ protected:
+ template <typename Hook>
+ struct base_hook_item : public Hook
+ {
+ int nVal;
+ int nDisposeCount;
+
+ base_hook_item()
+ : nDisposeCount( 0 )
+ {}
+ };
+
+ template <typename Hook>
+ struct member_hook_item
+ {
+ int nVal;
+ int nDisposeCount;
+ Hook hMember;
+
+ member_hook_item()
+ : nDisposeCount( 0 )
+ {}
+ };
+
+ struct mock_disposer
+ {
+ template <typename T>
+ void operator ()( T * p )
+ {
+ ++p->nDisposeCount;
+ }
+ };
+
+ template <class Stack>
+ void test()
+ {
+ typedef typename Stack::value_type value_type;
+ Stack stack;
+
+ ASSERT_TRUE( stack.empty() );
+
+ value_type v1, v2, v3;
+ v1.nVal = 1;
+ v2.nVal = 2;
+ v3.nVal = 3;
+ ASSERT_TRUE( stack.push( v1 ) );
+ ASSERT_TRUE( !stack.empty() );
+ ASSERT_TRUE( stack.push( v2 ) );
+ ASSERT_TRUE( !stack.empty() );
+ ASSERT_TRUE( stack.push( v3 ) );
+ ASSERT_TRUE( !stack.empty() );
+
+ value_type * pv;
+ pv = stack.pop();
+ ASSERT_TRUE( pv != nullptr );
+ ASSERT_EQ( pv->nVal, 3 );
+ ASSERT_TRUE( !stack.empty() );
+ pv = stack.pop();
+ ASSERT_TRUE( pv != nullptr );
+ ASSERT_EQ( pv->nVal, 2 );
+ ASSERT_TRUE( !stack.empty() );
+ pv = stack.pop();
+ ASSERT_TRUE( pv != nullptr );
+ ASSERT_EQ( pv->nVal, 1 );
+ ASSERT_TRUE( stack.empty() );
+ pv = stack.pop();
+ ASSERT_TRUE( pv == nullptr );
+ ASSERT_TRUE( stack.empty() );
+
+ if ( !std::is_same<typename Stack::disposer, cds::intrusive::opt::v::empty_disposer>::value ) {
+ int v1disp = v1.nDisposeCount;
+ int v2disp = v2.nDisposeCount;
+ int v3disp = v3.nDisposeCount;
+
+ ASSERT_TRUE( stack.push( v1 ));
+ ASSERT_TRUE( stack.push( v2 ));
+ ASSERT_TRUE( stack.push( v3 ));
+
+ stack.clear();
+ ASSERT_TRUE( stack.empty() );
+
+ EXPECT_EQ( v1.nDisposeCount, v1disp);
+ EXPECT_EQ( v2.nDisposeCount, v2disp);
+ EXPECT_EQ( v3.nDisposeCount, v3disp);
+
+ ASSERT_TRUE( stack.push( v1 ) );
+ ASSERT_TRUE( stack.push( v2 ) );
+ ASSERT_TRUE( stack.push( v3 ) );
+ ASSERT_TRUE( !stack.empty() );
+
+ stack.clear( true );
+ ASSERT_TRUE( stack.empty() );
+
+ EXPECT_EQ( v1.nDisposeCount, v1disp + 1 );
+ EXPECT_EQ( v2.nDisposeCount, v2disp + 1 );
+ EXPECT_EQ( v3.nDisposeCount, v3disp + 1 );
+ }
+ }
+ };
+
+ TEST_F( IntrusiveFCStack, slist )
+ {
+ typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type > > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_disposer )
+ {
+ typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
+ struct stack_traits : public cds::intrusive::fcstack::traits
+ {
+ typedef mock_disposer disposer;
+ };
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type >, stack_traits > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_mutex )
+ {
+ typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
+ struct stack_traits : public cds::intrusive::fcstack::traits
+ {
+ typedef std::mutex lock_type;
+ };
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type >, stack_traits > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_elimination )
+ {
+ typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
+ struct stack_traits : public
+ cds::intrusive::fcstack::make_traits <
+ cds::opt::enable_elimination < true >
+ > ::type
+ {};
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type >, stack_traits > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_elimination_disposer )
+ {
+ typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
+ struct stack_traits : public
+ cds::intrusive::fcstack::make_traits <
+ cds::opt::enable_elimination < true >,
+ cds::intrusive::opt::disposer< mock_disposer >
+ > ::type
+ {};
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type >, stack_traits > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_elimination_stat )
+ {
+ typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type >,
+ cds::intrusive::fcstack::make_traits<
+ cds::opt::enable_elimination< true >
+ , cds::opt::stat< cds::intrusive::fcstack::stat<> >
+ >::type
+ > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_member )
+ {
+ typedef member_hook_item< boost::intrusive::slist_member_hook<> > value_type;
+ typedef boost::intrusive::member_hook<value_type, boost::intrusive::slist_member_hook<>, &value_type::hMember> member_option;
+
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type, member_option > > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_member_disposer )
+ {
+ typedef member_hook_item< boost::intrusive::slist_member_hook<> > value_type;
+ typedef boost::intrusive::member_hook<value_type, boost::intrusive::slist_member_hook<>, &value_type::hMember> member_option;
+ struct stack_traits : public cds::intrusive::fcstack::traits
+ {
+ typedef mock_disposer disposer;
+ };
+
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type, member_option >, stack_traits > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_member_elimination )
+ {
+ typedef member_hook_item< boost::intrusive::slist_member_hook<> > value_type;
+ typedef boost::intrusive::member_hook<value_type, boost::intrusive::slist_member_hook<>, &value_type::hMember> member_option;
+
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type, member_option >,
+ cds::intrusive::fcstack::make_traits<
+ cds::opt::enable_elimination< true >
+ >::type
+ > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, slist_member_elimination_stat )
+ {
+ typedef member_hook_item< boost::intrusive::slist_member_hook<> > value_type;
+ typedef boost::intrusive::member_hook<value_type, boost::intrusive::slist_member_hook<>, &value_type::hMember> member_option;
+
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type, member_option >,
+ cds::intrusive::fcstack::make_traits<
+ cds::opt::enable_elimination< true >
+ , cds::opt::stat< cds::intrusive::fcstack::stat<> >
+ >::type
+ > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, list )
+ {
+ typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type;
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type > > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, list_mutex )
+ {
+ typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type;
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type >,
+ cds::intrusive::fcstack::make_traits<
+ cds::opt::lock_type< std::mutex >
+ >::type
+ > stack_type;
+ test<stack_type>();
+ }
+
+
+ TEST_F( IntrusiveFCStack, list_elimination )
+ {
+ typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type;
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type >,
+ cds::intrusive::fcstack::make_traits<
+ cds::opt::enable_elimination< true >
+ >::type
+ > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, list_elimination_stat )
+ {
+ typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type;
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type >,
+ cds::intrusive::fcstack::make_traits<
+ cds::opt::enable_elimination< true >
+ , cds::opt::stat< cds::intrusive::fcstack::stat<> >
+ >::type
+ > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, list_member )
+ {
+ typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type;
+ typedef boost::intrusive::member_hook<value_type, boost::intrusive::list_member_hook<>, &value_type::hMember> member_option;
+
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type, member_option > > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, list_member_elimination )
+ {
+ typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type;
+ typedef boost::intrusive::member_hook<value_type, boost::intrusive::list_member_hook<>, &value_type::hMember> member_option;
+
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type, member_option >,
+ cds::intrusive::fcstack::make_traits<
+ cds::opt::enable_elimination< true >
+ >::type
+ > stack_type;
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveFCStack, list_member_elimination_stat )
+ {
+ typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type;
+ typedef boost::intrusive::member_hook<value_type, boost::intrusive::list_member_hook<>, &value_type::hMember> member_option;
+
+ typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type, member_option >,
+ cds::intrusive::fcstack::make_traits<
+ cds::opt::enable_elimination< true >
+ , cds::opt::stat< cds::intrusive::fcstack::stat<> >
+ >::type
+ > stack_type;
+ test<stack_type>();
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+\r
+#include "test_intrusive_treiber_stack.h"\r
+\r
+#include <cds/gc/dhp.h>\r
+#include <cds/intrusive/treiber_stack.h>\r
+\r
+namespace {\r
+\r
+ namespace ci = cds::intrusive;\r
+\r
+ class IntrusiveTreiberStack_DHP : public cds_gtest::IntrusiveTreiberStack\r
+ {\r
+ typedef cds_gtest::IntrusiveTreiberStack base_class;\r
+ protected:\r
+ typedef cds::gc::DHP gc_type;\r
+\r
+ void SetUp()\r
+ {\r
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ ci::opt::hook<
+ ci::treiber_stack::base_hook<
+ ci::opt::gc<gc_type>
+ >
+ >
+ >::type
+ > stack_type;
+\r
+ cds::gc::dhp::GarbageCollector::Construct( 16, stack_type::c_nHazardPtrCount );\r
+ cds::threading::Manager::attachThread();\r
+ }\r
+\r
+ void TearDown()\r
+ {\r
+ cds::threading::Manager::detachThread();\r
+ cds::gc::dhp::GarbageCollector::Destruct();\r
+ }\r
+\r
+ template <typename Stack>\r
+ void test()\r
+ {\r
+ Stack stack;\r
+ base_class::test( stack );\r
+ }\r
+\r
+ template <typename Stack>\r
+ void test_dyn( size_t elimination_size )\r
+ {\r
+ Stack stack( elimination_size );\r
+ base_class::test( stack );\r
+ }\r
+ };\r
+\r
+ TEST_F( IntrusiveTreiberStack_DHP, base )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ ci::opt::hook<
+ ci::treiber_stack::base_hook<
+ ci::opt::gc<gc_type>
+ >
+ >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_DHP, base_disposer )
+ {
+ struct traits:
+ ci::treiber_stack::make_traits <
+ ci::opt::hook<
+ ci::treiber_stack::base_hook< ci::opt::gc<gc_type>>
+ >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ {};
+ typedef cds::intrusive::TreiberStack<
+ gc_type,
+ base_hook_item<gc_type>,
+ traits
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_DHP, member )
+ {
+ struct traits
+ : ci::treiber_stack::make_traits <
+ ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ > ::type
+ {};
+ typedef cds::intrusive::TreiberStack<
+ gc_type,
+ member_hook_item<gc_type>,
+ traits
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_DHP, member_disposer )
+ {
+ struct traits
+ : ci::treiber_stack::make_traits <
+ ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ {};
+ typedef cds::intrusive::TreiberStack<
+ gc_type,
+ member_hook_item<gc_type>,
+ traits
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_DHP, relaxed )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+ ,ci::opt::hook<
+ ci::treiber_stack::base_hook<
+ ci::opt::gc<gc_type>
+ >
+ >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_DHP, elimination_base )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::base_hook<
+ ci::opt::gc<gc_type>
+ >
+ >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_DHP, elimination_base_dynamic )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::base_hook<
+ ci::opt::gc<gc_type>
+ >
+ >
+ ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+ >::type
+ > stack_type;
+
+ test_dyn<stack_type>( 2 );
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_DHP, elimination_base_disposer )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::base_hook< ci::opt::gc<gc_type> >
+ >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_DHP, elimination_member )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ member_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_DHP, elimination_member_dynamic )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ member_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+ >::type
+ > stack_type;
+
+ test_dyn<stack_type>( 2 );
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_DHP, elimination_member_disposer )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ member_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > stack_type;
+
+ test_dyn<stack_type>( 2 );
+ }
+\r
+} // namespace\r
+\r
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+\r
+#include "test_intrusive_treiber_stack.h"\r
+\r
+#include <cds/gc/hp.h>\r
+#include <cds/intrusive/treiber_stack.h>\r
+\r
+namespace {\r
+\r
+ namespace ci = cds::intrusive;\r
+ typedef cds::gc::HP gc_type;\r
+\r
+ class IntrusiveTreiberStack_HP : public cds_gtest::IntrusiveTreiberStack\r
+ {\r
+ typedef cds_gtest::IntrusiveTreiberStack base_class;\r
+\r
+ protected:\r
+ void SetUp()\r
+ {\r
+ typedef cds::intrusive::TreiberStack< gc_type, base_hook_item<gc_type>> stack_type;\r
+\r
+ cds::gc::hp::GarbageCollector::Construct( stack_type::c_nHazardPtrCount, 1, 16 );\r
+ cds::threading::Manager::attachThread();\r
+ }\r
+\r
+ void TearDown() \r
+ {\r
+ cds::threading::Manager::detachThread();\r
+ cds::gc::hp::GarbageCollector::Destruct( true );\r
+ }\r
+\r
+ template <typename Stack>\r
+ void test()\r
+ {\r
+ Stack stack;\r
+ base_class::test( stack );\r
+ }\r
+\r
+ template <typename Stack>\r
+ void test_dyn( size_t elimination_size )\r
+ {\r
+ Stack stack( elimination_size );\r
+ base_class::test( stack );\r
+ }\r
+ };\r
+\r
+ TEST_F( IntrusiveTreiberStack_HP, defaulted )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_HP, base )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ ci::opt::hook<
+ ci::treiber_stack::base_hook<
+ ci::opt::gc<gc_type>
+ >
+ >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_HP, base_disposer )
+ {
+ struct traits:
+ ci::treiber_stack::make_traits <
+ ci::opt::hook<
+ ci::treiber_stack::base_hook< ci::opt::gc<gc_type> >
+ >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ {};
+ typedef cds::intrusive::TreiberStack<
+ gc_type,
+ base_hook_item<gc_type>,
+ traits
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_HP, member )
+ {
+ struct traits
+ : ci::treiber_stack::make_traits <
+ ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ > ::type
+ {};
+ typedef cds::intrusive::TreiberStack<
+ gc_type,
+ member_hook_item<gc_type>,
+ traits
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_HP, member_disposer )
+ {
+ struct traits
+ : ci::treiber_stack::make_traits <
+ ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ {};
+ typedef cds::intrusive::TreiberStack<
+ gc_type,
+ member_hook_item<gc_type>,
+ traits
+ > stack_type;
+
+ test<stack_type>();
+ }
+
+ TEST_F( IntrusiveTreiberStack_HP, relaxed )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_HP, elimination )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_HP, elimination_base )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::base_hook<
+ ci::opt::gc<gc_type>
+ >
+ >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_HP, elimination_base_dynamic )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::base_hook<
+ ci::opt::gc<gc_type>
+ >
+ >
+ ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+ >::type
+ > stack_type;
+
+ test_dyn<stack_type>( 2 );
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_HP, elimination_base_disposer )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ base_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::base_hook< ci::opt::gc<gc_type> >
+ >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_HP, elimination_member )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ member_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_HP, elimination_member_dynamic )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ member_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+ >::type
+ > stack_type;
+
+ test_dyn<stack_type>( 2 );
+ }
+\r
+ TEST_F( IntrusiveTreiberStack_HP, elimination_member_disposer )
+ {
+ typedef cds::intrusive::TreiberStack< gc_type,
+ member_hook_item<gc_type>
+ , typename ci::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ ,ci::opt::hook<
+ ci::treiber_stack::member_hook<
+ offsetof( member_hook_item<gc_type>, hMember),
+ ci::opt::gc<gc_type>
+ >
+ >
+ ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > stack_type;
+
+ test_dyn<stack_type>( 2 );
+ }
+\r
+} // namespace\r
+\r
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef CDSUNIT_STACK_INTRUSIVE_TREIBER_STACK_H
+#define CDSUNIT_STACK_INTRUSIVE_TREIBER_STACK_H
+
+#include <gtest/gtest.h>
+#include <cds/intrusive/details/single_link_struct.h>
+
+namespace cds_gtest {
+
+ class IntrusiveTreiberStack : public ::testing::Test
+ {
+ protected:
+ template <typename GC>
+ struct base_hook_item : public cds::intrusive::single_link::node< GC >
+ {
+ int nVal;
+ int nDisposeCount;
+
+ base_hook_item()
+ : nDisposeCount( 0 )
+ {}
+ };
+
+ template <typename GC>
+ struct member_hook_item
+ {
+ int nVal;
+ int nDisposeCount;
+ cds::intrusive::single_link::node< GC > hMember;
+
+ member_hook_item()
+ : nDisposeCount( 0 )
+ {}
+ };
+
+ struct mock_disposer
+ {
+ template <typename T>
+ void operator ()( T * p )
+ {
+ ++p->nDisposeCount;
+ }
+ };
+
+ template <typename Stack>
+ void test( Stack& stack )
+ {
+ typedef typename Stack::value_type value_type;
+
+ ASSERT_TRUE( stack.empty() );
+
+ value_type v1, v2, v3;
+ v1.nVal = 1;
+ v2.nVal = 2;
+ v3.nVal = 3;
+ ASSERT_TRUE( stack.push( v1 ) );
+ ASSERT_TRUE( !stack.empty() );
+ ASSERT_TRUE( stack.push( v2 ) );
+ ASSERT_TRUE( !stack.empty() );
+ ASSERT_TRUE( stack.push( v3 ) );
+ ASSERT_TRUE( !stack.empty() );
+
+ value_type * pv;
+ pv = stack.pop();
+ ASSERT_NE( pv, nullptr );
+ ASSERT_EQ( pv, &v3 );
+ ASSERT_EQ( pv->nVal, 3 );
+ ASSERT_TRUE( !stack.empty() );
+ pv = stack.pop();
+ ASSERT_NE( pv, nullptr );
+ ASSERT_EQ( pv, &v2 );
+ ASSERT_EQ( pv->nVal, 2 );
+ ASSERT_TRUE( !stack.empty() );
+ pv = stack.pop();
+ ASSERT_NE( pv, nullptr );
+ ASSERT_EQ( pv, &v1 );
+ ASSERT_EQ( pv->nVal, 1 );
+ ASSERT_TRUE( stack.empty() );
+ pv = stack.pop();
+ ASSERT_EQ( pv, nullptr );
+ ASSERT_TRUE( stack.empty() );
+
+ ASSERT_EQ( v1.nDisposeCount, 0 );
+ ASSERT_EQ( v2.nDisposeCount, 0 );
+ ASSERT_EQ( v3.nDisposeCount, 0 );
+
+ stack.push( v1 );
+ stack.push( v2 );
+ stack.push( v3 );
+
+ stack.clear();
+ ASSERT_TRUE( stack.empty() );
+
+ Stack::gc::scan();
+ if ( !std::is_same<typename Stack::disposer, cds::intrusive::opt::v::empty_disposer>::value ) {
+ ASSERT_EQ( v1.nDisposeCount, 1 );
+ ASSERT_EQ( v2.nDisposeCount, 1 );
+ ASSERT_EQ( v3.nDisposeCount, 1 );
+ }
+ }
+ };
+
+} // namespace cds_gtest
+
+#endif // CDSUNIT_STACK_INTRUSIVE_TREIBER_STACK_H
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef CDSUNIT_STACK_TREIBER_STACK_H
+#define CDSUNIT_STACK_TREIBER_STACK_H
+
+#include <gtest/gtest.h>
+
+namespace cds_gtest {
+
+ class TreiberStack : public ::testing::Test
+ {
+ protected:
+ template <class Stack>
+ void test( Stack& stack )
+ {
+ typedef typename Stack::value_type value_type;
+ value_type v;
+
+ ASSERT_TRUE( stack.empty() );
+
+ ASSERT_TRUE( stack.push( 1 ) );
+ ASSERT_TRUE( !stack.empty() );
+ ASSERT_TRUE( stack.push( 2 ) );
+ ASSERT_TRUE( !stack.empty() );
+ ASSERT_TRUE( stack.push( 3 ) );
+ ASSERT_TRUE( !stack.empty() );
+
+ ASSERT_TRUE( stack.pop( v ) );
+ ASSERT_EQ( v, 3 );
+ ASSERT_TRUE( !stack.empty() );
+ ASSERT_TRUE( stack.pop_with( [&v]( value_type& src ) { v = src; } ) );
+ ASSERT_EQ( v, 2 );
+ ASSERT_TRUE( !stack.empty() );
+ ASSERT_TRUE( stack.pop( v ) );
+ ASSERT_EQ( v, 1 );
+ ASSERT_TRUE( stack.empty() );
+ v = 1000;
+ ASSERT_TRUE( !stack.pop( v ) );
+ ASSERT_EQ( v, 1000 );
+ ASSERT_TRUE( stack.empty() );
+
+ ASSERT_TRUE( stack.push( 10 ) );
+ ASSERT_TRUE( stack.push( 20 ) );
+ ASSERT_TRUE( stack.push( 30 ) );
+ ASSERT_TRUE( !stack.empty() );
+
+ ASSERT_TRUE( stack.emplace( 100 ) );
+ ASSERT_TRUE( stack.pop( v ) );
+ ASSERT_EQ( v, 100 );
+
+ stack.clear();
+ ASSERT_TRUE( stack.empty() );
+
+ Stack::gc::scan();
+ }
+ };
+} // namespace cds_gtest
+
+#endif // CDSUNIT_STACK_TREIBER_STACK_H
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+\r
+#include "test_treiber_stack.h"\r
+\r
+#include <cds/gc/dhp.h>\r
+#include <cds/container/treiber_stack.h>\r
+\r
+namespace {\r
+\r
+ namespace cc = cds::container;\r
+ typedef cds::gc::DHP gc_type;\r
+\r
+ class TreiberStack_DHP : public cds_gtest::TreiberStack\r
+ {\r
+ typedef cds_gtest::TreiberStack base_class;\r
+\r
+ protected:\r
+ void SetUp()\r
+ {\r
+ typedef cc::TreiberStack< gc_type, int > stack_type;\r
+\r
+ cds::gc::dhp::GarbageCollector::Construct( 16, stack_type::c_nHazardPtrCount );\r
+ cds::threading::Manager::attachThread();\r
+ }\r
+\r
+ void TearDown() \r
+ {\r
+ cds::threading::Manager::detachThread();\r
+ cds::gc::dhp::GarbageCollector::Destruct();\r
+ }\r
+\r
+ template <typename Stack>\r
+ void test()\r
+ {\r
+ Stack stack;\r
+ base_class::test( stack );\r
+ }\r
+\r
+ template <typename Stack>\r
+ void test_dyn( size_t elimination_size )\r
+ {\r
+ Stack stack( elimination_size );\r
+ base_class::test( stack );\r
+ }\r
+ };\r
+\r
+ TEST_F( TreiberStack_DHP, defaulted )
+ {
+ typedef cc::TreiberStack< gc_type, int > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_DHP, backoff )
+ {
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::back_off< cds::backoff::yield>
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_DHP, alloc )
+ {
+ // allocator must be rebinded for real value type
+ struct foo
+ {
+ size_t arr[ 1024 * 1024 ];
+ size_t a2[1024 * 1024];
+ size_t a3[1024 * 1024];
+ size_t a4[1024 * 1024];
+ };
+
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::back_off< cds::backoff::pause>
+ ,cds::opt::memory_model<cds::opt::v::relaxed_ordering>
+ ,cds::opt::allocator< std::allocator< foo >>
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_DHP, elimination )
+ {
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_DHP, elimination_backoff )
+ {
+ struct traits : public cc::treiber_stack::traits
+ {
+ enum {
+ enable_elimination = true
+ };
+ typedef cds::backoff::pause back_off;
+ };
+ typedef cc::TreiberStack< gc_type, int, traits > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_DHP, elimination_dynamic )
+ {
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ , cds::opt::buffer< cds::opt::v::dynamic_buffer<void *> >
+ >::type
+ > stack_type;
+
+ test_dyn<stack_type>( 4 );
+ }
+\r
+ TEST_F( TreiberStack_DHP, elimination_stat )
+ {
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ , cds::opt::stat< cc::treiber_stack::stat<> >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_DHP, elimination_dynamic_backoff )
+ {
+ struct traits : public cc::treiber_stack::traits
+ {
+ enum {
+ enable_elimination = true
+ };
+ typedef cds::opt::v::dynamic_buffer<void *> buffer;
+ typedef cds::backoff::yield back_off;
+ };
+ typedef cc::TreiberStack< gc_type, int, traits > stack_type;
+
+ test_dyn<stack_type>( 2 );
+ }
+\r
+} // namespace\r
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+\r
+#include "test_treiber_stack.h"\r
+\r
+#include <cds/gc/hp.h>\r
+#include <cds/container/treiber_stack.h>\r
+\r
+namespace {\r
+\r
+ namespace cc = cds::container;\r
+ typedef cds::gc::HP gc_type;\r
+\r
+ class TreiberStack_HP : public cds_gtest::TreiberStack\r
+ {\r
+ typedef cds_gtest::TreiberStack base_class;\r
+\r
+ protected:\r
+ void SetUp()\r
+ {\r
+ typedef cc::TreiberStack< gc_type, int > stack_type;\r
+\r
+ cds::gc::hp::GarbageCollector::Construct( stack_type::c_nHazardPtrCount, 1, 16 );\r
+ cds::threading::Manager::attachThread();\r
+ }\r
+\r
+ void TearDown() \r
+ {\r
+ cds::threading::Manager::detachThread();\r
+ cds::gc::hp::GarbageCollector::Destruct( true );\r
+ }\r
+\r
+ template <typename Stack>\r
+ void test()\r
+ {\r
+ Stack stack;\r
+ base_class::test( stack );\r
+ }\r
+\r
+ template <typename Stack>\r
+ void test_dyn( size_t elimination_size )\r
+ {\r
+ Stack stack( elimination_size );\r
+ base_class::test( stack );\r
+ }\r
+ };\r
+\r
+ TEST_F( TreiberStack_HP, defaulted )
+ {
+ typedef cc::TreiberStack< gc_type, int > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_HP, backoff )
+ {
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::back_off< cds::backoff::yield>
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_HP, alloc )
+ {
+ // allocator must be rebinded for real value type
+ struct foo;
+
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::back_off< cds::backoff::pause>
+ ,cds::opt::memory_model<cds::opt::v::relaxed_ordering>
+ ,cds::opt::allocator< std::allocator< foo >>
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_HP, elimination )
+ {
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_HP, elimination_backoff )
+ {
+ struct traits : public cc::treiber_stack::traits
+ {
+ enum {
+ enable_elimination = true
+ };
+ typedef cds::backoff::pause back_off;
+ };
+ typedef cc::TreiberStack< gc_type, int, traits > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_HP, elimination_dynamic )
+ {
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ , cds::opt::buffer< cds::opt::v::dynamic_buffer<void *> >
+ >::type
+ > stack_type;
+
+ test_dyn<stack_type>( 4 );
+ }
+\r
+ TEST_F( TreiberStack_HP, elimination_stat )
+ {
+ typedef cc::TreiberStack< gc_type, int
+ , typename cc::treiber_stack::make_traits<
+ cds::opt::enable_elimination<true>
+ , cds::opt::stat< cc::treiber_stack::stat<> >
+ >::type
+ > stack_type;
+
+ test<stack_type>();
+ }
+\r
+ TEST_F( TreiberStack_HP, elimination_dynamic_backoff )
+ {
+ struct traits : public cc::treiber_stack::traits
+ {
+ enum {
+ enable_elimination = true
+ };
+ typedef cds::opt::v::dynamic_buffer<void *> buffer;
+ typedef cds::backoff::yield back_off;
+ };
+ typedef cc::TreiberStack< gc_type, int, traits > stack_type;
+
+ test_dyn<stack_type>( 2 );
+ }
+\r
+} // namespace\r
set/hdr_striped_hashset_slist.cpp\r
set/hdr_striped_hashset_vector.cpp)\r
\r
-set(CDS_TESTHDR_STACK\r
- stack/hdr_intrusive_fcstack.cpp\r
- stack/hdr_treiber_stack_hp.cpp\r
- stack/hdr_treiber_stack_dhp.cpp\r
- stack/hdr_elimination_stack_hp.cpp\r
- stack/hdr_elimination_stack_dhp.cpp\r
- stack/hdr_fcstack.cpp)\r
-\r
set(CDS_TESTHDR_TREE\r
tree/hdr_tree_reg.cpp
tree/hdr_intrusive_ellen_bintree_hp.cpp
set(CDS_TESTHDR_SOURCES\r
${CDS_TESTHDR_QUEUE}\r
${CDS_TESTHDR_PQUEUE}\r
- ${CDS_TESTHDR_STACK}\r
${CDS_TESTHDR_MAP}\r
${CDS_TESTHDR_DEQUE}\r
${CDS_TESTHDR_LIST}\r
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hdr_treiber_stack.h"
-#include <cds/gc/dhp.h>
-#include <cds/container/treiber_stack.h>
-
-namespace stack {
-#define TEST(X) void TestStack::X() { test<defs::X>(); }
-#define TEST_DYN(X) void TestStack::X() { test_elimination<defs::X>(); }
- namespace cs = cds::container;
-
- namespace defs { namespace {
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- ,typename cs::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- >::type
- > Elimination_DHP;
-
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- ,typename cs::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,cds::opt::buffer< cds::opt::v::dynamic_buffer<void *> >
- >::type
- > Elimination_DHP_dyn;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::buffer< cds::opt::v::dynamic_buffer<int> >
- ,cds::opt::stat< cs::treiber_stack::stat<> >
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_DHP_stat;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_DHP_relaxed;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::yield>
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_DHP_yield;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::yield>
- ,cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_DHP_yield_relaxed;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::pause >
- ,cds::opt::allocator< std::allocator< bool * > >
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_DHP_pause_alloc;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- ,cds::opt::back_off< cds::backoff::pause>
- ,cds::opt::allocator< std::allocator< bool * > >
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_DHP_pause_alloc_relaxed;
- }}
-
- TEST(Elimination_DHP)
- TEST_DYN(Elimination_DHP_dyn)
- TEST_DYN(Elimination_DHP_stat)
- TEST(Elimination_DHP_yield)
- TEST(Elimination_DHP_pause_alloc)
-
- TEST(Elimination_DHP_relaxed)
- TEST(Elimination_DHP_yield_relaxed)
- TEST(Elimination_DHP_pause_alloc_relaxed)
-
-}
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hdr_treiber_stack.h"
-#include <cds/gc/hp.h>
-#include <cds/container/treiber_stack.h>
-
-namespace stack {
-#define TEST(X) void TestStack::X() { test<defs::X>(); }
-#define TEST_DYN(X) void TestStack::X() { test_elimination<defs::X>(); }
-
- namespace cs = cds::container;
-
- namespace defs { namespace {
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- >::type
- > Elimination_HP;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- , cds::opt::buffer< cds::opt::v::dynamic_buffer<void *> >
- >::type
- > Elimination_HP_dyn;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- , cds::opt::buffer< cds::opt::v::dynamic_buffer<void *> >
- , cds::opt::stat< cs::treiber_stack::stat<> >
- >::type
- > Elimination_HP_stat;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- >::type
- > Elimination_HP_relaxed;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,cds::opt::back_off< cds::backoff::yield>
- >::type
- > Elimination_HP_yield;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::yield>
- ,cds::opt::enable_elimination<true>
- , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- >::type
- > Elimination_HP_yield_relaxed;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::pause>
- ,cds::opt::allocator< std::allocator< bool * > >
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_HP_pause_alloc;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::pause>
- ,cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- ,cds::opt::allocator< std::allocator< bool * > >
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_HP_pause_alloc_relaxed;
-
- }}
-
- TEST(Elimination_HP)
- TEST_DYN(Elimination_HP_dyn)
- TEST_DYN(Elimination_HP_stat)
- TEST(Elimination_HP_yield)
- TEST(Elimination_HP_pause_alloc)
-
- TEST(Elimination_HP_relaxed)
- TEST(Elimination_HP_yield_relaxed)
- TEST(Elimination_HP_pause_alloc_relaxed)
-}
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/container/fcstack.h>
-
-#include <vector>
-#include <list>
-
-namespace stack {
-
- class TestFCStack: public CppUnitMini::TestCase
- {
- template <class Stack>
- void test()
- {
- Stack s;
- test_with( s );
- }
-
- template <class Stack>
- void test_with( Stack& stack)
- {
- typedef typename Stack::value_type value_type;
- value_type v;
-
- CPPUNIT_ASSERT( stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 0 );
-
- CPPUNIT_ASSERT( stack.push(1));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 1 );
- CPPUNIT_ASSERT( stack.push(2));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 2 );
- CPPUNIT_ASSERT( stack.push(3));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 3 );
-
- CPPUNIT_ASSERT( stack.pop(v) );
- CPPUNIT_ASSERT( v == 3 );
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 2 );
- CPPUNIT_ASSERT( stack.pop(v) );
- CPPUNIT_ASSERT( v == 2 );
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 1 );
- CPPUNIT_ASSERT( stack.pop(v) );
- CPPUNIT_ASSERT( v == 1 );
- CPPUNIT_ASSERT( stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 0 );
- v = 1000;
- CPPUNIT_ASSERT( !stack.pop(v) );
- CPPUNIT_ASSERT( v == 1000 );
- CPPUNIT_ASSERT( stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 0 );
-
- CPPUNIT_ASSERT( stack.push(10));
- CPPUNIT_ASSERT( stack.push(20));
- CPPUNIT_ASSERT( stack.push(30));
- CPPUNIT_ASSERT( !stack.empty());
- CPPUNIT_ASSERT( stack.size() == 3 );
-
- while ( stack.pop(v) );
-
- CPPUNIT_ASSERT( stack.empty() );
- CPPUNIT_ASSERT( stack.size() == 0 );
- }
-
- void FCStack_default();
- void FCStack_deque();
- void FCStack_deque_elimination();
- void FCStack_vector();
- void FCStack_vector_elimination();
- void FCStack_list();
- void FCStack_list_elimination();
-
- CPPUNIT_TEST_SUITE(TestFCStack);
- CPPUNIT_TEST( FCStack_default )
- CPPUNIT_TEST( FCStack_deque )
- CPPUNIT_TEST( FCStack_deque_elimination )
- CPPUNIT_TEST( FCStack_vector )
- CPPUNIT_TEST( FCStack_vector_elimination )
- CPPUNIT_TEST( FCStack_list )
- CPPUNIT_TEST( FCStack_list_elimination )
- CPPUNIT_TEST_SUITE_END();
- };
-
- void TestFCStack::FCStack_default()
- {
- typedef cds::container::FCStack< unsigned int > stack_type;
- test<stack_type>();
- }
-
- void TestFCStack::FCStack_deque()
- {
- typedef cds::container::FCStack< unsigned int, std::stack<unsigned int, std::deque<unsigned int> > > stack_type;
- test<stack_type>();
- }
-
- void TestFCStack::FCStack_deque_elimination()
- {
- struct stack_traits : public
- cds::container::fcstack::make_traits <
- cds::opt::enable_elimination < true >
- > ::type
- {};
- typedef cds::container::FCStack< unsigned int, std::stack<unsigned int, std::deque<unsigned int> >, stack_traits > stack_type;
- test<stack_type>();
- }
-
- void TestFCStack::FCStack_vector()
- {
- typedef cds::container::FCStack< unsigned int, std::stack<unsigned int, std::vector<unsigned int> > > stack_type;
- test<stack_type>();
- }
-
- void TestFCStack::FCStack_vector_elimination()
- {
- typedef cds::container::FCStack< unsigned int, std::stack<unsigned int, std::vector<unsigned int> >,
- cds::container::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- void TestFCStack::FCStack_list()
- {
- typedef cds::container::FCStack< unsigned int, std::stack<unsigned int, std::list<unsigned int> > > stack_type;
- test<stack_type>();
- }
-
- void TestFCStack::FCStack_list_elimination()
- {
- typedef cds::container::FCStack< unsigned int, std::stack<unsigned int, std::list<unsigned int> >,
- cds::container::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- CPPUNIT_TEST_SUITE_REGISTRATION(stack::TestFCStack);
-} // namespace stack
-
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hdr_intrusive_treiber_stack.h"
-#include <cds/gc/dhp.h>
-#include <cds/intrusive/treiber_stack.h>
-
-namespace stack {
-
-#define TEST(X) void TestIntrusiveStack::X() { test<defs::X>(); }
-#define TEST_DYN(X) void TestIntrusiveStack::X() { test_elimination<defs::X>(); }
-
- namespace defs {
- // DHP GC + base hook
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- >::type
- > Elimination_DHP_base;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- ,cds::opt::enable_elimination<true>
- ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
- >::type
- > Elimination_DHP_base_dyn;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- ,cds::opt::enable_elimination<true>
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_DHP_base_relaxed;
-
- // DHP GC + base hook + disposer
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- ,cds::opt::enable_elimination<true>
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- >::type
- > Elimination_DHP_base_disposer;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- ,cds::opt::enable_elimination<true>
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_DHP_base_disposer_relaxed;
-
- // DHP GC + member hook
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- ,cds::opt::enable_elimination<true>
- >::type
- > Elimination_DHP_member;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- ,cds::opt::enable_elimination<true>
- ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
- >::type
- > Elimination_DHP_member_dyn;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- ,cds::opt::enable_elimination<true>
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_DHP_member_relaxed;
-
- // DHP GC + member hook + disposer
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- ,cds::opt::enable_elimination<true>
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- >::type
- > Elimination_DHP_member_disposer;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- ,cds::opt::enable_elimination<true>
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_DHP_member_disposer_relaxed;
- }
-
- TEST(Elimination_DHP_base)
- TEST_DYN(Elimination_DHP_base_dyn)
- TEST(Elimination_DHP_base_disposer)
- TEST(Elimination_DHP_member)
- TEST_DYN(Elimination_DHP_member_dyn)
- TEST(Elimination_DHP_member_disposer)
-
- TEST(Elimination_DHP_base_relaxed)
- TEST(Elimination_DHP_base_disposer_relaxed)
- TEST(Elimination_DHP_member_relaxed)
- TEST(Elimination_DHP_member_disposer_relaxed)
-
-} // namespace stack
-
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hdr_intrusive_treiber_stack.h"
-#include <cds/gc/hp.h>
-#include <cds/intrusive/treiber_stack.h>
-
-namespace stack {
-
-#define TEST(X) void TestIntrusiveStack::X() { test<defs::X>(); }
-#define TEST_DYN(X) void TestIntrusiveStack::X() { test_elimination<defs::X>(); }
-
- namespace defs {
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- >::type
- > Elimination_HP_default;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_HP_default_relaxed;
-
- // HZP GC + base hook
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::base_hook<
- ci::opt::gc<cds::gc::HP>
- >
- >
- >::type
- > Elimination_HP_base;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::base_hook<
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
- >::type
- > Elimination_HP_base_dyn;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::base_hook<
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_HP_base_relaxed;
-
- // HZP GC + base hook + disposer
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::HP> >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- >::type
- > Elimination_HP_base_disposer;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::HP> >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_HP_base_disposer_relaxed;
-
- // HZP GC + member hook
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- >::type
- > Elimination_HP_member;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
- >::type
- > Elimination_HP_member_dyn;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_HP_member_relaxed;
-
- // HZP GC + member hook + disposer
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- >::type
- > Elimination_HP_member_disposer;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- cds::opt::enable_elimination<true>
- ,ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Elimination_HP_member_disposer_relaxed;
- }
-
- TEST(Elimination_HP_default)
- TEST(Elimination_HP_base)
- TEST_DYN(Elimination_HP_base_dyn)
- TEST(Elimination_HP_base_disposer)
- TEST(Elimination_HP_member)
- TEST_DYN(Elimination_HP_member_dyn)
- TEST(Elimination_HP_member_disposer)
-
- TEST(Elimination_HP_default_relaxed)
- TEST(Elimination_HP_base_relaxed)
- TEST(Elimination_HP_base_disposer_relaxed)
- TEST(Elimination_HP_member_relaxed)
- TEST(Elimination_HP_member_disposer_relaxed)
-
-} // namespace stack
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/intrusive/fcstack.h>
-
-#include <boost/intrusive/list.hpp>
-
-namespace stack {
-
- class TestIntrusiveFCStack: public CppUnitMini::TestCase
- {
- public:
- template <typename Hook>
- struct base_hook_item: public Hook
- {
- int nVal;
- int nDisposeCount;
-
- base_hook_item()
- : nDisposeCount(0)
- {}
- };
-
- template <typename Hook>
- struct member_hook_item
- {
- int nVal;
- int nDisposeCount;
- Hook hMember;
-
- member_hook_item()
- : nDisposeCount(0)
- {}
- };
-
- struct faked_disposer
- {
- template <typename T>
- void operator ()( T * p )
- {
- ++p->nDisposeCount;
- }
- };
-
- template <class Stack>
- void test()
- {
- Stack stack;
- test_with(stack);
- }
-
- template <class Stack>
- void test_with( Stack& stack )
- {
- typedef typename Stack::value_type value_type;
-
- CPPUNIT_ASSERT( stack.empty() );
-
- value_type v1, v2, v3;
- v1.nVal = 1;
- v2.nVal = 2;
- v3.nVal = 3;
- CPPUNIT_ASSERT( stack.push(v1));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.push(v2));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.push(v3));
- CPPUNIT_ASSERT( !stack.empty() );
-
- value_type * pv;
- pv = stack.pop();
- CPPUNIT_ASSERT( pv != nullptr );
- CPPUNIT_ASSERT( pv->nVal == 3 );
- CPPUNIT_ASSERT( !stack.empty() );
- pv = stack.pop();
- CPPUNIT_ASSERT( pv != nullptr );
- CPPUNIT_ASSERT( pv->nVal == 2 );
- CPPUNIT_ASSERT( !stack.empty() );
- pv = stack.pop();
- CPPUNIT_ASSERT( pv != nullptr );
- CPPUNIT_ASSERT( pv->nVal == 1 );
- CPPUNIT_ASSERT( stack.empty() );
- pv = stack.pop();
- CPPUNIT_ASSERT( pv == nullptr );
-
- CPPUNIT_ASSERT( v1.nDisposeCount == 0 );
- CPPUNIT_ASSERT( v2.nDisposeCount == 0 );
- CPPUNIT_ASSERT( v3.nDisposeCount == 0 );
-
- stack.push(v1);
- stack.push(v2);
- stack.push(v3);
-
- stack.clear();
- CPPUNIT_ASSERT( stack.empty() );
-
- if ( !std::is_same<typename Stack::disposer, cds::intrusive::opt::v::empty_disposer>::value ) {
- CPPUNIT_ASSERT( v1.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v2.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v3.nDisposeCount == 1 );
- }
- }
-
- void FCStack_slist();
- void FCStack_slist_mutex();
- void FCStack_slist_elimination();
- void FCStack_slist_elimination_stat();
- void FCStack_slist_member();
- void FCStack_slist_member_elimination();
- void FCStack_slist_member_elimination_stat();
- void FCStack_list();
- void FCStack_list_mutex();
- void FCStack_list_elimination();
- void FCStack_list_elimination_stat();
- void FCStack_list_member();
- void FCStack_list_member_elimination();
- void FCStack_list_member_elimination_stat();
-
- CPPUNIT_TEST_SUITE(TestIntrusiveFCStack)
- CPPUNIT_TEST(FCStack_slist)
- CPPUNIT_TEST(FCStack_slist_mutex)
- CPPUNIT_TEST(FCStack_slist_elimination)
- CPPUNIT_TEST(FCStack_slist_elimination_stat)
- CPPUNIT_TEST(FCStack_slist_member)
- CPPUNIT_TEST(FCStack_slist_member_elimination)
- CPPUNIT_TEST(FCStack_slist_member_elimination_stat)
- CPPUNIT_TEST(FCStack_list)
- CPPUNIT_TEST(FCStack_list_mutex)
- CPPUNIT_TEST(FCStack_list_elimination)
- CPPUNIT_TEST(FCStack_list_elimination_stat)
- CPPUNIT_TEST(FCStack_list_member)
- CPPUNIT_TEST(FCStack_list_member_elimination)
- CPPUNIT_TEST(FCStack_list_member_elimination_stat)
- CPPUNIT_TEST_SUITE_END()
- };
-
- void TestIntrusiveFCStack::FCStack_slist()
- {
- typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type > > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_slist_mutex()
- {
- typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
- struct stack_traits : public cds::intrusive::fcstack::traits
- {
- typedef std::mutex lock_type;
- };
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type >, stack_traits > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_slist_elimination()
- {
- typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
- struct stack_traits : public
- cds::intrusive::fcstack::make_traits <
- cds::opt::enable_elimination < true >
- > ::type
- {};
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type >, stack_traits > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_slist_elimination_stat()
- {
- typedef base_hook_item< boost::intrusive::slist_base_hook<> > value_type;
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type >,
- cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- ,cds::opt::stat< cds::intrusive::fcstack::stat<> >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_slist_member()
- {
- typedef member_hook_item< boost::intrusive::slist_member_hook<> > value_type;
- typedef boost::intrusive::member_hook<value_type, boost::intrusive::slist_member_hook<>, &value_type::hMember> member_option;
-
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type, member_option > > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_slist_member_elimination()
- {
- typedef member_hook_item< boost::intrusive::slist_member_hook<> > value_type;
- typedef boost::intrusive::member_hook<value_type, boost::intrusive::slist_member_hook<>, &value_type::hMember> member_option;
-
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type, member_option >,
- cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_slist_member_elimination_stat()
- {
- typedef member_hook_item< boost::intrusive::slist_member_hook<> > value_type;
- typedef boost::intrusive::member_hook<value_type, boost::intrusive::slist_member_hook<>, &value_type::hMember> member_option;
-
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::slist< value_type, member_option >,
- cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- ,cds::opt::stat< cds::intrusive::fcstack::stat<> >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_list()
- {
- typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type;
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type > > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_list_mutex()
- {
- typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type;
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type >,
- cds::intrusive::fcstack::make_traits<
- cds::opt::lock_type< std::mutex >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
-
- void TestIntrusiveFCStack::FCStack_list_elimination()
- {
- typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type;
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type >,
- cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_list_elimination_stat()
- {
- typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type;
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type >,
- cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- ,cds::opt::stat< cds::intrusive::fcstack::stat<> >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_list_member()
- {
- typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type;
- typedef boost::intrusive::member_hook<value_type, boost::intrusive::list_member_hook<>, &value_type::hMember> member_option;
-
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type, member_option > > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_list_member_elimination()
- {
- typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type;
- typedef boost::intrusive::member_hook<value_type, boost::intrusive::list_member_hook<>, &value_type::hMember> member_option;
-
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type, member_option >,
- cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- void TestIntrusiveFCStack::FCStack_list_member_elimination_stat()
- {
- typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type;
- typedef boost::intrusive::member_hook<value_type, boost::intrusive::list_member_hook<>, &value_type::hMember> member_option;
-
- typedef cds::intrusive::FCStack< value_type, boost::intrusive::list< value_type, member_option >,
- cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- ,cds::opt::stat< cds::intrusive::fcstack::stat<> >
- >::type
- > stack_type;
- test<stack_type>();
- }
-
- CPPUNIT_TEST_SUITE_REGISTRATION(stack::TestIntrusiveFCStack);
-} // namespace stack
-
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef CDSTEST_HDR_INTRUSIVE_TREIBER_STACK_H
-#define CDSTEST_HDR_INTRUSIVE_TREIBER_STACK_H
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/intrusive/details/single_link_struct.h>
-
-namespace stack {
-
- namespace ci = cds::intrusive;
-
- class TestIntrusiveStack: public CppUnitMini::TestCase
- {
- public:
- template <typename GC>
- struct base_hook_item: public ci::single_link::node< GC >
- {
- int nVal;
- int nDisposeCount;
-
- base_hook_item()
- : nDisposeCount(0)
- {}
- };
-
- template <typename GC>
- struct member_hook_item
- {
- int nVal;
- int nDisposeCount;
- ci::single_link::node< GC > hMember;
-
- member_hook_item()
- : nDisposeCount(0)
- {}
- };
-
- struct faked_disposer
- {
- template <typename T>
- void operator ()( T * p )
- {
- ++p->nDisposeCount;
- }
- };
-
- template <class Stack>
- void test_elimination()
- {
- Stack stack( 2 );
- test_with( stack );
- }
-
- template <class Stack>
- void test()
- {
- Stack stack;
- test_with(stack);
- }
-
-
- template <class Stack>
- void test_with( Stack& stack )
- {
- typedef typename Stack::value_type value_type;
-
- CPPUNIT_ASSERT( stack.empty() );
-
- value_type v1, v2, v3;
- v1.nVal = 1;
- v2.nVal = 2;
- v3.nVal = 3;
- CPPUNIT_ASSERT( stack.push(v1));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.push(v2));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.push(v3));
- CPPUNIT_ASSERT( !stack.empty() );
-
- value_type * pv;
- pv = stack.pop();
- CPPUNIT_ASSERT( pv != nullptr );
- CPPUNIT_ASSERT( pv->nVal == 3 );
- CPPUNIT_ASSERT( !stack.empty() );
- pv = stack.pop();
- CPPUNIT_ASSERT( pv != nullptr );
- CPPUNIT_ASSERT( pv->nVal == 2 );
- CPPUNIT_ASSERT( !stack.empty() );
- pv = stack.pop();
- CPPUNIT_ASSERT( pv != nullptr );
- CPPUNIT_ASSERT( pv->nVal == 1 );
- CPPUNIT_ASSERT( stack.empty() );
- pv = stack.pop();
- CPPUNIT_ASSERT( pv == nullptr );
-
- CPPUNIT_ASSERT( v1.nDisposeCount == 0 );
- CPPUNIT_ASSERT( v2.nDisposeCount == 0 );
- CPPUNIT_ASSERT( v3.nDisposeCount == 0 );
-
- stack.push(v1);
- stack.push(v2);
- stack.push(v3);
-
- stack.clear();
- CPPUNIT_ASSERT( stack.empty() );
-
- Stack::gc::scan();
- if ( !std::is_same<typename Stack::disposer, ci::opt::v::empty_disposer>::value ) {
- CPPUNIT_ASSERT( v1.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v2.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v3.nDisposeCount == 1 );
- }
- }
-
- void Treiber_HP_default();
- void Treiber_HP_base();
- void Treiber_HP_base_disposer();
- void Treiber_HP_member();
- void Treiber_HP_member_disposer();
- void Treiber_DHP_base();
- void Treiber_DHP_base_disposer();
- void Treiber_DHP_member();
- void Treiber_DHP_member_disposer();
-
- void Treiber_HP_default_relaxed();
- void Treiber_HP_base_relaxed();
- void Treiber_HP_base_disposer_relaxed();
- void Treiber_HP_member_relaxed();
- void Treiber_HP_member_disposer_relaxed();
- void Treiber_DHP_base_relaxed();
- void Treiber_DHP_base_disposer_relaxed();
- void Treiber_DHP_member_relaxed();
- void Treiber_DHP_member_disposer_relaxed();
-
- void Elimination_HP_default();
- void Elimination_HP_base();
- void Elimination_HP_base_dyn();
- void Elimination_HP_base_disposer();
- void Elimination_HP_member();
- void Elimination_HP_member_dyn();
- void Elimination_HP_member_disposer();
- void Elimination_DHP_base();
- void Elimination_DHP_base_dyn();
- void Elimination_DHP_base_disposer();
- void Elimination_DHP_member();
- void Elimination_DHP_member_dyn();
- void Elimination_DHP_member_disposer();
-
- void Elimination_HP_default_relaxed();
- void Elimination_HP_base_relaxed();
- void Elimination_HP_base_disposer_relaxed();
- void Elimination_HP_member_relaxed();
- void Elimination_HP_member_disposer_relaxed();
- void Elimination_DHP_base_relaxed();
- void Elimination_DHP_base_disposer_relaxed();
- void Elimination_DHP_member_relaxed();
- void Elimination_DHP_member_disposer_relaxed();
-
- CPPUNIT_TEST_SUITE(TestIntrusiveStack)
- CPPUNIT_TEST(Treiber_HP_default)
- CPPUNIT_TEST(Treiber_HP_default_relaxed)
- CPPUNIT_TEST(Treiber_HP_base)
- CPPUNIT_TEST(Treiber_HP_base_relaxed)
- CPPUNIT_TEST(Treiber_HP_base_disposer)
- CPPUNIT_TEST(Treiber_HP_base_disposer_relaxed)
- CPPUNIT_TEST(Treiber_HP_member)
- CPPUNIT_TEST(Treiber_HP_member_relaxed)
- CPPUNIT_TEST(Treiber_HP_member_disposer)
- CPPUNIT_TEST(Treiber_HP_member_disposer_relaxed)
- CPPUNIT_TEST(Treiber_DHP_base)
- CPPUNIT_TEST(Treiber_DHP_base_relaxed)
- CPPUNIT_TEST(Treiber_DHP_base_disposer)
- CPPUNIT_TEST(Treiber_DHP_base_disposer_relaxed)
- CPPUNIT_TEST(Treiber_DHP_member)
- CPPUNIT_TEST(Treiber_DHP_member_relaxed)
- CPPUNIT_TEST(Treiber_DHP_member_disposer)
- CPPUNIT_TEST(Treiber_DHP_member_disposer_relaxed)
-
- CPPUNIT_TEST(Elimination_HP_default)
- CPPUNIT_TEST(Elimination_HP_default_relaxed)
- CPPUNIT_TEST(Elimination_HP_base)
- CPPUNIT_TEST(Elimination_HP_base_dyn)
- CPPUNIT_TEST(Elimination_HP_base_relaxed)
- CPPUNIT_TEST(Elimination_HP_base_disposer)
- CPPUNIT_TEST(Elimination_HP_base_disposer_relaxed)
- CPPUNIT_TEST(Elimination_HP_member)
- CPPUNIT_TEST(Elimination_HP_member_dyn)
- CPPUNIT_TEST(Elimination_HP_member_relaxed)
- CPPUNIT_TEST(Elimination_HP_member_disposer)
- CPPUNIT_TEST(Elimination_HP_member_disposer_relaxed)
- CPPUNIT_TEST(Elimination_DHP_base)
- CPPUNIT_TEST(Elimination_DHP_base_dyn)
- CPPUNIT_TEST(Elimination_DHP_base_relaxed)
- CPPUNIT_TEST(Elimination_DHP_base_disposer)
- CPPUNIT_TEST(Elimination_DHP_base_disposer_relaxed)
- CPPUNIT_TEST(Elimination_DHP_member)
- CPPUNIT_TEST(Elimination_DHP_member_dyn)
- CPPUNIT_TEST(Elimination_DHP_member_relaxed)
- CPPUNIT_TEST(Elimination_DHP_member_disposer)
- CPPUNIT_TEST(Elimination_DHP_member_disposer_relaxed)
- CPPUNIT_TEST_SUITE_END()
- };
-
-} // namespace stack
-
-#endif // #ifndef CDSTEST_HDR_INTRUSIVE_TREIBER_STACK_H
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hdr_intrusive_treiber_stack.h"
-#include <cds/gc/dhp.h>
-#include <cds/intrusive/treiber_stack.h>
-
-namespace stack {
-
-#define TEST(X) void TestIntrusiveStack::X() { test<defs::X>(); }
-
- namespace defs {
- // DHP GC + base hook
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- ,typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- >::type
- > Treiber_DHP_base;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- ,typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Treiber_DHP_base_relaxed;
-
- // DHP GC + base hook + disposer
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- ,typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- >::type
- > Treiber_DHP_base_disposer;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::base_hook_item<cds::gc::DHP>
- ,typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::DHP> >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Treiber_DHP_base_disposer_relaxed;
-
- // DHP GC + member hook
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- ,typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- >::type
- > Treiber_DHP_member;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- ,typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Treiber_DHP_member_relaxed;
-
- // DHP GC + member hook + disposer
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- >::type
- > Treiber_DHP_member_disposer;
-
- typedef cds::intrusive::TreiberStack< cds::gc::DHP,
- TestIntrusiveStack::member_hook_item<cds::gc::DHP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::DHP>, hMember),
- ci::opt::gc<cds::gc::DHP>
- >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Treiber_DHP_member_disposer_relaxed;
- }
-
- TEST(Treiber_DHP_base)
- TEST(Treiber_DHP_base_disposer)
- TEST(Treiber_DHP_member)
- TEST(Treiber_DHP_member_disposer)
-
- TEST(Treiber_DHP_base_relaxed)
- TEST(Treiber_DHP_base_disposer_relaxed)
- TEST(Treiber_DHP_member_relaxed)
- TEST(Treiber_DHP_member_disposer_relaxed)
-
-} // namespace stack
-
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hdr_intrusive_treiber_stack.h"
-#include <cds/gc/hp.h>
-#include <cds/intrusive/treiber_stack.h>
-
-namespace stack {
-
-#define TEST(X) void TestIntrusiveStack::X() { test<defs::X>(); }
-
- namespace defs { namespace {
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- > Treiber_HP_default;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Treiber_HP_default_relaxed;
-
- // HZP GC + base hook
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- , typename ci::treiber_stack::make_traits<
- ci::opt::hook<
- ci::treiber_stack::base_hook<
- ci::opt::gc<cds::gc::HP>
- >
- >
- >::type
- > Treiber_HP_base;
-
- struct traits_Treiber_HP_base_relaxed
- : ci::treiber_stack::make_traits <
- ci::opt::hook<
- ci::treiber_stack::base_hook<
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>,
- traits_Treiber_HP_base_relaxed
- > Treiber_HP_base_relaxed;
-
- // HZP GC + base hook + disposer
- struct traits_Treiber_HP_base_disposer
- : ci::treiber_stack::make_traits <
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::HP> >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- >::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>,
- traits_Treiber_HP_base_disposer
- > Treiber_HP_base_disposer;
-
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::base_hook_item<cds::gc::HP>
- ,typename ci::treiber_stack::make_traits <
- ci::opt::hook<
- ci::treiber_stack::base_hook< ci::opt::gc<cds::gc::HP> >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- > Treiber_HP_base_disposer_relaxed;
-
- // HZP GC + member hook
- struct traits_Treiber_HP_member
- : ci::treiber_stack::make_traits <
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>,
- traits_Treiber_HP_member
- > Treiber_HP_member;
-
- struct traits_Treiber_HP_member_relaxed
- : ci::treiber_stack::make_traits <
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>,
- traits_Treiber_HP_member_relaxed
- > Treiber_HP_member_relaxed;
-
- // HZP GC + member hook + disposer
- struct traits_Treiber_HP_member_disposer
- : ci::treiber_stack::make_traits <
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- >::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>,
- traits_Treiber_HP_member_disposer
- > Treiber_HP_member_disposer;
-
- struct traits_Treiber_HP_member_disposer_relaxed
- : ci::treiber_stack::make_traits <
- ci::opt::hook<
- ci::treiber_stack::member_hook<
- offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
- ci::opt::gc<cds::gc::HP>
- >
- >
- ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
- ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
- >::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP,
- TestIntrusiveStack::member_hook_item<cds::gc::HP>,
- traits_Treiber_HP_member_disposer_relaxed
- > Treiber_HP_member_disposer_relaxed;
- }}
-
- TEST(Treiber_HP_default)
- TEST(Treiber_HP_base)
- TEST(Treiber_HP_base_disposer)
- TEST(Treiber_HP_member)
- TEST(Treiber_HP_member_disposer)
-
- TEST(Treiber_HP_default_relaxed)
- TEST(Treiber_HP_base_relaxed)
- TEST(Treiber_HP_base_disposer_relaxed)
- TEST(Treiber_HP_member_relaxed)
- TEST(Treiber_HP_member_disposer_relaxed)
-
-} // namespace stack
-
-CPPUNIT_TEST_SUITE_REGISTRATION(stack::TestIntrusiveStack);
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef CDSTEST_HDR_TREIBER_STACK_H
-#define CDSTEST_HDR_TREIBER_STACK_H
-
-#include "cppunit/cppunit_proxy.h"
-
-namespace stack {
-
- class TestStack: public CppUnitMini::TestCase
- {
- template <class Stack>
- void test()
- {
- Stack s;
- test_with( s );
- }
-
- template <class Stack>
- void test_elimination()
- {
- Stack s(2);
- test_with( s );
- }
-
- template <class Stack>
- void test_with( Stack& stack)
- {
- typedef typename Stack::value_type value_type;
- value_type v;
-
- CPPUNIT_ASSERT( stack.empty() );
-
- CPPUNIT_ASSERT( stack.push(1));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.push(2));
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.push(3));
- CPPUNIT_ASSERT( !stack.empty() );
-
- CPPUNIT_ASSERT( stack.pop(v) );
- CPPUNIT_ASSERT( v == 3 );
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.pop_with( [&v]( value_type& src ) { v = src; } ));
- CPPUNIT_ASSERT( v == 2 );
- CPPUNIT_ASSERT( !stack.empty() );
- CPPUNIT_ASSERT( stack.pop(v) );
- CPPUNIT_ASSERT( v == 1 );
- CPPUNIT_ASSERT( stack.empty() );
- v = 1000;
- CPPUNIT_ASSERT( !stack.pop(v) );
- CPPUNIT_ASSERT( v == 1000 );
- CPPUNIT_ASSERT( stack.empty() );
-
- CPPUNIT_ASSERT( stack.push(10));
- CPPUNIT_ASSERT( stack.push(20));
- CPPUNIT_ASSERT( stack.push(30));
- CPPUNIT_ASSERT( !stack.empty());
-
- CPPUNIT_ASSERT( stack.emplace(100));
- CPPUNIT_ASSERT( stack.pop(v));
- CPPUNIT_ASSERT( v == 100 );
-
- stack.clear();
- CPPUNIT_ASSERT( stack.empty() );
-
- Stack::gc::scan();
- }
-
- void Treiber_HP();
- void Treiber_DHP();
- void Treiber_HP_yield();
- void Treiber_DHP_yield();
- void Treiber_HP_pause_alloc();
- void Treiber_DHP_pause_alloc();
-
- void Treiber_HP_relaxed();
- void Treiber_DHP_relaxed();
- void Treiber_HP_yield_relaxed();
- void Treiber_DHP_yield_relaxed();
- void Treiber_HP_pause_alloc_relaxed();
- void Treiber_DHP_pause_alloc_relaxed();
-
- void Elimination_HP();
- void Elimination_HP_dyn();
- void Elimination_HP_stat();
- void Elimination_DHP();
- void Elimination_DHP_dyn();
- void Elimination_DHP_stat();
- void Elimination_HP_yield();
- void Elimination_DHP_yield();
- void Elimination_HP_pause_alloc();
- void Elimination_DHP_pause_alloc();
-
- void Elimination_HP_relaxed();
- void Elimination_DHP_relaxed();
- void Elimination_HP_yield_relaxed();
- void Elimination_DHP_yield_relaxed();
- void Elimination_HP_pause_alloc_relaxed();
- void Elimination_DHP_pause_alloc_relaxed();
-
- CPPUNIT_TEST_SUITE(TestStack);
- CPPUNIT_TEST(Treiber_HP)
- CPPUNIT_TEST(Treiber_HP_relaxed)
- CPPUNIT_TEST(Treiber_DHP)
- CPPUNIT_TEST(Treiber_DHP_relaxed)
- CPPUNIT_TEST(Treiber_HP_yield)
- CPPUNIT_TEST(Treiber_HP_yield_relaxed)
- CPPUNIT_TEST(Treiber_DHP_yield)
- CPPUNIT_TEST(Treiber_DHP_yield_relaxed)
- CPPUNIT_TEST(Treiber_HP_pause_alloc)
- CPPUNIT_TEST(Treiber_HP_pause_alloc_relaxed)
- CPPUNIT_TEST(Treiber_DHP_pause_alloc)
- CPPUNIT_TEST(Treiber_DHP_pause_alloc_relaxed)
-
- CPPUNIT_TEST(Elimination_HP)
- CPPUNIT_TEST(Elimination_HP_dyn)
- CPPUNIT_TEST(Elimination_HP_stat)
- CPPUNIT_TEST(Elimination_HP_relaxed)
- CPPUNIT_TEST(Elimination_DHP)
- CPPUNIT_TEST(Elimination_DHP_dyn)
- CPPUNIT_TEST(Elimination_DHP_stat)
- CPPUNIT_TEST(Elimination_DHP_relaxed)
- CPPUNIT_TEST(Elimination_HP_yield)
- CPPUNIT_TEST(Elimination_HP_yield_relaxed)
- CPPUNIT_TEST(Elimination_DHP_yield)
- CPPUNIT_TEST(Elimination_DHP_yield_relaxed)
- CPPUNIT_TEST(Elimination_HP_pause_alloc)
- CPPUNIT_TEST(Elimination_HP_pause_alloc_relaxed)
- CPPUNIT_TEST(Elimination_DHP_pause_alloc)
- CPPUNIT_TEST(Elimination_DHP_pause_alloc_relaxed)
- CPPUNIT_TEST_SUITE_END();
- };
-} // namespace stack
-
-#endif // #ifndef CDSTEST_HDR_TREIBER_STACK_H
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hdr_treiber_stack.h"
-#include <cds/gc/dhp.h>
-#include <cds/container/treiber_stack.h>
-
-namespace stack {
-#define TEST(X) void TestStack::X() { test<defs::X>(); }
- namespace cs = cds::container;
-
- namespace defs { namespace {
-
- typedef cs::TreiberStack< cds::gc::DHP, int > Treiber_DHP;
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- >::type
- > Treiber_DHP_relaxed;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::yield>
- >::type
- > Treiber_DHP_yield;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::yield>
- ,cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- >::type
- > Treiber_DHP_yield_relaxed;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::pause>
- ,cds::opt::allocator< std::allocator< bool * > >
- >::type
- > Treiber_DHP_pause_alloc;
-
- typedef cs::TreiberStack< cds::gc::DHP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- ,cds::opt::back_off< cds::backoff::pause>
- ,cds::opt::allocator< std::allocator< bool * > >
- >::type
- > Treiber_DHP_pause_alloc_relaxed;
- }}
-
- TEST(Treiber_DHP)
- TEST(Treiber_DHP_yield)
- TEST(Treiber_DHP_pause_alloc)
-
- TEST(Treiber_DHP_relaxed)
- TEST(Treiber_DHP_yield_relaxed)
- TEST(Treiber_DHP_pause_alloc_relaxed)
-
-}
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "hdr_treiber_stack.h"
-#include <cds/gc/hp.h>
-#include <cds/container/treiber_stack.h>
-
-
-namespace stack {
-#define TEST(X) void TestStack::X() { test<defs::X>(); }
- namespace cs = cds::container;
-
- namespace defs { namespace {
-
- typedef cs::TreiberStack< cds::gc::HP, int > Treiber_HP;
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- >::type
- > Treiber_HP_relaxed;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::yield>
- >::type
- > Treiber_HP_yield;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::yield>
- , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- >::type
- > Treiber_HP_yield_relaxed;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::pause>
- ,cds::opt::allocator< std::allocator< bool * > >
- >::type
- > Treiber_HP_pause_alloc;
-
- typedef cs::TreiberStack< cds::gc::HP, int
- , typename cs::treiber_stack::make_traits<
- cds::opt::back_off< cds::backoff::pause>
- ,cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- ,cds::opt::allocator< std::allocator< unsigned long > >
- >::type
- > Treiber_HP_pause_alloc_relaxed;
- }}
-
- TEST(Treiber_HP)
- TEST(Treiber_HP_yield)
- TEST(Treiber_HP_pause_alloc)
-
- TEST(Treiber_HP_relaxed)
- TEST(Treiber_HP_yield_relaxed)
- TEST(Treiber_HP_pause_alloc_relaxed)
-}
-CPPUNIT_TEST_SUITE_REGISTRATION(stack::TestStack);