CDSUNIT_PQUEUE_SOURCES := $(CDSUNIT_PQUEUE_SOURCES:%.cpp=../%.cpp)
CDSUNIT_PQUEUE_OBJS := $(CDSUNIT_PQUEUE_SOURCES:%.cpp=%.o)
-include ../projects/source.unit.stack.mk
-CDSUNIT_STACK_SOURCES := $(CDSUNIT_STACK_SOURCES:%.cpp=../%.cpp)
-CDSUNIT_STACK_OBJS := $(CDSUNIT_STACK_SOURCES:%.cpp=%.o)
-
include ../projects/source.unit.misc.mk
CDSUNIT_MISC_SOURCES := $(CDSUNIT_MISC_SOURCES:%.cpp=../%.cpp)
CDSUNIT_MISC_OBJS := $(CDSUNIT_MISC_SOURCES:%.cpp=%.o)
CDSUNIT_SET_EXE=$(BIN_PATH)/cdsu-set
CDSUNIT_QUEUE_EXE=$(BIN_PATH)/cdsu-queue
CDSUNIT_PQUEUE_EXE=$(BIN_PATH)/cdsu-pqueue
-CDSUNIT_STACK_EXE=$(BIN_PATH)/cdsu-stack
CDSUNIT_MISC_EXE=$(BIN_PATH)/cdsu-misc
-CDSUNIT_EXE_FILES= $(CDSUNIT_MAP_EXE) $(CDSUNIT_SET_EXE) $(CDSUNIT_QUEUE_EXE) $(CDSUNIT_PQUEUE_EXE) $(CDSUNIT_STACK_EXE) $(CDSUNIT_MISC_EXE)
+CDSUNIT_EXE_FILES= $(CDSUNIT_MAP_EXE) $(CDSUNIT_SET_EXE) $(CDSUNIT_QUEUE_EXE) $(CDSUNIT_PQUEUE_EXE) $(CDSUNIT_MISC_EXE)
unit-map: $(CDSUNIT_MAP_EXE)
unit-set: $(CDSUNIT_SET_EXE)
unit-queue: $(CDSUNIT_QUEUE_EXE)
unit-pqueue: $(CDSUNIT_PQUEUE_EXE)
-unit-stack: $(CDSUNIT_STACK_EXE)
ifeq ($(platform),mingw)
make_test : $(BIN_PATH)/test-hdr $(CDSUNIT_EXE_FILES)
$(CDSUNIT_PQUEUE_EXE) : $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
$(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS)
-$(CDSUNIT_STACK_EXE) : $(CDSUNIT_STACK_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
- $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_STACK_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS)
-
$(CDSUNIT_MISC_EXE) : $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
$(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS)
CDSUNIT_SET_EXE_DBG=$(CDSUNIT_SET_EXE)-d
CDSUNIT_QUEUE_EXE_DBG=$(CDSUNIT_QUEUE_EXE)-d
CDSUNIT_PQUEUE_EXE_DBG=$(CDSUNIT_PQUEUE_EXE)-d
-CDSUNIT_STACK_EXE_DBG=$(CDSUNIT_STACK_EXE)-d
CDSUNIT_MISC_EXE_DBG=$(CDSUNIT_MISC_EXE)-d
CDSUNIT_EXE_DBG_FILES= $(CDSUNIT_MAP_EXE_DBG) $(CDSUNIT_SET_EXE_DBG) $(CDSUNIT_QUEUE_EXE_DBG) $(CDSUNIT_PQUEUE_EXE_DBG) \
- $(CDSUNIT_STACK_EXE_DBG) $(CDSUNIT_MISC_EXE_DBG)
+ $(CDSUNIT_MISC_EXE_DBG)
unit-map-dbg: $(CDSUNIT_MAP_EXE_DBG)
unit-set-dbg: $(CDSUNIT_SET_EXE_DBG)
unit-queue-dbg: $(CDSUNIT_QUEUE_EXE_DBG)
unit-pqueue-dbg: $(CDSUNIT_PQUEUE_EXE_DBG)
-unit-stack-dbg: $(CDSUNIT_STACK_EXE_DBG)
ifeq ($(platform),mingw)
make_debug_test : $(BIN_PATH)/test-hdr-debug $(CDSUNIT_EXE_DBG_FILES)
$(CDSUNIT_PQUEUE_EXE_DBG) : $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
$(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS)
-$(CDSUNIT_STACK_EXE_DBG) : $(CDSUNIT_STACK_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
- $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_STACK_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS)
-
$(CDSUNIT_MISC_EXE_DBG) : $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
$(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS)
{408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
EndProjectSection\r
EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-stack", "unit-stack.vcxproj", "{E29DE1F7-AE8D-4AE6-98B1-147E5103D974}"\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("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "single-threaded test", "single-threaded test", "{B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}"\r
ProjectSection(SolutionItems) = preProject\r
..\..\..\tests\test-hdr\size_check.h = ..\..\..\tests\test-hdr\size_check.h\r
{6C15AF8A-4A99-49F9-BCF0-1BF36771099A}.Release|Win32.Build.0 = Release|Win32\r
{6C15AF8A-4A99-49F9-BCF0-1BF36771099A}.Release|x64.ActiveCfg = Release|x64\r
{6C15AF8A-4A99-49F9-BCF0-1BF36771099A}.Release|x64.Build.0 = Release|x64\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Debug|Win32.ActiveCfg = Debug|Win32\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Debug|Win32.Build.0 = Debug|Win32\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Debug|x64.ActiveCfg = Debug|x64\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Debug|x64.Build.0 = Debug|x64\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.DebugVLD|Win32.ActiveCfg = Debug|Win32\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.DebugVLD|Win32.Build.0 = Debug|Win32\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.DebugVLD|x64.ActiveCfg = DebugVLD|x64\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.DebugVLD|x64.Build.0 = DebugVLD|x64\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Release|Win32.ActiveCfg = Release|Win32\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Release|Win32.Build.0 = Release|Win32\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Release|x64.ActiveCfg = Release|x64\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Release|x64.Build.0 = Release|x64\r
{282E9A9A-386A-40FB-A483-994BACE24830}.Debug|Win32.ActiveCfg = Debug|Win32\r
{282E9A9A-386A-40FB-A483-994BACE24830}.Debug|Win32.Build.0 = Debug|Win32\r
{282E9A9A-386A-40FB-A483-994BACE24830}.Debug|x64.ActiveCfg = Debug|x64\r
{61179F2F-07E1-490D-B64D-D85A90B6EF81} = {B30CA283-1796-4763-92C3-2E4848D443F7}\r
{77350FDC-9E51-438B-9A8F-D2FEA11D46B2} = {B30CA283-1796-4763-92C3-2E4848D443F7}\r
{6C15AF8A-4A99-49F9-BCF0-1BF36771099A} = {B30CA283-1796-4763-92C3-2E4848D443F7}\r
- {E29DE1F7-AE8D-4AE6-98B1-147E5103D974} = {B30CA283-1796-4763-92C3-2E4848D443F7}\r
{282E9A9A-386A-40FB-A483-994BACE24830} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{C5E76975-B87B-4B9E-8596-B01DDA683FCA} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{6BB7A27F-FC59-4267-B6FA-D034176D1459} = {B30CA283-1796-4763-92C3-2E4848D443F7}\r
+++ /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>{E29DE1F7-AE8D-4AE6-98B1-147E5103D974}</ProjectGuid>\r
- <RootNamespace>unitstack</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)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</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>Unicode</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</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>Unicode</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</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)'=='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|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|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
- <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
- <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
- <OutDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugVLD|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
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugVLD|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)'=='DebugVLD|Win32'">$(ProjectName)_d</TargetName>\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(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\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_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
- <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
- <TargetMachine>MachineX86</TargetMachine>\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\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_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
- <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
- <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\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_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
- <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
- <TargetMachine>MachineX64</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\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_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
- <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
- <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>MaxSpeed</Optimization>\r
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
- <IntrinsicFunctions>true</IntrinsicFunctions>\r
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
- <FunctionLevelLinking>true</FunctionLevelLinking>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites.lib;%(AdditionalDependencies)</AdditionalDependencies>\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
- <TargetMachine>MachineX86</TargetMachine>\r
- <OutputFile>$(TargetPath)</OutputFile>\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>MaxSpeed</Optimization>\r
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
- <IntrinsicFunctions>true</IntrinsicFunctions>\r
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
- <FunctionLevelLinking>true</FunctionLevelLinking>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites.lib;%(AdditionalDependencies)</AdditionalDependencies>\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
- <TargetMachine>MachineX64</TargetMachine>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClCompile Include="..\..\..\tests\unit\stack\stack_intrusive_pushpop.cpp" />\r
- <ClCompile Include="..\..\..\tests\unit\stack\stack_push.cpp" />\r
- <ClCompile Include="..\..\..\tests\unit\stack\stack_pushpop.cpp" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="..\..\..\tests\unit\stack\intrusive_stack_type.h" />\r
- <ClInclude Include="..\..\..\tests\unit\stack\intrusive_stack_defs.h" />\r
- <ClInclude Include="..\..\..\tests\unit\stack\stack_type.h" />\r
- <ClInclude Include="..\..\..\tests\unit\stack\stack_defs.h" />\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
-
-CDSUNIT_STACK_SOURCES := \
- tests/unit/stack/stack_push.cpp \
- tests/unit/stack/stack_pushpop.cpp \
- tests/unit/stack/stack_intrusive_pushpop.cpp
-
+++ /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_LAZY_H
-#define CDSTEST_HDR_INTRUSIVE_LAZY_H
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/intrusive/details/lazy_list_base.h>
-
-namespace ordlist {
- namespace ci = cds::intrusive;
- namespace co = cds::opt;
-
- class IntrusiveLazyListHeaderTest: public CppUnitMini::TestCase
- {
- public:
-
- struct stat {
- int nDisposeCount;
- int nUpdateExistsCall;
- int nUpdateNewCall;
- int nFindCall;
- int nEraseCall;
-
- stat()
- : nDisposeCount(0)
- , nUpdateExistsCall(0)
- , nUpdateNewCall(0)
- , nFindCall(0)
- , nEraseCall(0)
- {}
-
- stat( const stat& s )
- {
- *this = s;
- }
-
- stat& operator =(const stat& s)
- {
- memcpy( this, &s, sizeof(s));
- return *this;
- }
- };
-
- template <typename GC>
- struct base_int_item: public ci::lazy_list::node< GC >
- {
- int nKey;
- int nVal;
-
- mutable stat s;
-
- base_int_item()
- {}
-
- base_int_item(int key, int val)
- : nKey( key )
- , nVal(val)
- , s()
- {}
-
- base_int_item(const base_int_item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
- };
-
- template <typename GC>
- struct member_int_item
- {
- int nKey;
- int nVal;
-
- ci::lazy_list::node< GC > hMember;
-
- mutable stat s;
-
- member_int_item()
- {}
-
- member_int_item(int key, int val)
- : nKey( key )
- , nVal(val)
- , s()
- {}
-
- member_int_item(const member_int_item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
- };
-
- template <typename T>
- struct less
- {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1.key() < v2.key();
- }
-
- template <typename Q>
- bool operator ()(const T& v1, const Q& v2 ) const
- {
- return v1.key() < v2;
- }
-
- template <typename Q>
- bool operator ()(const Q& v1, const T& v2 ) const
- {
- return v1 < v2.key();
- }
- };
-
- template <typename T>
- struct cmp {
- int operator ()(const T& v1, const T& v2 ) const
- {
- if ( v1.key() < v2.key() )
- return -1;
- return v1.key() > v2.key() ? 1 : 0;
- }
-
- template <typename Q>
- int operator ()(const T& v1, const Q& v2 ) const
- {
- if ( v1.key() < v2 )
- return -1;
- return v1.key() > v2 ? 1 : 0;
- }
-
- template <typename Q>
- int operator ()(const Q& v1, const T& v2 ) const
- {
- if ( v1 < v2.key() )
- return -1;
- return v1 > v2.key() ? 1 : 0;
- }
- };
-
- template <typename T>
- struct equal_to {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1.key() == v2.key();
- }
-
- template <typename Q>
- bool operator ()(const T& v1, const Q& v2 ) const
- {
- return v1.key() == v2;
- }
-
- template <typename Q>
- bool operator ()(const Q& v1, const T& v2 ) const
- {
- return v1 == v2.key();
- }
- };
-
- struct other_item {
- int nKey;
-
- other_item( int n )
- : nKey(n)
- {}
- };
-
- struct other_less {
- template <typename T, typename Q>
- bool operator()( T const& i1, Q const& i2) const
- {
- return i1.nKey < i2.nKey;
- }
- };
-
- struct other_equal {
- template <typename T, typename Q>
- bool operator()( T const& i1, Q const& i2) const
- {
- return i1.nKey == i2.nKey;
- }
- };
-
- struct faked_disposer
- {
- template <typename T>
- void operator ()( T * p )
- {
- ++p->s.nDisposeCount;
- }
- };
-
- struct update_functor
- {
- template <typename T>
- void operator ()(bool bNew, T& item, T& /*val*/ )
- {
- if ( bNew )
- ++item.s.nUpdateNewCall;
- else
- ++item.s.nUpdateExistsCall;
- }
- };
-
- struct find_functor
- {
- template <typename T, typename Q>
- void operator ()( T& item, Q& /*val*/ )
- {
- ++item.s.nFindCall;
- }
- };
-
- struct erase_functor
- {
- template <typename T>
- void operator()( T const& item )
- {
- item.s.nEraseCall++;
- }
- };
-
- template <class OrdList>
- void test_int_common()
- {
- typedef typename OrdList::value_type value_type;
-
- value_type v1( 10, 50 );
- value_type v2( 5, 25 );
- value_type v3( 20, 100 );
- {
- OrdList l;
- CPPUNIT_ASSERT( l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v1 )) ; // true
- CPPUNIT_ASSERT( l.contains( v1.key() ));
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( !l.contains( v2.key(), less<value_type>() ));
- CPPUNIT_ASSERT( !l.find( v3.key(), find_functor() ));
- CPPUNIT_ASSERT( !l.empty() );
-
- //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised
-
- {
- value_type v( v1 );
- CPPUNIT_ASSERT( !l.insert( v )) ; // false
- }
-
- std::pair<bool, bool> ret = l.update( v2, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 );
-
- //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty"
-
- CPPUNIT_ASSERT( l.contains( v1.key() )) ; // true
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 2 );
-
- CPPUNIT_ASSERT( l.contains( v2.key() ));
-
- CPPUNIT_ASSERT( v2.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find_with( v2.key(), less<value_type>(), find_functor() ));
- CPPUNIT_ASSERT( v2.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( !l.contains( v3.key() ));
-
- {
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
-
- value_type v( v2 );
- ret = l.update( v, update_functor() );
-
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( !ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
- CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 );
- CPPUNIT_ASSERT( v.s.nUpdateNewCall == 0 );
- }
-
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v3 )) ; // true
- CPPUNIT_ASSERT( l.contains( v3.key() ));
-
- CPPUNIT_ASSERT( v3.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v3.key(), find_functor() ));
- CPPUNIT_ASSERT( v3.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( l.unlink( v2 ) );
- CPPUNIT_ASSERT( l.contains( v1.key() )) ; // true
- CPPUNIT_ASSERT( !l.contains( v2.key() )) ; // true
- CPPUNIT_ASSERT( l.contains( v3.key() )) ; // true
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( !l.unlink( v2 ) );
-
- {
- // v1 key is in the list but v NODE is not in the list
- value_type v( v1 );
- CPPUNIT_ASSERT( !l.unlink( v ) );
- }
-
- CPPUNIT_ASSERT( l.unlink( v1 ) );
- CPPUNIT_ASSERT( !l.unlink( v1 ) );
- CPPUNIT_ASSERT( !l.contains( v1.key() ));
- CPPUNIT_ASSERT( !l.contains( v2.key() ));
- CPPUNIT_ASSERT( l.contains( v3.key() ));
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( !l.unlink( v1 ) );
- CPPUNIT_ASSERT( !l.unlink( v2 ) );
-
- CPPUNIT_ASSERT( l.unlink( v3 ) );
- CPPUNIT_ASSERT( !l.contains( v1.key() ));
- CPPUNIT_ASSERT( !l.contains( v2.key(), less<value_type>() ));
- CPPUNIT_ASSERT( !l.contains( v3.key() ));
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( !l.unlink( v1 ) );
- CPPUNIT_ASSERT( !l.unlink( v2 ) );
- CPPUNIT_ASSERT( !l.unlink( v3 ) );
-
- // Apply retired pointer to clean links
- OrdList::gc::force_dispose();
-
- stat s( v3.s );
- ret = l.update( v3, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v3.s.nUpdateNewCall == s.nUpdateNewCall + 1);
- CPPUNIT_ASSERT( v3.s.nUpdateExistsCall == s.nUpdateExistsCall );
- CPPUNIT_ASSERT( !l.empty() );
-
- s = v2.s;
- ret = l.update( v2, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == s.nUpdateNewCall + 1);
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == s.nUpdateExistsCall );
- CPPUNIT_ASSERT( !l.empty() );
-
- s = v1.s;
- ret = l.update( v1, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v1.s.nUpdateNewCall == s.nUpdateNewCall + 1);
- CPPUNIT_ASSERT( v1.s.nUpdateExistsCall == s.nUpdateExistsCall );
- CPPUNIT_ASSERT( !l.empty() );
-
- // Erase test
- CPPUNIT_ASSERT( l.erase( v1.key()) );
- //CPPUNIT_ASSERT( v1.s.nDisposeCount == 0 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( v2.s.nEraseCall == 0 );
- CPPUNIT_ASSERT( l.erase_with( v2.key(), less<value_type>(), erase_functor()) );
- CPPUNIT_ASSERT( v2.s.nEraseCall == 1 );
- CPPUNIT_ASSERT( !l.erase_with( v2.key(), less<value_type>()));
- CPPUNIT_ASSERT( v2.s.nEraseCall == 1 );
- //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( !l.erase( v2 ));
- CPPUNIT_ASSERT( !l.erase( v1 ));
- //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( v3.s.nEraseCall == 0 );
- CPPUNIT_ASSERT( l.erase( v3, erase_functor() ));
- CPPUNIT_ASSERT( v3.s.nEraseCall == 1 );
- //CPPUNIT_ASSERT( v3.s.nDisposeCount == 0 );
- CPPUNIT_ASSERT( l.empty() );
-
- // Apply retired pointer to clean links
- OrdList::gc::force_dispose();
-
- // Unlink test
- CPPUNIT_ASSERT( l.insert( v1 ));
- CPPUNIT_ASSERT( l.insert( v3 ));
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( !l.unlink( v2 ));
- CPPUNIT_ASSERT( l.unlink( v1 ));
- CPPUNIT_ASSERT( !l.unlink( v1 ));
- CPPUNIT_ASSERT( l.unlink( v3 ));
- CPPUNIT_ASSERT( !l.unlink( v3 ));
- CPPUNIT_ASSERT( l.empty() );
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
- CPPUNIT_ASSERT( v1.s.nDisposeCount == 3 );
- CPPUNIT_ASSERT( v2.s.nDisposeCount == 2 );
- CPPUNIT_ASSERT( v3.s.nDisposeCount == 3 );
-
- // Destructor test (call disposer)
- CPPUNIT_ASSERT( l.insert( v1 ));
- CPPUNIT_ASSERT( l.insert( v3 ));
- CPPUNIT_ASSERT( l.insert( v2 ));
-
- // Iterator test
- {
- typename OrdList::iterator it = l.begin();
- typename OrdList::const_iterator cit = l.cbegin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it != l.cend() );
- CPPUNIT_ASSERT( cit != l.end() );
- CPPUNIT_ASSERT( cit != l.cend() );
- CPPUNIT_ASSERT( cit == it );
-
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( ++it == l.end() );
- }
-
- {
- OrdList const & lref = l;
- typename OrdList::const_iterator it = lref.begin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != lref.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( ++it == l.end() );
- }
- }
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
-
- CPPUNIT_ASSERT( v1.s.nDisposeCount == 4 );
- CPPUNIT_ASSERT( v2.s.nDisposeCount == 3 );
- CPPUNIT_ASSERT( v3.s.nDisposeCount == 4 );
- }
-
- template <class OrdList>
- void test_int()
- {
- test_int_common<OrdList>();
-
- OrdList l;
- typename OrdList::guarded_ptr gp;
-
- static int const nLimit = 20;
- typename OrdList::value_type arrItem[nLimit];
-
- {
- int a[nLimit];
- for (int i = 0; i < nLimit; ++i)
- a[i]=i;
- shuffle( a, a + nLimit );
-
- for (int i = 0; i < nLimit; ++i) {
- arrItem[i].nKey = a[i];
- arrItem[i].nVal = a[i] * 2;
- }
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
-
- for ( int i=0; i < nLimit; ++i ) {
- gp = l.get( arrItem[i].nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey );
- CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal );
-
- gp = l.extract( arrItem[i].nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey );
- CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal );
-
- gp = l.get( arrItem[i].nKey );
- CPPUNIT_ASSERT( !gp );
- CPPUNIT_ASSERT( gp.empty());
- CPPUNIT_ASSERT( !l.extract( arrItem[i].nKey ));
- CPPUNIT_ASSERT( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( !l.get( nLimit/2 ));
- CPPUNIT_ASSERT( !l.extract( nLimit/2 ));
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
-
- for ( int i=0; i < nLimit; ++i ) {
- other_item itm( arrItem[i].nKey );
- gp = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey );
- CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal );
-
- gp = l.extract_with( itm, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey );
- CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal );
-
- gp = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT( !gp );
- CPPUNIT_ASSERT( gp.empty());
- CPPUNIT_ASSERT( !l.extract_with( itm, other_less() ));
- CPPUNIT_ASSERT( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( !l.get_with( other_item(nLimit/2), other_less() ));
- CPPUNIT_ASSERT( gp.empty());
- CPPUNIT_ASSERT( !l.extract_with( other_item(nLimit/2), other_less() ));
- CPPUNIT_ASSERT( gp.empty());
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
-
- for ( int i=0; i < nLimit; i++ ) {
- CPPUNIT_ASSERT( arrItem[i].s.nDisposeCount == 2 );
- }
- }
- }
-
- template <class OrdList>
- void test_rcu_int()
- {
- test_int_common<OrdList>();
-
- OrdList l;
- static int const nLimit = 20;
- typename OrdList::value_type arrItem[nLimit];
-
- typedef typename OrdList::rcu_lock rcu_lock;
- typedef typename OrdList::value_type value_type;
- typedef typename OrdList::gc rcu_type;
-
- {
- int a[nLimit];
- for (int i = 0; i < nLimit; ++i)
- a[i]=i;
- shuffle( a, a + nLimit );
-
- for (int i = 0; i < nLimit; ++i) {
- arrItem[i].nKey = a[i];
- arrItem[i].nVal = a[i] * 2;
- }
-
- typename OrdList::exempt_ptr ep;
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
-
- for ( int i = 0; i < nLimit; ++i ) {
- {
- rcu_lock lock;
- value_type * pGet = l.get( a[i] );
- CPPUNIT_ASSERT( pGet != nullptr );
- CPPUNIT_CHECK( pGet->nKey == a[i] );
- CPPUNIT_CHECK( pGet->nVal == a[i] * 2 );
-
- ep = l.extract( a[i] );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->nKey == a[i] );
- CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 );
- }
- ep.release();
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get( a[i] ) == nullptr );
- CPPUNIT_CHECK( !l.extract( a[i] ) );
- CPPUNIT_CHECK( ep.empty() );
- }
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get( a[0] ) == nullptr );
- ep = l.extract( a[0] );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- // Apply retired pointer
- OrdList::gc::force_dispose();
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i ) {
- CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
- }
-
- for ( int i = 0; i < nLimit; ++i ) {
- other_item itm( a[i] );
- {
- rcu_lock lock;
- value_type * pGet = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT( pGet != nullptr );
- CPPUNIT_CHECK( pGet->nKey == a[i] );
- CPPUNIT_CHECK( pGet->nVal == a[i] * 2 );
-
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->nKey == a[i] );
- CPPUNIT_CHECK( ep->nVal == a[i] * 2 );
- }
- ep.release();
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr );
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr );
- CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() ));
- CPPUNIT_CHECK( ep.empty() );
- }
- // Apply retired pointer
- OrdList::gc::force_dispose();
- }
- }
-
- template <class OrdList>
- void test_nogc_int()
- {
- typedef typename OrdList::value_type value_type;
-
- {
- value_type v1( 10, 50 );
- value_type v2( 5, 25 );
- value_type v3( 20, 100 );
- {
- OrdList l;
- CPPUNIT_ASSERT( l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v1 )) ; // true
- CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 );
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( l.contains( v2.key(), less<value_type>() ) == nullptr );
- CPPUNIT_ASSERT( l.contains( v3.key() ) == nullptr );
- CPPUNIT_ASSERT( !l.empty() );
-
- //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised
-
- {
- value_type v( v1 );
- CPPUNIT_ASSERT( !l.insert( v )) ; // false
- }
-
- std::pair<bool, bool> ret = l.update( v2, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 );
-
- //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty"
-
- CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ) ; // true
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 2 );
-
- CPPUNIT_ASSERT( l.contains( v2.key(), less<value_type>() ) == &v2 );
-
- CPPUNIT_ASSERT( v2.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find_with( v2.key(), less<value_type>(), find_functor() ));
- CPPUNIT_ASSERT( v2.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( !l.contains( v3.key() ));
-
- {
- value_type v( v2 );
- ret = l.update( v, update_functor() );
-
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( !ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 );
- CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 && v.s.nUpdateNewCall == 0 );
- }
-
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v3 )) ; // true
- CPPUNIT_ASSERT( l.contains( v3.key() ) == &v3 );
-
- CPPUNIT_ASSERT( v3.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v3.key(), find_functor() ));
- CPPUNIT_ASSERT( v3.s.nFindCall == 1 );
-
- {
- typename OrdList::iterator it = l.begin();
- typename OrdList::const_iterator cit = l.cbegin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it != l.cend() );
- CPPUNIT_ASSERT( cit != l.end() );
- CPPUNIT_ASSERT( cit != l.cend() );
- CPPUNIT_ASSERT( cit == it );
-
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it == l.end() );
- }
-
- {
- OrdList const & lref = l;
- typename OrdList::const_iterator it = lref.begin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != lref.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( it++ != lref.end() );
- CPPUNIT_ASSERT( it == l.end() );
- }
- }
-
- // Disposer called on list destruction
- CPPUNIT_ASSERT( v1.s.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v2.s.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v3.s.nDisposeCount == 1 );
- }
- }
-
- template <class UnordList>
- void test_nogc_int_unordered()
- {
- typedef typename UnordList::value_type value_type;
- {
- value_type v1( 10, 50 );
- value_type v2( 5, 25 );
- value_type v3( 20, 100 );
- {
- UnordList l;
- CPPUNIT_ASSERT( l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v1 )); // true
- CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 );
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( l.contains( v2.key(), equal_to<value_type>() ) == nullptr );
- CPPUNIT_ASSERT( l.contains( v3.key() ) == nullptr );
- CPPUNIT_ASSERT( !l.empty() );
-
- //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised
-
- {
- value_type v( v1 );
- CPPUNIT_ASSERT( !l.insert( v )) ; // false
- }
-
- std::pair<bool, bool> ret = l.update( v2, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 );
-
- //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty"
-
- CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ) ; // true
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 2 );
-
- CPPUNIT_ASSERT( l.contains( v2.key(), equal_to<value_type>() ) == &v2 );
-
- CPPUNIT_ASSERT( v2.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find_with( v2.key(), equal_to<value_type>(), find_functor() ));
- CPPUNIT_ASSERT( v2.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( !l.contains( v3.key() ));
-
- {
- value_type v( v2 );
- ret = l.update( v, update_functor() );
-
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( !ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 );
- CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 && v.s.nUpdateNewCall == 0 );
- }
-
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v3 )) ; // true
- CPPUNIT_ASSERT( l.contains( v3.key() ) == &v3 );
-
- CPPUNIT_ASSERT( v3.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v3.key(), find_functor() ));
- CPPUNIT_ASSERT( v3.s.nFindCall == 1 );
-
- {
- typename UnordList::iterator it = l.begin();
- typename UnordList::const_iterator cit = l.cbegin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it != l.cend() );
- CPPUNIT_ASSERT( cit != l.end() );
- CPPUNIT_ASSERT( cit != l.cend() );
- CPPUNIT_ASSERT( cit == it );
-
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it == l.end() );
- }
-
- {
- UnordList const & lref = l;
- typename UnordList::const_iterator it = lref.begin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( ++it != lref.end() );
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( it++ != lref.end() );
- CPPUNIT_ASSERT( it == l.end() );
- }
- }
-
- // Disposer called on list destruction
- CPPUNIT_ASSERT( v1.s.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v2.s.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v3.s.nDisposeCount == 1 );
- }
- }
-
-
- void HP_base_cmp();
- void HP_base_less();
- void HP_base_cmpmix();
- void HP_base_ic();
- void HP_member_cmp();
- void HP_member_less();
- void HP_member_cmpmix();
- void HP_member_ic();
-
- void DHP_base_cmp();
- void DHP_base_less();
- void DHP_base_cmpmix();
- void DHP_base_ic();
- void DHP_member_cmp();
- void DHP_member_less();
- void DHP_member_cmpmix();
- void DHP_member_ic();
-
- void RCU_GPI_base_cmp();
- void RCU_GPI_base_less();
- void RCU_GPI_base_cmpmix();
- void RCU_GPI_base_ic();
- void RCU_GPI_member_cmp();
- void RCU_GPI_member_less();
- void RCU_GPI_member_cmpmix();
- void RCU_GPI_member_ic();
-
- void RCU_GPB_base_cmp();
- void RCU_GPB_base_less();
- void RCU_GPB_base_cmpmix();
- void RCU_GPB_base_ic();
- void RCU_GPB_member_cmp();
- void RCU_GPB_member_less();
- void RCU_GPB_member_cmpmix();
- void RCU_GPB_member_ic();
-
- void RCU_GPT_base_cmp();
- void RCU_GPT_base_less();
- void RCU_GPT_base_cmpmix();
- void RCU_GPT_base_ic();
- void RCU_GPT_member_cmp();
- void RCU_GPT_member_less();
- void RCU_GPT_member_cmpmix();
- void RCU_GPT_member_ic();
-
- void RCU_SHB_base_cmp();
- void RCU_SHB_base_less();
- void RCU_SHB_base_cmpmix();
- void RCU_SHB_base_ic();
- void RCU_SHB_member_cmp();
- void RCU_SHB_member_less();
- void RCU_SHB_member_cmpmix();
- void RCU_SHB_member_ic();
-
- void RCU_SHT_base_cmp();
- void RCU_SHT_base_less();
- void RCU_SHT_base_cmpmix();
- void RCU_SHT_base_ic();
- void RCU_SHT_member_cmp();
- void RCU_SHT_member_less();
- void RCU_SHT_member_cmpmix();
- void RCU_SHT_member_ic();
-
- void nogc_base_cmp();
- void nogc_base_less();
- void nogc_base_cmpmix();
- void nogc_base_ic();
- void nogc_member_cmp();
- void nogc_member_less();
- void nogc_member_cmpmix();
- void nogc_member_ic();
-
- void nogc_base_cmp_unord();
- void nogc_base_less_unord();
- void nogc_base_equal_to_unord();
- void nogc_base_cmpmix_unord();
- void nogc_base_equal_to_mix_unord();
- void nogc_base_ic_unord();
- void nogc_member_cmp_unord();
- void nogc_member_less_unord();
- void nogc_member_equal_to_unord();
- void nogc_member_cmpmix_unord();
- void nogc_member_equal_to_mix_unord();
- void nogc_member_ic_unord();
-
- CPPUNIT_TEST_SUITE(IntrusiveLazyListHeaderTest)
- CPPUNIT_TEST(HP_base_cmp)
- CPPUNIT_TEST(HP_base_less)
- CPPUNIT_TEST(HP_base_cmpmix)
- CPPUNIT_TEST(HP_base_ic)
- CPPUNIT_TEST(HP_member_cmp)
- CPPUNIT_TEST(HP_member_less)
- CPPUNIT_TEST(HP_member_cmpmix)
- CPPUNIT_TEST(HP_member_ic)
-
- CPPUNIT_TEST(DHP_base_cmp)
- CPPUNIT_TEST(DHP_base_less)
- CPPUNIT_TEST(DHP_base_cmpmix)
- CPPUNIT_TEST(DHP_base_ic)
- CPPUNIT_TEST(DHP_member_cmp)
- CPPUNIT_TEST(DHP_member_less)
- CPPUNIT_TEST(DHP_member_cmpmix)
- CPPUNIT_TEST(DHP_member_ic)
-
- CPPUNIT_TEST(RCU_GPI_base_cmp)
- CPPUNIT_TEST(RCU_GPI_base_less)
- CPPUNIT_TEST(RCU_GPI_base_cmpmix)
- CPPUNIT_TEST(RCU_GPI_base_ic)
- CPPUNIT_TEST(RCU_GPI_member_cmp)
- CPPUNIT_TEST(RCU_GPI_member_less)
- CPPUNIT_TEST(RCU_GPI_member_cmpmix)
- CPPUNIT_TEST(RCU_GPI_member_ic)
-
- CPPUNIT_TEST(RCU_GPB_base_cmp)
- CPPUNIT_TEST(RCU_GPB_base_less)
- CPPUNIT_TEST(RCU_GPB_base_cmpmix)
- CPPUNIT_TEST(RCU_GPB_base_ic)
- CPPUNIT_TEST(RCU_GPB_member_cmp)
- CPPUNIT_TEST(RCU_GPB_member_less)
- CPPUNIT_TEST(RCU_GPB_member_cmpmix)
- CPPUNIT_TEST(RCU_GPB_member_ic)
-
- CPPUNIT_TEST(RCU_GPT_base_cmp)
- CPPUNIT_TEST(RCU_GPT_base_less)
- CPPUNIT_TEST(RCU_GPT_base_cmpmix)
- CPPUNIT_TEST(RCU_GPT_base_ic)
- CPPUNIT_TEST(RCU_GPT_member_cmp)
- CPPUNIT_TEST(RCU_GPT_member_less)
- CPPUNIT_TEST(RCU_GPT_member_cmpmix)
- CPPUNIT_TEST(RCU_GPT_member_ic)
-
- CPPUNIT_TEST(RCU_SHB_base_cmp)
- CPPUNIT_TEST(RCU_SHB_base_less)
- CPPUNIT_TEST(RCU_SHB_base_cmpmix)
- CPPUNIT_TEST(RCU_SHB_base_ic)
- CPPUNIT_TEST(RCU_SHB_member_cmp)
- CPPUNIT_TEST(RCU_SHB_member_less)
- CPPUNIT_TEST(RCU_SHB_member_cmpmix)
- CPPUNIT_TEST(RCU_SHB_member_ic)
-
- CPPUNIT_TEST(RCU_SHT_base_cmp)
- CPPUNIT_TEST(RCU_SHT_base_less)
- CPPUNIT_TEST(RCU_SHT_base_cmpmix)
- CPPUNIT_TEST(RCU_SHT_base_ic)
- CPPUNIT_TEST(RCU_SHT_member_cmp)
- CPPUNIT_TEST(RCU_SHT_member_less)
- CPPUNIT_TEST(RCU_SHT_member_cmpmix)
- CPPUNIT_TEST(RCU_SHT_member_ic)
-
- CPPUNIT_TEST(nogc_base_cmp)
- CPPUNIT_TEST(nogc_base_less)
- CPPUNIT_TEST(nogc_base_cmpmix)
- CPPUNIT_TEST(nogc_base_ic)
- CPPUNIT_TEST(nogc_member_cmp)
- CPPUNIT_TEST(nogc_member_less)
- CPPUNIT_TEST(nogc_member_cmpmix)
- CPPUNIT_TEST(nogc_member_ic)
-
- CPPUNIT_TEST(nogc_base_cmp_unord)
- CPPUNIT_TEST(nogc_base_less_unord)
- CPPUNIT_TEST(nogc_base_equal_to_unord)
- CPPUNIT_TEST(nogc_base_cmpmix_unord)
- CPPUNIT_TEST(nogc_base_equal_to_mix_unord)
- CPPUNIT_TEST(nogc_base_ic_unord)
- CPPUNIT_TEST(nogc_member_cmp_unord)
- CPPUNIT_TEST(nogc_member_less_unord)
- CPPUNIT_TEST(nogc_member_equal_to_unord)
- CPPUNIT_TEST(nogc_member_cmpmix_unord)
- CPPUNIT_TEST(nogc_member_equal_to_mix_unord)
- CPPUNIT_TEST(nogc_member_ic_unord)
-
- CPPUNIT_TEST_SUITE_END()
- };
-} // namespace ordlist
-
-#endif // #ifndef CDSTEST_HDR_INTRUSIVE_LAZY_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 "list/hdr_intrusive_lazy.h"
-#include <cds/intrusive/lazy_list_dhp.h>
-
-namespace ordlist {
- void IntrusiveLazyListHeaderTest::DHP_base_cmp()
- {
- typedef base_int_item< cds::gc::DHP > item;
- struct traits : public ci::lazy_list::traits
- {
- typedef ci::lazy_list::base_hook< co::gc<cds::gc::DHP> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::LazyList< cds::gc::DHP, item, traits > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::DHP_base_less()
- {
- typedef base_int_item< cds::gc::DHP > item;
- typedef ci::LazyList< cds::gc::DHP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::DHP> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::DHP_base_cmpmix()
- {
- typedef base_int_item< cds::gc::DHP > item;
- typedef ci::LazyList< cds::gc::DHP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::DHP> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::DHP_base_ic()
- {
- typedef base_int_item< cds::gc::DHP > item;
- typedef ci::LazyList< cds::gc::DHP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::DHP> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::DHP_member_cmp()
- {
- typedef member_int_item< cds::gc::DHP > item;
- typedef ci::LazyList< cds::gc::DHP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::DHP>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::DHP_member_less()
- {
- typedef member_int_item< cds::gc::DHP > item;
- typedef ci::LazyList< cds::gc::DHP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::DHP>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::DHP_member_cmpmix()
- {
- typedef member_int_item< cds::gc::DHP > item;
- typedef ci::LazyList< cds::gc::DHP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::DHP>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::DHP_member_ic()
- {
- typedef member_int_item< cds::gc::DHP > item;
- typedef ci::LazyList< cds::gc::DHP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::DHP>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_int<list>();
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_lazy.h"
-#include <cds/intrusive/lazy_list_hp.h>
-
-namespace ordlist {
- void IntrusiveLazyListHeaderTest::HP_base_cmp()
- {
- typedef base_int_item< cds::gc::HP > item;
- struct traits : public ci::lazy_list::traits
- {
- typedef ci::lazy_list::base_hook< co::gc<cds::gc::HP> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::LazyList< cds::gc::HP, item, traits > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::HP_base_less()
- {
- typedef base_int_item< cds::gc::HP > item;
- typedef ci::LazyList< cds::gc::HP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::HP> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::HP_base_cmpmix()
- {
- typedef base_int_item< cds::gc::HP > item;
- typedef ci::LazyList< cds::gc::HP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::HP> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::HP_base_ic()
- {
- typedef base_int_item< cds::gc::HP > item;
- typedef ci::LazyList< cds::gc::HP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::HP> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::HP_member_cmp()
- {
- typedef member_int_item< cds::gc::HP > item;
- typedef ci::LazyList< cds::gc::HP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::HP>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::HP_member_less()
- {
- typedef member_int_item< cds::gc::HP > item;
- struct traits : public ci::lazy_list::traits
- {
- typedef ci::lazy_list::member_hook< offsetof( item, hMember ), co::gc<cds::gc::HP>> hook;
- typedef IntrusiveLazyListHeaderTest::less<item> less;
- typedef faked_disposer disposer;
- };
- typedef ci::LazyList< cds::gc::HP, item, traits > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::HP_member_cmpmix()
- {
- typedef member_int_item< cds::gc::HP > item;
- typedef ci::LazyList< cds::gc::HP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::HP>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveLazyListHeaderTest::HP_member_ic()
- {
- typedef member_int_item< cds::gc::HP > item;
- typedef ci::LazyList< cds::gc::HP
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::HP>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_int<list>();
- }
-} // namespace ordlist
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::IntrusiveLazyListHeaderTest);
+++ /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 "list/hdr_intrusive_lazy.h"
-#include <cds/intrusive/lazy_list_nogc.h>
-
-namespace ordlist {
- void IntrusiveLazyListHeaderTest::nogc_base_cmp()
- {
- typedef base_int_item< cds::gc::nogc > item;
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::LazyList< cds::gc::nogc, item, traits > list;
- test_nogc_int<list>();
- }
-
- void IntrusiveLazyListHeaderTest::nogc_base_less()
- {
- typedef base_int_item< cds::gc::nogc > item;
- struct traits: public
- ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- {};
- typedef ci::LazyList< cds::gc::nogc, item, traits > list;
- test_nogc_int<list>();
- }
-
- void IntrusiveLazyListHeaderTest::nogc_base_cmpmix()
- {
- typedef base_int_item< cds::gc::nogc > item;
- typedef ci::LazyList< cds::gc::nogc
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_nogc_int<list>();
- }
-
- void IntrusiveLazyListHeaderTest::nogc_base_ic()
- {
- typedef base_int_item< cds::gc::nogc > item;
- typedef ci::LazyList< cds::gc::nogc
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_nogc_int<list>();
- }
-
- void IntrusiveLazyListHeaderTest::nogc_member_cmp()
- {
- typedef member_int_item< cds::gc::nogc > item;
- typedef ci::LazyList< cds::gc::nogc
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::nogc>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_nogc_int<list>();
- }
-
- void IntrusiveLazyListHeaderTest::nogc_member_less()
- {
- typedef member_int_item< cds::gc::nogc > item;
- typedef ci::LazyList< cds::gc::nogc
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::nogc>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_nogc_int<list>();
- }
-
- void IntrusiveLazyListHeaderTest::nogc_member_cmpmix()
- {
- typedef member_int_item< cds::gc::nogc > item;
- typedef ci::LazyList< cds::gc::nogc
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::nogc>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_nogc_int<list>();
- }
-
- void IntrusiveLazyListHeaderTest::nogc_member_ic()
- {
- typedef member_int_item< cds::gc::nogc > item;
- typedef ci::LazyList< cds::gc::nogc
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::nogc>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_nogc_int<list>();
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_lazy.h"
-#include <cds/intrusive/lazy_list_nogc.h>
-
-namespace ordlist {
- namespace {
- typedef IntrusiveLazyListHeaderTest::base_int_item< cds::gc::nogc > base_item;
- typedef IntrusiveLazyListHeaderTest::member_int_item< cds::gc::nogc > member_item;
-
- struct cmp_traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > hook;
- typedef IntrusiveLazyListHeaderTest::cmp<base_item> compare;
- typedef IntrusiveLazyListHeaderTest::faked_disposer disposer;
- static const bool sort = false;
- };
-
- struct less_traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > hook;
- typedef IntrusiveLazyListHeaderTest::less<base_item> less;
- typedef IntrusiveLazyListHeaderTest::faked_disposer disposer;
- static const bool sort = false;
- };
-
- struct equal_to_traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > hook;
- typedef IntrusiveLazyListHeaderTest::equal_to<base_item> equal_to;
- typedef IntrusiveLazyListHeaderTest::faked_disposer disposer;
- static const bool sort = false;
- };
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
- ,co::less< IntrusiveLazyListHeaderTest::less<base_item> >
- ,co::compare< IntrusiveLazyListHeaderTest::cmp<base_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::sort< false > >::type cmpmix_traits;
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
- ,co::compare< IntrusiveLazyListHeaderTest::cmp<base_item> >
- ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to<base_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::sort< false > >::type equal_to_mix_traits;
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
- ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to<base_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- ,co::sort< false > >::type ic_traits;
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( member_item, hMember )
- ,co::gc<cds::gc::nogc> > >
- ,co::compare< IntrusiveLazyListHeaderTest::cmp<member_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::sort< false > >::type member_cmp_traits;
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( member_item, hMember )
- ,co::gc<cds::gc::nogc> > >
- ,co::less< IntrusiveLazyListHeaderTest::less<member_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::sort< false > >::type member_less_traits;
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( member_item, hMember )
- ,co::gc<cds::gc::nogc> > >
- ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to<member_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::sort< false > >::type member_equal_to_traits;
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( member_item, hMember )
- ,co::gc<cds::gc::nogc> > >
- ,co::less< IntrusiveLazyListHeaderTest::less<member_item> >
- ,co::compare< IntrusiveLazyListHeaderTest::cmp<member_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::sort< false > >::type member_cmpmix_traits;
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( member_item, hMember )
- ,co::gc<cds::gc::nogc> > >
- ,co::compare< IntrusiveLazyListHeaderTest::cmp<member_item> >
- ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to<member_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::sort< false > >::type member_equal_to_mix_traits;
-
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( member_item, hMember ),
- co::gc<cds::gc::nogc> > >
- ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to<member_item> >
- ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- ,co::sort< false > >::type member_ic_traits;
-
- }
- void IntrusiveLazyListHeaderTest::nogc_base_cmp_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, base_item, cmp_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_base_less_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, base_item, less_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_base_equal_to_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, base_item, equal_to_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_base_cmpmix_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, base_item, cmpmix_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_base_equal_to_mix_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, base_item, equal_to_mix_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_base_ic_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, base_item, ic_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_member_cmp_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, member_item, member_cmp_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_member_less_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, member_item, member_less_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_member_equal_to_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, member_item, member_equal_to_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_member_cmpmix_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, member_item, member_cmpmix_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_member_equal_to_mix_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, member_item, member_equal_to_mix_traits > list;
- test_nogc_int_unordered<list>();
- }
- void IntrusiveLazyListHeaderTest::nogc_member_ic_unord()
- {
- typedef ci::LazyList< cds::gc::nogc, member_item, member_ic_traits > list;
- test_nogc_int_unordered<list>();
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_lazy.h"
-#include <cds/urcu/general_buffered.h>
-#include <cds/intrusive/lazy_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_buffered<> > RCU;
- }
-
- void IntrusiveLazyListHeaderTest::RCU_GPB_base_cmp()
- {
- typedef base_int_item< RCU > item;
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type list_traits;
- typedef ci::LazyList< RCU, item, list_traits > list;
-
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPB_base_less()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPB_base_cmpmix()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPB_base_ic()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPB_member_cmp()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPB_member_less()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPB_member_cmpmix()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPB_member_ic()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_lazy.h"
-#include <cds/urcu/general_instant.h>
-#include <cds/intrusive/lazy_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_instant<> > RCU;
- }
-
- void IntrusiveLazyListHeaderTest::RCU_GPI_base_cmp()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPI_base_less()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPI_base_cmpmix()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPI_base_ic()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPI_member_cmp()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPI_member_less()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPI_member_cmpmix()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPI_member_ic()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_lazy.h"
-#include <cds/urcu/general_threaded.h>
-#include <cds/intrusive/lazy_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_threaded<> > RCU;
- }
-
- void IntrusiveLazyListHeaderTest::RCU_GPT_base_cmp()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPT_base_less()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPT_base_cmpmix()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPT_base_ic()
- {
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPT_member_cmp()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPT_member_less()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPT_member_cmpmix()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveLazyListHeaderTest::RCU_GPT_member_ic()
- {
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_lazy.h"
-#include <cds/urcu/signal_buffered.h>
-#include <cds/intrusive/lazy_list_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_buffered<> > RCU;
- }
-#endif
-
- void IntrusiveLazyListHeaderTest::RCU_SHB_base_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type list_traits;
- typedef ci::LazyList< RCU, item, list_traits > list;
-
- test_rcu_int<list>();
-#endif
- }
-
- void IntrusiveLazyListHeaderTest::RCU_SHB_base_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
- void IntrusiveLazyListHeaderTest::RCU_SHB_base_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
- void IntrusiveLazyListHeaderTest::RCU_SHB_base_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
- void IntrusiveLazyListHeaderTest::RCU_SHB_member_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
- void IntrusiveLazyListHeaderTest::RCU_SHB_member_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
- void IntrusiveLazyListHeaderTest::RCU_SHB_member_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
- void IntrusiveLazyListHeaderTest::RCU_SHB_member_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_lazy.h"
-#include <cds/urcu/signal_threaded.h>
-#include <cds/intrusive/lazy_list_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_threaded<> > RCU;
- }
-#endif
-
- void IntrusiveLazyListHeaderTest::RCU_SHT_base_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveLazyListHeaderTest::RCU_SHT_base_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveLazyListHeaderTest::RCU_SHT_base_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveLazyListHeaderTest::RCU_SHT_base_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveLazyListHeaderTest::RCU_SHT_member_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveLazyListHeaderTest::RCU_SHT_member_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveLazyListHeaderTest::RCU_SHT_member_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveLazyListHeaderTest::RCU_SHT_member_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::LazyList< RCU
- ,item
- ,ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-} // namespace ordlist
+++ /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_MICHAEL_H
-#define CDSTEST_HDR_INTRUSIVE_MICHAEL_H
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/intrusive/details/michael_list_base.h>
-
-namespace ordlist {
- namespace ci = cds::intrusive;
- namespace co = cds::opt;
-
- class IntrusiveMichaelListHeaderTest: public CppUnitMini::TestCase
- {
- public:
-
- struct stat {
- int nDisposeCount;
- int nUpdateExistsCall;
- int nUpdateNewCall;
- int nFindCall;
- int nEraseCall;
-
- stat()
- : nDisposeCount(0)
- , nUpdateExistsCall(0)
- , nUpdateNewCall(0)
- , nFindCall(0)
- , nEraseCall(0)
- {}
-
- stat( const stat& s )
- {
- *this = s;
- }
-
- stat& operator =(const stat& s)
- {
- memcpy( this, &s, sizeof(s));
- return *this;
- }
- };
-
- template <typename GC>
- struct base_int_item: public ci::michael_list::node< GC >
- {
- int nKey;
- int nVal;
-
- mutable stat s;
-
- base_int_item()
- {}
-
- base_int_item(int key, int val)
- : nKey( key )
- , nVal(val)
- , s()
- {}
-
- base_int_item(const base_int_item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
- };
-
- template <typename GC>
- struct member_int_item
- {
- int nKey;
- int nVal;
-
- ci::michael_list::node< GC > hMember;
-
- mutable stat s;
-
- member_int_item()
- {}
-
- member_int_item(int key, int val)
- : nKey( key )
- , nVal(val)
- , s()
- {}
-
- member_int_item(const member_int_item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
- };
-
- template <typename T>
- struct less
- {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1.key() < v2.key();
- }
-
- template <typename Q>
- bool operator ()(const T& v1, const Q& v2 ) const
- {
- return v1.key() < v2;
- }
-
- template <typename Q>
- bool operator ()(const Q& v1, const T& v2 ) const
- {
- return v1 < v2.key();
- }
- };
-
- struct other_item {
- int nKey;
-
- other_item( int n )
- : nKey(n)
- {}
- };
-
- struct other_less {
- template <typename T, typename Q>
- bool operator()( T const& i1, Q const& i2) const
- {
- return i1.nKey < i2.nKey;
- }
- };
-
- template <typename T>
- struct cmp {
- int operator ()(const T& v1, const T& v2 ) const
- {
- if ( v1.key() < v2.key() )
- return -1;
- return v1.key() > v2.key() ? 1 : 0;
- }
-
- template <typename Q>
- int operator ()(const T& v1, const Q& v2 ) const
- {
- if ( v1.key() < v2 )
- return -1;
- return v1.key() > v2 ? 1 : 0;
- }
-
- template <typename Q>
- int operator ()(const Q& v1, const T& v2 ) const
- {
- if ( v1 < v2.key() )
- return -1;
- return v1 > v2.key() ? 1 : 0;
- }
- };
-
- struct faked_disposer
- {
- template <typename T>
- void operator ()( T * p )
- {
- ++p->s.nDisposeCount;
- }
- };
-
- struct update_functor
- {
- template <typename T>
- void operator ()(bool bNew, T& item, T& /*val*/ )
- {
- if ( bNew )
- ++item.s.nUpdateNewCall;
- else
- ++item.s.nUpdateExistsCall;
- }
- };
-
- struct find_functor
- {
- template <typename T, typename Q>
- void operator ()( T& item, Q& /*val*/ )
- {
- ++item.s.nFindCall;
- }
- };
-
- struct erase_functor
- {
- template <typename T>
- void operator()( T const& item )
- {
- item.s.nEraseCall++;
- }
- };
-
- template <class OrdList>
- void test_int_common()
- {
- typedef typename OrdList::value_type value_type;
-
- value_type v1( 10, 50 );
- value_type v2( 5, 25 );
- value_type v3( 20, 100 );
- {
- OrdList l;
- CPPUNIT_ASSERT( l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v1 )) ; // true
- CPPUNIT_ASSERT( l.contains( v1.key() ));
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( !l.contains( v2.key() ));
- CPPUNIT_ASSERT( !l.contains( v3.key(), less<value_type>() ));
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is not raised since pNext is nullptr
-
- {
- value_type v( v1 );
- CPPUNIT_ASSERT( !l.insert( v )) ; // false
- }
-
- std::pair<bool, bool> ret = l.update( v2, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 );
-
- //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty"
-
- CPPUNIT_ASSERT( l.contains( v1.key(), less<value_type>() )) ; // true
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
- CPPUNIT_ASSERT( l.find_with( v1.key(), less<value_type>(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 2 );
-
- CPPUNIT_ASSERT( l.contains( v2.key() ));
-
- CPPUNIT_ASSERT( v2.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v2.key(), find_functor() ));
- CPPUNIT_ASSERT( v2.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( !l.contains( v3.key() ));
-
- {
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
-
- value_type v( v2 );
- ret = l.update( v, update_functor() );
-
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( !ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
- CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 );
- CPPUNIT_ASSERT( v.s.nUpdateNewCall == 0 );
- }
-
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v3 )) ; // true
- CPPUNIT_ASSERT( l.contains( v3.key() ));
-
- CPPUNIT_ASSERT( v3.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v3.key(), find_functor() ));
- CPPUNIT_ASSERT( v3.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( l.unlink( v2 ) );
- CPPUNIT_ASSERT( l.contains( v1.key() )) ; // true
- CPPUNIT_ASSERT( !l.contains( v2.key() )) ; // true
- CPPUNIT_ASSERT( l.contains( v3.key() )) ; // true
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( !l.unlink( v2 ) );
-
- {
- // v1 key is in the list but v NODE is not in the list
- value_type v( v1 );
- CPPUNIT_ASSERT( !l.unlink( v ) );
- }
-
- CPPUNIT_ASSERT( l.unlink( v1 ) );
- CPPUNIT_ASSERT( !l.unlink( v1 ) );
- CPPUNIT_ASSERT( !l.contains( v1.key() ));
- CPPUNIT_ASSERT( !l.contains( v2.key() ));
- CPPUNIT_ASSERT( l.contains( v3.key() ));
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( !l.unlink( v1 ) );
- CPPUNIT_ASSERT( !l.unlink( v2 ) );
-
- CPPUNIT_ASSERT( l.unlink( v3 ) );
- CPPUNIT_ASSERT( !l.contains( v1.key(), less<value_type>() ));
- CPPUNIT_ASSERT( !l.find_with( v2.key(), less<value_type>(), find_functor() ));
- CPPUNIT_ASSERT( !l.find( v3.key(), find_functor() ));
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( !l.unlink( v1 ) );
- CPPUNIT_ASSERT( !l.unlink( v2 ) );
- CPPUNIT_ASSERT( !l.unlink( v3 ) );
-
- // Apply retired pointer to clean links
- OrdList::gc::force_dispose();
-
- stat s( v3.s );
- ret = l.update( v3, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v3.s.nUpdateNewCall == s.nUpdateNewCall + 1);
- CPPUNIT_ASSERT( v3.s.nUpdateExistsCall == s.nUpdateExistsCall );
- CPPUNIT_ASSERT( !l.empty() );
-
- s = v2.s;
- ret = l.update( v2, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == s.nUpdateNewCall + 1);
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == s.nUpdateExistsCall );
- CPPUNIT_ASSERT( !l.empty() );
-
- s = v1.s;
- ret = l.update( v1, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v1.s.nUpdateNewCall == s.nUpdateNewCall + 1);
- CPPUNIT_ASSERT( v1.s.nUpdateExistsCall == s.nUpdateExistsCall );
- CPPUNIT_ASSERT( !l.empty() );
-
- // Erase test
- CPPUNIT_ASSERT( v1.s.nEraseCall == 0 );
- CPPUNIT_ASSERT( l.erase( v1.key(), erase_functor()) );
- CPPUNIT_ASSERT( v1.s.nEraseCall == 1 );
- //CPPUNIT_ASSERT( v1.s.nDisposeCount == 0 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.erase_with( v2.key(), less<value_type>() ) );
- CPPUNIT_ASSERT( !l.erase( v2.key()));
- //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( v2.s.nEraseCall == 0 );
- CPPUNIT_ASSERT( !l.erase( v2, erase_functor() ));
- CPPUNIT_ASSERT( v2.s.nEraseCall == 0 );
- CPPUNIT_ASSERT( !l.erase( v1 ));
- //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( v3.s.nEraseCall == 0 );
- CPPUNIT_ASSERT( l.erase_with( v3, less<value_type>(), erase_functor() ));
- CPPUNIT_ASSERT( v3.s.nEraseCall == 1 );
- //CPPUNIT_ASSERT( v3.s.nDisposeCount == 0 );
- CPPUNIT_ASSERT( l.empty() );
-
- // Apply retired pointer to clean links
- OrdList::gc::force_dispose();
-
- // Unlink test
- CPPUNIT_ASSERT( l.insert( v1 ));
- CPPUNIT_ASSERT( l.insert( v3 ));
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( !l.unlink( v2 ));
- CPPUNIT_ASSERT( l.unlink( v1 ));
- CPPUNIT_ASSERT( !l.unlink( v1 ));
- CPPUNIT_ASSERT( l.unlink( v3 ));
- CPPUNIT_ASSERT( !l.unlink( v3 ));
- CPPUNIT_ASSERT( l.empty() );
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
- CPPUNIT_ASSERT( v1.s.nDisposeCount == 3 );
- CPPUNIT_ASSERT( v2.s.nDisposeCount == 2 );
- CPPUNIT_ASSERT( v3.s.nDisposeCount == 3 );
-
- // Destructor test (call disposer)
- CPPUNIT_ASSERT( l.insert( v1 ));
- CPPUNIT_ASSERT( l.insert( v3 ));
- CPPUNIT_ASSERT( l.insert( v2 ));
-
- // Iterator test
- // begin/end
- {
- typename OrdList::iterator it = l.begin();
- typename OrdList::const_iterator cit = l.cbegin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it != l.cend() );
- CPPUNIT_ASSERT( cit != l.end() );
- CPPUNIT_ASSERT( cit != l.cend() );
- CPPUNIT_ASSERT( cit == it );
-
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( ++it == l.end() );
- }
-
- // cbegin/cend
- {
- typename OrdList::const_iterator it = l.cbegin();
- CPPUNIT_ASSERT( it != l.cend() );
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != l.cend() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( ++it != l.cend() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( ++it == l.cend() );
- }
-
- // const begin/end
- {
- OrdList const & lref = l;
- typename OrdList::const_iterator it = lref.begin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != lref.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( ++it == l.end() );
- }
- }
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
-
- CPPUNIT_ASSERT( v1.s.nDisposeCount == 4 );
- CPPUNIT_ASSERT( v2.s.nDisposeCount == 3 );
- CPPUNIT_ASSERT( v3.s.nDisposeCount == 4 );
- }
-
- template <class OrdList>
- void test_int()
- {
- test_int_common<OrdList>();
-
- OrdList l;
- typename OrdList::guarded_ptr gp;
-
- static int const nLimit = 20;
- typename OrdList::value_type arrItem[nLimit];
-
- {
- int a[nLimit];
- for (int i = 0; i < nLimit; ++i)
- a[i]=i;
- shuffle( a, a + nLimit );
-
- for (int i = 0; i < nLimit; ++i) {
- arrItem[i].nKey = a[i];
- arrItem[i].nVal = a[i] * 2;
- }
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
-
- for ( int i=0; i < nLimit; ++i ) {
- gp = l.get( arrItem[i].nKey );
- CPPUNIT_ASSERT_EX( gp, "i=" << i );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == arrItem[i].nKey );
- CPPUNIT_CHECK( gp->nVal == arrItem[i].nVal );
- gp.release();
-
- gp = l.extract( arrItem[i].nKey );
- CPPUNIT_ASSERT_EX( gp, "i=" << i );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == arrItem[i].nKey );
- CPPUNIT_CHECK( gp->nVal == arrItem[i].nVal );
- gp.release();
-
- gp = l.get( arrItem[i].nKey );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( arrItem[i].nKey ));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( !l.get( nLimit/2 ));
- CPPUNIT_ASSERT( gp.empty());
- CPPUNIT_ASSERT( !l.extract( nLimit/2 ));
- CPPUNIT_ASSERT( gp.empty());
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
-
- for ( int i=0; i < nLimit; ++i ) {
- other_item itm( arrItem[i].nKey );
- gp = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT_EX( gp, "i=" << i );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == arrItem[i].nKey );
- CPPUNIT_CHECK( gp->nVal == arrItem[i].nVal );
- gp.release();
-
- gp = l.extract_with( itm, other_less() );
- CPPUNIT_ASSERT_EX( gp, "i=" << i );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == arrItem[i].nKey );
- CPPUNIT_CHECK( gp->nVal == arrItem[i].nVal );
- gp.release();
-
- gp = l.get_with( itm, other_less() );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( itm, other_less() ));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( !l.get_with( other_item(nLimit/2), other_less() ));
- CPPUNIT_ASSERT( gp.empty());
- CPPUNIT_ASSERT( !l.extract_with( other_item(nLimit/2), other_less() ));
- CPPUNIT_ASSERT( gp.empty());
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
-
- for ( int i=0; i < nLimit; i++ ) {
- CPPUNIT_ASSERT( arrItem[i].s.nDisposeCount == 2 );
- }
- }
- }
-
- template <class OrdList>
- void test_rcu_int()
- {
- test_int_common<OrdList>();
-
- OrdList l;
- static int const nLimit = 20;
- typename OrdList::value_type arrItem[nLimit];
-
- typedef typename OrdList::rcu_lock rcu_lock;
- typedef typename OrdList::value_type value_type;
- typedef typename OrdList::gc rcu_type;
-
- {
- int a[nLimit];
- for (int i = 0; i < nLimit; ++i)
- a[i]=i;
- shuffle( a, a + nLimit );
-
- for (int i = 0; i < nLimit; ++i) {
- arrItem[i].nKey = a[i];
- arrItem[i].nVal = a[i] * 2;
- }
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
-
- typename OrdList::exempt_ptr ep;
- typename OrdList::raw_ptr rp;
-
- for ( int i = 0; i < nLimit; ++i ) {
- {
- rcu_lock lock;
- rp = l.get( a[i] );
- CPPUNIT_ASSERT( rp );
- CPPUNIT_CHECK( rp->nKey == a[i] );
- CPPUNIT_CHECK( rp->nVal == a[i] * 2 );
- }
- rp.release();
-
- ep = l.extract( a[i] );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->nKey == a[i] );
- CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 );
- ep.release();
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get( a[i] ));
- }
- CPPUNIT_CHECK( !l.extract( a[i] ));
- CPPUNIT_CHECK( ep.empty() );
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get( a[0] ));
- }
- ep = l.extract( a[0] );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i ) {
- CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
- }
-
- for ( int i = 0; i < nLimit; ++i ) {
- other_item itm( a[i] );
- {
- rcu_lock lock;
- rp = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT( rp );
- CPPUNIT_CHECK( rp->nKey == a[i] );
- CPPUNIT_CHECK( rp->nVal == a[i] * 2 );
- }
- rp.release();
-
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->nKey == a[i] );
- CPPUNIT_CHECK( ep->nVal == a[i] * 2 );
- ep.release();
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get_with( itm, other_less() ));
- }
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get_with( other_item( 0 ), other_less() ));
- }
- CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() ));
- CPPUNIT_CHECK( ep.empty() );
-
- // Apply retired pointer
- OrdList::gc::force_dispose();
- }
- }
-
- template <class OrdList>
- void test_nogc_int()
- {
- typedef typename OrdList::value_type value_type;
- {
- value_type v1( 10, 50 );
- value_type v2( 5, 25 );
- value_type v3( 20, 100 );
- {
- OrdList l;
- CPPUNIT_ASSERT( l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v1 )) ; // true
- CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 );
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( l.contains( v2.key(), less<value_type>() ) == nullptr );
- CPPUNIT_ASSERT( !l.find_with( v3.key(), less<value_type>(), find_functor() ));
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is not raised since pNext is nullptr
-
- {
- value_type v( v1 );
- CPPUNIT_ASSERT( !l.insert( v )) ; // false
- }
-
- std::pair<bool, bool> ret = l.update( v2, update_functor() );
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 );
-
- //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty"
-
- CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ) ; // true
-
- CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
- CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
- CPPUNIT_ASSERT( v1.s.nFindCall == 2 );
-
- CPPUNIT_ASSERT( l.contains( v2.key() ) == &v2 );
-
- CPPUNIT_ASSERT( v2.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v2.key(), find_functor() ));
- CPPUNIT_ASSERT( v2.s.nFindCall == 1 );
-
- CPPUNIT_ASSERT( !l.contains( v3.key() ));
-
- {
- value_type v( v2 );
- ret = l.update( v, update_functor() );
-
- CPPUNIT_ASSERT( ret.first );
- CPPUNIT_ASSERT( !ret.second );
- CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 );
- CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 && v.s.nUpdateNewCall == 0 );
- }
-
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.insert( v3 )) ; // true
- CPPUNIT_ASSERT( l.contains( v3.key() ) == &v3 );
-
- CPPUNIT_ASSERT( v3.s.nFindCall == 0 );
- CPPUNIT_ASSERT( l.find( v3.key(), find_functor() ));
- CPPUNIT_ASSERT( v3.s.nFindCall == 1 );
-
- {
- typename OrdList::iterator it = l.begin();
- typename OrdList::const_iterator cit = l.cbegin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it != l.cend() );
- CPPUNIT_ASSERT( cit != l.end() );
- CPPUNIT_ASSERT( cit != l.cend() );
- CPPUNIT_ASSERT( cit == it );
-
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it == l.end() );
- }
-
- {
- OrdList const & lref = l;
- typename OrdList::const_iterator it = lref.begin();
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == v2.nKey );
- CPPUNIT_ASSERT( it->nVal == v2.nVal );
- CPPUNIT_ASSERT( ++it != lref.end() );
- CPPUNIT_ASSERT( it->nKey == v1.nKey );
- CPPUNIT_ASSERT( it->nVal == v1.nVal );
- CPPUNIT_ASSERT( it++ != l.end() );
- CPPUNIT_ASSERT( it->nKey == v3.nKey );
- CPPUNIT_ASSERT( it->nVal == v3.nVal );
- CPPUNIT_ASSERT( it++ != lref.end() );
- CPPUNIT_ASSERT( it == l.end() );
- }
- }
-
- // Disposer called on list destruction
- CPPUNIT_ASSERT( v1.s.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v2.s.nDisposeCount == 1 );
- CPPUNIT_ASSERT( v3.s.nDisposeCount == 1 );
- }
- }
-
- void HP_base_cmp();
- void HP_base_less();
- void HP_base_cmpmix();
- void HP_base_ic();
- void HP_member_cmp();
- void HP_member_less();
- void HP_member_cmpmix();
- void HP_member_ic();
-
- void DHP_base_cmp();
- void DHP_base_less();
- void DHP_base_cmpmix();
- void DHP_base_ic();
- void DHP_member_cmp();
- void DHP_member_less();
- void DHP_member_cmpmix();
- void DHP_member_ic();
-
- void RCU_GPI_base_cmp();
- void RCU_GPI_base_less();
- void RCU_GPI_base_cmpmix();
- void RCU_GPI_base_ic();
- void RCU_GPI_member_cmp();
- void RCU_GPI_member_less();
- void RCU_GPI_member_cmpmix();
- void RCU_GPI_member_ic();
-
- void RCU_GPB_base_cmp();
- void RCU_GPB_base_less();
- void RCU_GPB_base_cmpmix();
- void RCU_GPB_base_ic();
- void RCU_GPB_member_cmp();
- void RCU_GPB_member_less();
- void RCU_GPB_member_cmpmix();
- void RCU_GPB_member_ic();
-
- void RCU_GPT_base_cmp();
- void RCU_GPT_base_less();
- void RCU_GPT_base_cmpmix();
- void RCU_GPT_base_ic();
- void RCU_GPT_member_cmp();
- void RCU_GPT_member_less();
- void RCU_GPT_member_cmpmix();
- void RCU_GPT_member_ic();
-
- void RCU_SHB_base_cmp();
- void RCU_SHB_base_less();
- void RCU_SHB_base_cmpmix();
- void RCU_SHB_base_ic();
- void RCU_SHB_member_cmp();
- void RCU_SHB_member_less();
- void RCU_SHB_member_cmpmix();
- void RCU_SHB_member_ic();
-
- void RCU_SHT_base_cmp();
- void RCU_SHT_base_less();
- void RCU_SHT_base_cmpmix();
- void RCU_SHT_base_ic();
- void RCU_SHT_member_cmp();
- void RCU_SHT_member_less();
- void RCU_SHT_member_cmpmix();
- void RCU_SHT_member_ic();
-
- void nogc_base_cmp();
- void nogc_base_less();
- void nogc_base_cmpmix();
- void nogc_base_ic();
- void nogc_member_cmp();
- void nogc_member_less();
- void nogc_member_cmpmix();
- void nogc_member_ic();
-
-
- CPPUNIT_TEST_SUITE(IntrusiveMichaelListHeaderTest)
- CPPUNIT_TEST(HP_base_cmp)
- CPPUNIT_TEST(HP_base_less)
- CPPUNIT_TEST(HP_base_cmpmix)
- CPPUNIT_TEST(HP_base_ic)
- CPPUNIT_TEST(HP_member_cmp)
- CPPUNIT_TEST(HP_member_less)
- CPPUNIT_TEST(HP_member_cmpmix)
- CPPUNIT_TEST(HP_member_ic)
-
- CPPUNIT_TEST(DHP_base_cmp)
- CPPUNIT_TEST(DHP_base_less)
- CPPUNIT_TEST(DHP_base_cmpmix)
- CPPUNIT_TEST(DHP_base_ic)
- CPPUNIT_TEST(DHP_member_cmp)
- CPPUNIT_TEST(DHP_member_less)
- CPPUNIT_TEST(DHP_member_cmpmix)
- CPPUNIT_TEST(DHP_member_ic)
-
- CPPUNIT_TEST(RCU_GPI_base_cmp)
- CPPUNIT_TEST(RCU_GPI_base_less)
- CPPUNIT_TEST(RCU_GPI_base_cmpmix)
- CPPUNIT_TEST(RCU_GPI_base_ic)
- CPPUNIT_TEST(RCU_GPI_member_cmp)
- CPPUNIT_TEST(RCU_GPI_member_less)
- CPPUNIT_TEST(RCU_GPI_member_cmpmix)
- CPPUNIT_TEST(RCU_GPI_member_ic)
-
- CPPUNIT_TEST(RCU_GPB_base_cmp)
- CPPUNIT_TEST(RCU_GPB_base_less)
- CPPUNIT_TEST(RCU_GPB_base_cmpmix)
- CPPUNIT_TEST(RCU_GPB_base_ic)
- CPPUNIT_TEST(RCU_GPB_member_cmp)
- CPPUNIT_TEST(RCU_GPB_member_less)
- CPPUNIT_TEST(RCU_GPB_member_cmpmix)
- CPPUNIT_TEST(RCU_GPB_member_ic)
-
- CPPUNIT_TEST(RCU_GPT_base_cmp)
- CPPUNIT_TEST(RCU_GPT_base_less)
- CPPUNIT_TEST(RCU_GPT_base_cmpmix)
- CPPUNIT_TEST(RCU_GPT_base_ic)
- CPPUNIT_TEST(RCU_GPT_member_cmp)
- CPPUNIT_TEST(RCU_GPT_member_less)
- CPPUNIT_TEST(RCU_GPT_member_cmpmix)
- CPPUNIT_TEST(RCU_GPT_member_ic)
-
- CPPUNIT_TEST(nogc_base_cmp)
- CPPUNIT_TEST(nogc_base_less)
- CPPUNIT_TEST(nogc_base_cmpmix)
- CPPUNIT_TEST(nogc_base_ic)
- CPPUNIT_TEST(nogc_member_cmp)
- CPPUNIT_TEST(nogc_member_less)
- CPPUNIT_TEST(nogc_member_cmpmix)
- CPPUNIT_TEST(nogc_member_ic)
-
- CPPUNIT_TEST_SUITE_END()
- };
-} // namespace ordlist
-
-#endif // CDSTEST_HDR_INTRUSIVE_MICHAEL_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 "list/hdr_intrusive_michael.h"
-#include <cds/intrusive/michael_list_dhp.h>
-
-namespace ordlist {
- void IntrusiveMichaelListHeaderTest::DHP_base_cmp()
- {
- typedef base_int_item< cds::gc::DHP > item;
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< co::gc<cds::gc::DHP> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< cds::gc::DHP, item, traits > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::DHP_base_less()
- {
- typedef base_int_item< cds::gc::DHP > item;
- typedef ci::MichaelList< cds::gc::DHP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::DHP> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::DHP_base_cmpmix()
- {
- typedef base_int_item< cds::gc::DHP > item;
- typedef ci::MichaelList< cds::gc::DHP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::DHP> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::DHP_base_ic()
- {
- typedef base_int_item< cds::gc::DHP > item;
- typedef ci::MichaelList< cds::gc::DHP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::DHP> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::DHP_member_cmp()
- {
- typedef member_int_item< cds::gc::DHP > item;
- typedef ci::MichaelList< cds::gc::DHP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::DHP>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::DHP_member_less()
- {
- typedef member_int_item< cds::gc::DHP > item;
- typedef ci::MichaelList< cds::gc::DHP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::DHP>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::DHP_member_cmpmix()
- {
- typedef member_int_item< cds::gc::DHP > item;
- typedef ci::MichaelList< cds::gc::DHP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::DHP>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::DHP_member_ic()
- {
- typedef member_int_item< cds::gc::DHP > item;
- typedef ci::MichaelList< cds::gc::DHP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::DHP>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_int<list>();
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_michael.h"
-#include <cds/intrusive/michael_list_hp.h>
-
-namespace ordlist {
- void IntrusiveMichaelListHeaderTest::HP_base_cmp()
- {
- typedef base_int_item< cds::gc::HP > item;
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< co::gc<cds::gc::HP> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< cds::gc::HP, item, traits > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::HP_base_less()
- {
- typedef base_int_item< cds::gc::HP > item;
- typedef ci::MichaelList< cds::gc::HP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::HP> > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::HP_base_cmpmix()
- {
- typedef base_int_item< cds::gc::HP > item;
- typedef ci::MichaelList< cds::gc::HP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::HP> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::HP_base_ic()
- {
- typedef base_int_item< cds::gc::HP > item;
- typedef ci::MichaelList< cds::gc::HP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::HP> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::HP_member_cmp()
- {
- typedef member_int_item< cds::gc::HP > item;
- typedef ci::MichaelList< cds::gc::HP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::HP>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::HP_member_less()
- {
- typedef member_int_item< cds::gc::HP > item;
- typedef ci::MichaelList< cds::gc::HP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::HP>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::HP_member_cmpmix()
- {
- typedef member_int_item< cds::gc::HP > item;
- typedef ci::MichaelList< cds::gc::HP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::HP>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::HP_member_ic()
- {
- typedef member_int_item< cds::gc::HP > item;
- typedef ci::MichaelList< cds::gc::HP
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::HP>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_int<list>();
- }
-} // namespace ordlist
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::IntrusiveMichaelListHeaderTest);
+++ /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 "list/hdr_intrusive_michael.h"
-#include <cds/urcu/general_buffered.h>
-#include <cds/intrusive/michael_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_buffered<> > RCU;
- }
-
- void IntrusiveMichaelListHeaderTest::RCU_GPB_base_cmp()
- {
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPB_base_less()
- {
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef IntrusiveMichaelListHeaderTest::less<item> less;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPB_base_cmpmix()
- {
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPB_base_ic()
- {
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPB_member_cmp()
- {
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPB_member_less()
- {
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPB_member_cmpmix()
- {
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPB_member_ic()
- {
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
-
-}
+++ /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 "list/hdr_intrusive_michael.h"
-#include <cds/urcu/general_instant.h>
-#include <cds/intrusive/michael_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_instant<> > RCU;
- }
-
- void IntrusiveMichaelListHeaderTest::RCU_GPI_base_cmp()
- {
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPI_base_less()
- {
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef IntrusiveMichaelListHeaderTest::less<item> less;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPI_base_cmpmix()
- {
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPI_base_ic()
- {
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPI_member_cmp()
- {
- typedef member_int_item< RCU > item;
- struct traits: public
- ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- {};
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPI_member_less()
- {
- typedef member_int_item< RCU > item;
- struct traits: public
- ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- {};
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPI_member_cmpmix()
- {
- typedef member_int_item< RCU > item;
- struct traits: public
- ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- {};
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPI_member_ic()
- {
- typedef member_int_item< RCU > item;
- struct traits: public
- ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- {};
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
-} // namespace ordlist
+++ /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 "list/hdr_intrusive_michael.h"
-#include <cds/urcu/general_threaded.h>
-#include <cds/intrusive/michael_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_threaded<> > RCU;
- }
-
- void IntrusiveMichaelListHeaderTest::RCU_GPT_base_cmp()
- {
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPT_base_less()
- {
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef IntrusiveMichaelListHeaderTest::less<item> less;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPT_base_cmpmix()
- {
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPT_base_ic()
- {
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPT_member_cmp()
- {
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPT_member_less()
- {
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPT_member_cmpmix()
- {
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::RCU_GPT_member_ic()
- {
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
- }
-
-}
+++ /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 "list/hdr_intrusive_michael.h"
-#include <cds/urcu/signal_buffered.h>
-#include <cds/intrusive/michael_list_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_buffered<> > RCU;
- }
-#endif
-
- void IntrusiveMichaelListHeaderTest::RCU_SHB_base_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHB_base_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef IntrusiveMichaelListHeaderTest::less<item> less;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHB_base_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHB_base_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHB_member_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHB_member_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHB_member_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHB_member_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
-}
+++ /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 "list/hdr_intrusive_michael.h"
-#include <cds/urcu/signal_threaded.h>
-#include <cds/intrusive/michael_list_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_threaded<> > RCU;
- }
-#endif
-
- void IntrusiveMichaelListHeaderTest::RCU_SHT_base_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHT_base_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
- typedef IntrusiveMichaelListHeaderTest::less<item> less;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< RCU, item, traits > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHT_base_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHT_base_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef base_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHT_member_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHT_member_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHT_member_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
- void IntrusiveMichaelListHeaderTest::RCU_SHT_member_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef member_int_item< RCU > item;
- typedef ci::MichaelList< RCU
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<RCU>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_rcu_int<list>();
-#endif
- }
-
-}
+++ /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 "list/hdr_intrusive_michael.h"
-#include <cds/intrusive/michael_list_nogc.h>
-
-namespace ordlist {
- void IntrusiveMichaelListHeaderTest::nogc_base_cmp()
- {
- typedef base_int_item< cds::gc::nogc > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<cds::gc::nogc> > hook;
- typedef cmp<item> compare;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< cds::gc::nogc, item, traits > list;
- test_nogc_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::nogc_base_less()
- {
- typedef base_int_item< cds::gc::nogc > item;
- struct traits : public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< co::gc<cds::gc::nogc> > hook;
- typedef IntrusiveMichaelListHeaderTest::less<item> less;
- typedef faked_disposer disposer;
- };
- typedef ci::MichaelList< cds::gc::nogc, item, traits > list;
- test_nogc_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::nogc_base_cmpmix()
- {
- typedef base_int_item< cds::gc::nogc > item;
- typedef ci::MichaelList< cds::gc::nogc
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_nogc_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::nogc_base_ic()
- {
- typedef base_int_item< cds::gc::nogc > item;
- typedef ci::MichaelList< cds::gc::nogc
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_nogc_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::nogc_member_cmp()
- {
- typedef member_int_item< cds::gc::nogc > item;
- typedef ci::MichaelList< cds::gc::nogc
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::nogc>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_nogc_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::nogc_member_less()
- {
- typedef member_int_item< cds::gc::nogc > item;
- typedef ci::MichaelList< cds::gc::nogc
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::nogc>
- > >
- ,co::less< less<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_nogc_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::nogc_member_cmpmix()
- {
- typedef member_int_item< cds::gc::nogc > item;
- typedef ci::MichaelList< cds::gc::nogc
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::nogc>
- > >
- ,co::less< less<item> >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- >::type
- > list;
- test_nogc_int<list>();
- }
- void IntrusiveMichaelListHeaderTest::nogc_member_ic()
- {
- typedef member_int_item< cds::gc::nogc > item;
- typedef ci::MichaelList< cds::gc::nogc
- ,item
- ,ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook<
- offsetof( item, hMember ),
- co::gc<cds::gc::nogc>
- > >
- ,co::compare< cmp<item> >
- ,ci::opt::disposer< faked_disposer >
- ,co::item_counter< cds::atomicity::item_counter >
- >::type
- > list;
- test_nogc_int<list>();
- }
-
-} // namespace ordlist
+++ /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_LAZY_H
-#define CDSTEST_HDR_LAZY_H
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/container/details/lazy_list_base.h>
-
-namespace ordlist {
- namespace cc = cds::container;
- namespace co = cds::container::opt;
-
- class LazyListTestHeader: public CppUnitMini::TestCase
- {
- public:
- struct stat {
- int nUpdateExistsCall;
- int nUpdateNewCall;
-
- stat()
- {
- nUpdateExistsCall
- = nUpdateNewCall
- = 0;
- }
- };
-
- struct item {
- int nKey;
- int nVal;
-
- stat s;
-
- item(int key)
- : nKey( key )
- , nVal( key * 2 )
- , s()
- {}
-
- item(int key, int val)
- : nKey( key )
- , nVal(val)
- , s()
- {}
-
- item( item const& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- int key() const
- {
- return nKey;
- }
- };
-
- template <typename T>
- struct lt
- {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1.key() < v2.key();
- }
-
- template <typename Q>
- bool operator ()(const T& v1, const Q& v2 ) const
- {
- return v1.key() < v2;
- }
-
- template <typename Q>
- bool operator ()(const Q& v1, const T& v2 ) const
- {
- return v1 < v2.key();
- }
- };
-
- template <typename T>
- struct equal_to
- {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1.key() == v2.key();
- }
-
- template <typename Q>
- bool operator ()(const T& v1, const Q& v2 ) const
- {
- return v1.key() == v2;
- }
-
- template <typename Q>
- bool operator ()(const Q& v1, const T& v2 ) const
- {
- return v1 == v2.key();
- }
- };
-
- template <typename T>
- struct cmp {
- int operator ()(const T& v1, const T& v2 ) const
- {
- if ( v1.key() < v2.key() )
- return -1;
- return v1.key() > v2.key() ? 1 : 0;
- }
-
- template <typename Q>
- int operator ()(const T& v1, const Q& v2 ) const
- {
- if ( v1.key() < v2 )
- return -1;
- return v1.key() > v2 ? 1 : 0;
- }
-
- template <typename Q>
- int operator ()(const Q& v1, const T& v2 ) const
- {
- if ( v1 < v2.key() )
- return -1;
- return v1 > v2.key() ? 1 : 0;
- }
- };
-
- struct insert_functor {
- void operator ()( item& i )
- {
- i.nVal = i.nKey * 1033;
- }
- };
- struct dummy_insert_functor {
- void operator ()( item& /*i*/ )
- {
- // This functor should not be called
- TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_functor should not be called", __FILE__, __LINE__ );
- }
- };
-
- static void insert_function( item& i )
- {
- i.nVal = i.nKey * 1024;
- }
- static void dummy_insert_function( item& /*i*/ )
- {
- // This function should not be called
- TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_function should not be called", __FILE__, __LINE__ );
- }
-
- struct erase_functor {
- unsigned int nEraseCall;
-
- erase_functor()
- : nEraseCall(0)
- {}
-
- void operator()( item const& /*i*/)
- {
- ++nEraseCall;
- }
- };
-
- struct check_value {
- unsigned int m_nMultiplier;
-
- check_value( unsigned int nMultiplier )
- : m_nMultiplier( nMultiplier )
- {}
-
- check_value( const check_value& s )
- : m_nMultiplier( s.m_nMultiplier )
- {}
-
- void operator()( item& i, int )
- {
- CPPUNIT_ASSERT_CURRENT( int(i.nKey * m_nMultiplier) == i.nVal );
- }
- };
-
- struct check_exact_value {
- int m_nExpected;
-
- check_exact_value( int nExpected )
- : m_nExpected( nExpected )
- {}
-
- check_exact_value( check_exact_value const& s)
- : m_nExpected( s.m_nExpected )
- {}
-
- void operator()( item& i, int )
- {
- CPPUNIT_ASSERT_CURRENT( i.nVal == m_nExpected );
- }
- };
-
- struct dummy_check_value {
- void operator()( item& /*i*/, int )
- {
- // This functor should not be called
- TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_check_value should not be called", __FILE__, __LINE__ );
- }
- };
-
- struct update_functor {
- void operator()( bool /*bNew*/, item& i, int /*n*/ )
- {
- i.nVal = i.nKey * 1024;
- }
- };
-
- static void update_func( bool /*bNew*/, item& i, int n )
- {
- i.nVal = n * 1033;
- }
-
- struct other_item
- {
- int nKey;
-
- other_item()
- {}
-
- other_item(int n)
- : nKey(n)
- {}
- };
-
- struct other_less
- {
- template <typename T1, typename T2>
- bool operator()( T1 const& t1, T2 const& t2 ) const
- {
- return t1.nKey < t2.nKey;
- }
- };
-
- protected:
- template <class OrdList>
- void test_with( OrdList& l )
- {
- typedef typename OrdList::value_type value_type;
-
- // The list should be empty
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.insert( 50 ) );
- CPPUNIT_ASSERT( l.insert( item( 25 )) );
- CPPUNIT_ASSERT( l.insert( item( 100 )) );
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( !l.insert( 50 ) );
- CPPUNIT_ASSERT( !l.insert( item( 100 )) );
-
- // clear test
-
- // The list should not be empty
- CPPUNIT_ASSERT( !l.empty() );
- l.clear();
- // and now the list is empty
- CPPUNIT_ASSERT( l.empty() );
-
- // Test insert with functor
-
- CPPUNIT_ASSERT( l.insert( 100, insert_functor() ) );
- // passed by ref
- {
- insert_functor f;
- CPPUNIT_ASSERT( l.insert( item( 25 ), std::ref( f ) ) );
- CPPUNIT_ASSERT( !l.insert( item( 100 ), std::ref( f ) ) );
- }
- // Test insert with function
- CPPUNIT_ASSERT( l.insert( 50, insert_function ));
- CPPUNIT_ASSERT( !l.insert( 25, dummy_insert_function ));
- CPPUNIT_ASSERT( !l.insert( 100, dummy_insert_functor() ));
-
- // The list should not be empty
- CPPUNIT_ASSERT( !l.empty() );
-
- // Check inserted values
- {
- int i;
- i = 100;
-
- CPPUNIT_ASSERT( l.contains( 100 ));
- CPPUNIT_ASSERT( l.find( i, check_value(1033) ));
- {
- check_value f(1033);
- i = 25;
- CPPUNIT_ASSERT( l.contains( 25, lt<value_type>() ));
- CPPUNIT_ASSERT( l.find_with( i, lt<value_type>(), std::ref( f ) ) );
- }
- i = 50;
- CPPUNIT_ASSERT( l.contains( 50 ));
- CPPUNIT_ASSERT( l.find( i, check_value(1024) ));
-
- i = 10;
- CPPUNIT_ASSERT( !l.contains( 10, lt<value_type>() ));
- CPPUNIT_ASSERT( !l.find_with( i, lt<value_type>(), dummy_check_value() ));
- i = 75;
- CPPUNIT_ASSERT( !l.contains( 75 ));
- CPPUNIT_ASSERT( !l.find( i, dummy_check_value() ));
- i = 150;
- CPPUNIT_ASSERT( !l.contains( 150 ));
- CPPUNIT_ASSERT( !l.find( i, dummy_check_value() ));
- }
-
- // The list should not be empty
- CPPUNIT_ASSERT( !l.empty() );
- l.clear();
- // and now the list is empty
- CPPUNIT_ASSERT( l.empty() );
-
- // Update test
- {
- std::pair<bool, bool> updateResult;
- update_functor f;
- updateResult = l.update( 100, update_functor() );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( updateResult.second );
-
- updateResult = l.update( 200, std::ref( f ) );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( updateResult.second );
-
- updateResult = l.update( 50, update_func );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( updateResult.second );
-
- int i;
- i = 100;
- CPPUNIT_ASSERT( l.find( i, check_value(1024) ));
- i = 50;
- CPPUNIT_ASSERT( l.find( i, check_value(1033) ));
- i = 200;
- CPPUNIT_ASSERT( l.find( i, check_value(1024) ));
-
- // update existing key
- updateResult = l.update( 200, update_func );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( !updateResult.second );
- i = 200;
- CPPUNIT_ASSERT( l.find( i, check_value(1033) ));
-
- updateResult = l.update( 50, update_functor() );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( !updateResult.second );
- i = 50;
- CPPUNIT_ASSERT( l.find( i, check_value(1024) ));
- }
-
- // erase test (list: 50, 100, 200)
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( l.insert(160));
- CPPUNIT_ASSERT( l.insert(250));
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( !l.erase( 150 ));
-
- CPPUNIT_ASSERT( l.erase( 100 ));
- CPPUNIT_ASSERT( !l.erase( 100 ));
-
- CPPUNIT_ASSERT( l.erase_with( 200, lt<value_type>() ));
- CPPUNIT_ASSERT( !l.erase_with( 200, lt<value_type>() ));
-
- {
- erase_functor ef;
- CPPUNIT_ASSERT( ef.nEraseCall == 0 );
- CPPUNIT_ASSERT( l.erase_with( 160, lt<value_type>(), std::ref(ef) ));
- CPPUNIT_ASSERT( ef.nEraseCall == 1 );
- CPPUNIT_ASSERT( !l.erase_with( 160, lt<value_type>(), std::ref(ef) ));
- CPPUNIT_ASSERT( ef.nEraseCall == 1 );
-
- CPPUNIT_ASSERT( l.erase( 250, std::ref(ef) ));
- CPPUNIT_ASSERT( ef.nEraseCall == 2 );
- CPPUNIT_ASSERT( !l.erase( 250, std::ref(ef) ));
- CPPUNIT_ASSERT( ef.nEraseCall == 2 );
- }
-
- CPPUNIT_ASSERT( l.erase( 50 ));
- CPPUNIT_ASSERT( !l.erase( 50 ));
-
- CPPUNIT_ASSERT( l.empty() );
-
- // clear empty list
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- {
- int i;
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) );
- CPPUNIT_ASSERT( l.emplace( 251, 152 ));
- CPPUNIT_ASSERT( l.emplace( item( 1001 )) );
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( !l.emplace( 501, 2 ) );
- CPPUNIT_ASSERT( !l.emplace( 251, 10) );
-
- i = 501;
- CPPUNIT_ASSERT( l.find( i, check_exact_value(501*2) ));
- i = 251;
- CPPUNIT_ASSERT( l.find( i, check_exact_value(152) ));
- i = 1001;
- CPPUNIT_ASSERT( l.find( i, check_exact_value(1001*2) ));
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
-
- // Iterator test
- {
- int nCount = 100;
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert( i ) );
-
- {
- typename OrdList::iterator it( l.begin() );
- typename OrdList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
- int i = 0;
- for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) {
- it->nVal = i * 2;
- CPPUNIT_ASSERT( it->nKey == i );
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.find( i, check_value(2) ));
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Const iterator
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i) );
-
- i = 0;
- const OrdList& rl = l;
- for ( typename OrdList::const_iterator it = rl.begin(), itEnd = rl.end(); it != itEnd; ++it, ++i ) {
- // it->nVal = i * 2 ; // not!
- CPPUNIT_ASSERT( it->nKey == i );
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.find_with( i, lt<value_type>(), check_value(2) ));
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
- }
-
- template <class OrdList>
- void test()
- {
- typedef typename OrdList::guarded_ptr guarded_ptr;
- typedef typename OrdList::value_type value_type;
-
- OrdList l;
- test_with( l );
-
- static int const nLimit = 20;
- int arr[nLimit];
- for ( int i = 0; i < nLimit; i++ )
- arr[i] = i;
- shuffle( arr, arr + nLimit );
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- l.insert( arr[i] );
- {
- guarded_ptr gp;
- for ( int i = 0; i < nLimit; ++i ) {
- int nKey = arr[i];
-
- gp = l.get( nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == nKey );
- CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- gp.release();
-
- gp = l.extract( nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == nKey );
- CPPUNIT_CHECK( gp->nVal == nKey*2 );
- gp.release();
-
- gp = l.get( nKey );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( nKey));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get(arr[0]));
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( arr[0]));
- CPPUNIT_CHECK( gp.empty());
- }
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i )
- l.insert( arr[i] );
- {
- guarded_ptr gp;
- for ( int i = 0; i < nLimit; ++i ) {
- int nKey = arr[i];
- other_item key( nKey );
-
- gp = l.get_with( key, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == nKey );
- CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- gp.release();
-
- gp = l.extract_with( key, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == nKey );
- CPPUNIT_CHECK( gp->nVal == nKey*2 );
- gp.release();
-
- gp = l.get_with( key, other_less() );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( key, other_less()));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get_with(other_item(arr[0]), other_less()));
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( other_item(arr[0]), other_less()));
- CPPUNIT_CHECK( gp.empty());
- }
-
- }
-
- template <class OrdList>
- void test_rcu()
- {
- OrdList l;
- test_with( l );
-
- static int const nLimit = 20;
-
- typedef typename OrdList::rcu_lock rcu_lock;
- typedef typename OrdList::value_type value_type;
- typedef typename OrdList::gc rcu_type;
-
- {
- int a[nLimit];
- for (int i = 0; i < nLimit; ++i)
- a[i]=i;
- shuffle( a, a + nLimit );
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( a[i] ) );
-
- typename OrdList::exempt_ptr ep;
-
- for ( int i = 0; i < nLimit; ++i ) {
- {
- rcu_lock lock;
- value_type * pGet = l.get( a[i] );
- CPPUNIT_ASSERT( pGet != nullptr );
- CPPUNIT_CHECK( pGet->nKey == a[i] );
- CPPUNIT_CHECK( pGet->nVal == a[i] * 2 );
-
- ep = l.extract( a[i] );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->nKey == a[i] );
- CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 );
- }
- ep.release();
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get( a[i] ) == nullptr );
- CPPUNIT_CHECK( !l.extract( a[i] ));
- }
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get( a[0] ) == nullptr );
- ep = l.extract( a[0] );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i ) {
- CPPUNIT_ASSERT( l.insert( a[i] ) );
- }
-
- for ( int i = 0; i < nLimit; ++i ) {
- other_item itm( a[i] );
- {
- rcu_lock lock;
- value_type * pGet = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT( pGet != nullptr );
- CPPUNIT_CHECK( pGet->nKey == a[i] );
- CPPUNIT_CHECK( pGet->nVal == a[i] * 2 );
-
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->nKey == a[i] );
- CPPUNIT_CHECK( ep->nVal == a[i] * 2 );
- }
- ep.release();
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr );
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr );
- CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() ));
- CPPUNIT_CHECK( ep.empty() );
- }
- }
- }
-
- template <class OrdList>
- void nogc_test()
- {
- typedef OrdList list;
- typedef typename list::value_type value_type;
- typedef std::pair<typename list::iterator, bool> update_result;
-
- typename list::iterator it;
-
- list l;
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( l.insert(50) != l.end() );
- CPPUNIT_ASSERT( !l.empty() );
-
- update_result eres = l.update( item(100, 33) );
- CPPUNIT_ASSERT( eres.second );
- CPPUNIT_ASSERT( eres.first != l.end() );
- CPPUNIT_ASSERT( l.insert( item(150) ) != l.end() );
-
- CPPUNIT_ASSERT( l.insert(100) == l.end() );
- eres = l.update( item(50, 33) );
- CPPUNIT_ASSERT( !eres.second );
- CPPUNIT_ASSERT( eres.first->nVal == eres.first->nKey * 2 );
- eres.first->nVal = 63;
-
- it = l.contains( 33 );
- CPPUNIT_ASSERT( it == l.end() );
-
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 50 );
- CPPUNIT_ASSERT( it->nVal == 63 );
-
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 100 );
- CPPUNIT_ASSERT( it->nVal == 33 );
-
- it = l.contains( 150, lt<value_type>() );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 150 );
- CPPUNIT_ASSERT( it->nVal == it->nKey * 2 );
-
- CPPUNIT_ASSERT( !l.empty() );
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) != l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end());
- CPPUNIT_ASSERT( l.emplace( item( 1001 )) != l.end());
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end());
-
- it = l.contains( 501 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 501 );
- CPPUNIT_ASSERT( it->nVal == 501 * 2 );
-
- it = l.contains( 251, lt<value_type>() );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 251 );
- CPPUNIT_ASSERT( it->nVal == 152 );
-
- it = l.contains( 1001 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 1001 );
- CPPUNIT_ASSERT( it->nVal == 1001 * 2 );
-
- {
- typename OrdList::iterator it( l.begin() );
- typename OrdList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
-
- template <class UnordList>
- void nogc_unord_test()
- {
- typedef UnordList list;
- typedef typename list::value_type value_type;
- typedef std::pair<typename list::iterator, bool> update_result;
-
- typename list::iterator it;
-
- list l;
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( l.insert(50) != l.end() );
- CPPUNIT_ASSERT( !l.empty() );
-
- update_result eres = l.update( item(100, 33) );
- CPPUNIT_ASSERT( eres.second );
- CPPUNIT_ASSERT( eres.first != l.end() );
- CPPUNIT_ASSERT( l.insert( item(150) ) != l.end() );
-
- CPPUNIT_ASSERT( l.insert(100) == l.end() );
- eres = l.update( item(50, 33) );
- CPPUNIT_ASSERT( !eres.second );
- CPPUNIT_ASSERT( eres.first->nVal == eres.first->nKey * 2 );
- eres.first->nVal = 63;
-
- it = l.contains( 33 );
- CPPUNIT_ASSERT( it == l.end() );
-
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 50 );
- CPPUNIT_ASSERT( it->nVal == 63 );
-
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 100 );
- CPPUNIT_ASSERT( it->nVal == 33 );
-
- it = l.contains( 150, equal_to<value_type>() );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 150 );
- CPPUNIT_ASSERT( it->nVal == it->nKey * 2 );
-
- CPPUNIT_ASSERT( !l.empty() );
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) != l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end());
- CPPUNIT_ASSERT( l.emplace( item( 1001 )) != l.end());
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end());
-
- it = l.contains( 501 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 501 );
- CPPUNIT_ASSERT( it->nVal == 501 * 2 );
-
- it = l.contains( 1001 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 1001 );
- CPPUNIT_ASSERT( it->nVal == 1001 * 2 );
-
- {
- typename UnordList::iterator it( l.begin() );
- typename UnordList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
-
- void HP_cmp();
- void HP_less();
- void HP_cmpmix();
- void HP_ic();
-
- void DHP_cmp();
- void DHP_less();
- void DHP_cmpmix();
- void DHP_ic();
-
- void RCU_GPI_cmp();
- void RCU_GPI_less();
- void RCU_GPI_cmpmix();
- void RCU_GPI_ic();
-
- void RCU_GPB_cmp();
- void RCU_GPB_less();
- void RCU_GPB_cmpmix();
- void RCU_GPB_ic();
-
- void RCU_GPT_cmp();
- void RCU_GPT_less();
- void RCU_GPT_cmpmix();
- void RCU_GPT_ic();
-
- void RCU_SHB_cmp();
- void RCU_SHB_less();
- void RCU_SHB_cmpmix();
- void RCU_SHB_ic();
-
- void RCU_SHT_cmp();
- void RCU_SHT_less();
- void RCU_SHT_cmpmix();
- void RCU_SHT_ic();
-
- void NOGC_cmp();
- void NOGC_less();
- void NOGC_cmpmix();
- void NOGC_ic();
-
- void NOGC_cmp_unord();
- void NOGC_less_unord();
- void NOGC_equal_to_unord();
- void NOGC_cmpmix_unord();
- void NOGC_equal_to_mix_unord();
- void NOGC_ic_unord();
-
-
- CPPUNIT_TEST_SUITE(LazyListTestHeader)
- CPPUNIT_TEST(HP_cmp)
- CPPUNIT_TEST(HP_less)
- CPPUNIT_TEST(HP_cmpmix)
- CPPUNIT_TEST(HP_ic)
-
- CPPUNIT_TEST(DHP_cmp)
- CPPUNIT_TEST(DHP_less)
- CPPUNIT_TEST(DHP_cmpmix)
- CPPUNIT_TEST(DHP_ic)
-
- CPPUNIT_TEST(RCU_GPI_cmp)
- CPPUNIT_TEST(RCU_GPI_less)
- CPPUNIT_TEST(RCU_GPI_cmpmix)
- CPPUNIT_TEST(RCU_GPI_ic)
-
- CPPUNIT_TEST(RCU_GPB_cmp)
- CPPUNIT_TEST(RCU_GPB_less)
- CPPUNIT_TEST(RCU_GPB_cmpmix)
- CPPUNIT_TEST(RCU_GPB_ic)
-
- CPPUNIT_TEST(RCU_GPT_cmp)
- CPPUNIT_TEST(RCU_GPT_less)
- CPPUNIT_TEST(RCU_GPT_cmpmix)
- CPPUNIT_TEST(RCU_GPT_ic)
-
- CPPUNIT_TEST(RCU_SHB_cmp)
- CPPUNIT_TEST(RCU_SHB_less)
- CPPUNIT_TEST(RCU_SHB_cmpmix)
- CPPUNIT_TEST(RCU_SHB_ic)
-
- CPPUNIT_TEST(RCU_SHT_cmp)
- CPPUNIT_TEST(RCU_SHT_less)
- CPPUNIT_TEST(RCU_SHT_cmpmix)
- CPPUNIT_TEST(RCU_SHT_ic)
-
- CPPUNIT_TEST(NOGC_cmp)
- CPPUNIT_TEST(NOGC_less)
- CPPUNIT_TEST(NOGC_cmpmix)
- CPPUNIT_TEST(NOGC_ic)
-
- CPPUNIT_TEST(NOGC_cmp_unord)
- CPPUNIT_TEST(NOGC_less_unord)
- CPPUNIT_TEST(NOGC_equal_to_unord)
- CPPUNIT_TEST(NOGC_cmpmix_unord)
- CPPUNIT_TEST(NOGC_equal_to_mix_unord)
- CPPUNIT_TEST(NOGC_ic_unord)
-
- CPPUNIT_TEST_SUITE_END()
- };
-
-} // namespace ordlist
-
-#endif // #ifndef CDSTEST_HDR_LAZY_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 "list/hdr_lazy.h"
-#include <cds/container/lazy_list_dhp.h>
-
-namespace ordlist {
- namespace {
- struct DHP_cmp_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- };
- }
- void LazyListTestHeader::DHP_cmp()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::DHP, item, DHP_cmp_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::DHP, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_less_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::DHP_less()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::DHP, item, DHP_less_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::DHP, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_cmpmix_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::DHP_cmpmix()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::DHP, item, DHP_cmpmix_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::DHP, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_ic_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyListTestHeader::DHP_ic()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::DHP, item, DHP_ic_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::DHP, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy.h"
-#include <cds/container/lazy_list_hp.h>
-
-namespace ordlist {
- namespace {
- struct HP_cmp_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- };
-
- }
- void LazyListTestHeader::HP_cmp()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::HP, item, HP_cmp_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::HP, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_less_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::HP_less()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::HP, item, HP_less_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::HP, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_cmpmix_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::HP_cmpmix()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::HP, item, HP_cmpmix_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::HP, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_ic_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyListTestHeader::HP_ic()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::HP, item, HP_ic_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::HP, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
-} // namespace ordlist
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::LazyListTestHeader);
+++ /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_LAZY_KV_H
-#define CDSTEST_HDR_LAZY_KV_H
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/container/details/lazy_list_base.h>
-
-namespace ordlist {
- namespace cc = cds::container;
- namespace co = cds::container::opt;
-
- class LazyKVListTestHeader: public CppUnitMini::TestCase
- {
- public:
- typedef int key_type;
- struct value_type {
- int m_val;
-
- value_type()
- : m_val(0)
- {}
-
- value_type( int n )
- : m_val( n )
- {}
- };
-
- template <typename T>
- struct lt
- {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1 < v2;
- }
- };
-
- template <typename T>
- struct cmp {
- int operator ()(const T& v1, const T& v2 ) const
- {
- if ( v1 < v2 )
- return -1;
- return v1 > v2 ? 1 : 0;
- }
- };
-
- template <typename T>
- struct eq {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1 == v2;
- }
- };
-
- struct check_value {
- int m_nExpected;
-
- check_value( int nExpected )
- : m_nExpected( nExpected )
- {}
-
- template <typename T>
- void operator ()( T& pair )
- {
- CPPUNIT_ASSERT_CURRENT( pair.second.m_val == m_nExpected );
- }
- };
-
- struct insert_functor {
- template <typename T>
- void operator()( T& pair )
- {
- pair.second.m_val = pair.first * 10;
- }
- };
-
- struct update_functor {
- template <typename T>
- void operator()( bool /*bNew*/, T& pair )
- {
- pair.second.m_val = pair.first * 50;
- }
- };
-
- struct erase_functor {
- int nKey;
- int nVal;
-
- erase_functor()
- : nKey(0)
- , nVal(0)
- {}
-
- template <typename T>
- void operator()( T& i )
- {
- nKey = i.first;
- nVal = i.second.m_val;
- }
- };
-
- typedef float other_key;
- struct other_less {
- bool operator()( float f, int i ) const
- {
- return int(f) < i;
- }
- bool operator()( int i, float f ) const
- {
- return i < int(f);
- }
- };
-
- protected:
- template <class OrdList>
- void test_with( OrdList& l)
- {
- typedef typename OrdList::value_type value_type;
-
- typename OrdList::iterator itTest;
- typename OrdList::const_iterator citTest;
-
- CPPUNIT_ASSERT( l.empty() );
-
- // insert / find test
- CPPUNIT_ASSERT( !l.contains( 100 ));
- CPPUNIT_ASSERT( l.insert( 100 ));
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( l.contains( 100 ));
-
- check_value chk(0);
- CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
-
- CPPUNIT_ASSERT( !l.contains( 50, lt<key_type>() ));
- CPPUNIT_ASSERT( l.insert( 50, 500 ));
- CPPUNIT_ASSERT( l.contains( 50, lt<key_type>() ));
- CPPUNIT_ASSERT( !l.insert( 50, 5 ));
- chk.m_nExpected = 500;
- CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
- chk.m_nExpected = 0;
- CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( !l.contains( 150 ));
- CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ));
- CPPUNIT_ASSERT( l.contains( 150 ));
- chk.m_nExpected = 1500;
- CPPUNIT_ASSERT( l.find_with( 150, lt<key_type>(), std::ref( chk ) ) );
- chk.m_nExpected = 0;
- CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
- chk.m_nExpected = 500;
- CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
- CPPUNIT_ASSERT( !l.empty() );
-
- // erase test
-
- CPPUNIT_ASSERT( !l.erase( 500 ));
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.contains( 50 ));
- {
- erase_functor ef;
- l.erase( 50, std::ref( ef ) );
- CPPUNIT_ASSERT( ef.nKey == 50 );
- CPPUNIT_ASSERT( ef.nVal == 500 );
- }
- CPPUNIT_ASSERT( !l.contains( 50 ));
-
- // update test
- std::pair<bool, bool> bUpdateResult;
- bUpdateResult = l.update( 100, update_functor() );
- CPPUNIT_ASSERT( bUpdateResult.first );
- CPPUNIT_ASSERT( !bUpdateResult.second );
- chk.m_nExpected = 5000;
- CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
-
- {
- update_functor ef;
- bUpdateResult = l.update( 50, std::ref( ef ) );
- }
- CPPUNIT_ASSERT( bUpdateResult.first );
- CPPUNIT_ASSERT( bUpdateResult.second );
- chk.m_nExpected = 2500;
- CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
-
- // erase test
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( l.insert_with( 200, insert_functor() ));
- CPPUNIT_ASSERT( l.insert( 25 ));
- CPPUNIT_ASSERT( l.erase( 100 ));
- CPPUNIT_ASSERT( l.erase( 150 ));
- {
- erase_functor ef;
- CPPUNIT_ASSERT( l.erase_with( 200, lt<key_type>(), std::ref(ef)) );
- CPPUNIT_ASSERT( ef.nKey == 200 );
- CPPUNIT_ASSERT( ef.nVal == 2000 );
- }
- CPPUNIT_ASSERT( l.erase_with( 25, lt<key_type>()))
- CPPUNIT_ASSERT( l.erase( 50 ));
- CPPUNIT_ASSERT( l.empty() );
-
- // clear empty list
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) );
- CPPUNIT_ASSERT( l.emplace( 251, 152 ));
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( !l.emplace( 501, 2 ) );
- CPPUNIT_ASSERT( !l.emplace( 251, 10) );
-
- check_value cv(0);
- CPPUNIT_ASSERT( l.find( 501, std::ref(cv) ));
- cv.m_nExpected = 152;
- CPPUNIT_ASSERT( l.find( 251, std::ref(cv) ));
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Iterator test
- {
- int nCount = 100;
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 2 ) );
-
- {
- typename OrdList::iterator it( l.begin() );
- typename OrdList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
- int i = 0;
- for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) {
- CPPUNIT_ASSERT( it.key() == i );
- CPPUNIT_ASSERT( it.val().m_val == i * 2 );
- it.val().m_val = i * 3;
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i ) {
- chk.m_nExpected = i * 3;
- CPPUNIT_ASSERT( l.find( i, std::ref( chk ) ) );
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Const iterator
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 7) );
-
- i = 0;
- const OrdList& rl = l;
- for ( typename OrdList::const_iterator it = rl.begin(), itEnd = rl.end(); it != itEnd; ++it, ++i ) {
- CPPUNIT_ASSERT( it.key() == i );
- CPPUNIT_ASSERT( it.val().m_val == i * 7 );
- }
-
- // Check that we have visited all items
- for ( int i = nCount; i > 0; --i ) {
- chk.m_nExpected = (i - 1) * 7;
- CPPUNIT_ASSERT( l.find_with( i - 1, lt<key_type>(), std::ref( chk ) ) );
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
- }
-
- template <class OrdList>
- void test()
- {
- OrdList l;
- test_with(l);
-
- typedef typename OrdList::guarded_ptr guarded_ptr;
-
- static int const nLimit = 20;
- int arr[nLimit];
- for ( int i = 0; i < nLimit; i++ )
- arr[i] = i;
- shuffle( arr, arr + nLimit );
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- l.insert( arr[i], arr[i] * 2 );
- {
- guarded_ptr gp;
- for ( int i = 0; i < nLimit; ++i ) {
- int nKey = arr[i];
-
- gp = l.get( nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->first == nKey );
- CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
- gp.release();
-
- gp = l.extract( nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->first == nKey );
- CPPUNIT_CHECK( gp->second.m_val == nKey*2 );
- gp.release();
-
- gp = l.get( nKey );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( nKey));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get(arr[0]));
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( arr[0]));
- CPPUNIT_CHECK( gp.empty());
- }
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i )
- l.insert( arr[i], arr[i] * 2 );
- {
- guarded_ptr gp;
- for ( int i = 0; i < nLimit; ++i ) {
- int nKey = arr[i];
- other_key key = float(nKey + 0.3);
-
- gp = l.get_with( key, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->first == nKey );
- CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
- gp.release();
-
- gp = l.extract_with( key, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->first == nKey );
- CPPUNIT_CHECK( gp->second.m_val == nKey*2 );
- gp.release();
-
- gp = l.get_with( key, other_less() );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( key, other_less()));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get_with(3.4f, other_less()));
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( 3.4f, other_less()));
- CPPUNIT_CHECK( gp.empty());
- }
- }
-
- template <class OrdList>
- void test_rcu()
- {
- OrdList l;
- test_with(l);
-
- static int const nLimit = 20;
-
- typedef typename OrdList::rcu_lock rcu_lock;
- typedef typename OrdList::value_type value_type;
- typedef typename OrdList::gc rcu_type;
-
- {
- int a[nLimit];
- for (int i = 0; i < nLimit; ++i)
- a[i]=i;
- shuffle( a, a + nLimit );
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( a[i], a[i]*2 ) );
-
- typename OrdList::exempt_ptr ep;
-
- for ( int i = 0; i < nLimit; ++i ) {
- {
- rcu_lock lock;
- value_type * pGet = l.get( a[i] );
- CPPUNIT_ASSERT( pGet != nullptr );
- CPPUNIT_CHECK( pGet->first == a[i] );
- CPPUNIT_CHECK( pGet->second.m_val == a[i] * 2 );
-
- ep = l.extract( a[i] );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->first == a[i] );
- CPPUNIT_CHECK( (*ep).second.m_val == a[i] * 2 );
- }
- ep.release();
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get( a[i] ) == nullptr );
- ep = l.extract( a[i] );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get( a[0] ) == nullptr );
- CPPUNIT_CHECK( !l.extract( a[0] ) );
- }
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i ) {
- CPPUNIT_ASSERT( l.insert( a[i], a[i]*2 ) );
- }
-
- for ( int i = 0; i < nLimit; ++i ) {
- float itm = a[i] + 0.3f;
- {
- rcu_lock lock;
- value_type * pGet = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT( pGet != nullptr );
- CPPUNIT_CHECK( pGet->first == a[i] );
- CPPUNIT_CHECK( pGet->second.m_val == a[i] * 2 );
-
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->first == a[i] );
- CPPUNIT_CHECK( ep->second.m_val == a[i] * 2 );
- }
- ep.release();
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get_with( itm, other_less()) == nullptr );
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( l.get_with( 3.14f, other_less() ) == nullptr );
- CPPUNIT_CHECK( !l.extract_with( 3.14f, other_less() ));
- CPPUNIT_CHECK( ep.empty() );
- }
- }
- }
-
- template <class OrdList>
- void nogc_test()
- {
- typedef typename OrdList::value_type value_type;
- typedef typename OrdList::iterator iterator;
-
- {
- OrdList l;
- iterator it;
-
- CPPUNIT_ASSERT( l.empty() );
-
- // insert / find test
- CPPUNIT_ASSERT( l.contains( 100 ) == l.end() );
- CPPUNIT_ASSERT( l.insert( 100 ) != l.end() );
- CPPUNIT_ASSERT( !l.empty() );
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
-
- CPPUNIT_ASSERT( l.contains( 50, lt<key_type>() ) == l.end() );
- CPPUNIT_ASSERT( l.insert( 50, 500 ) != l.end());
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
-
- CPPUNIT_ASSERT( l.insert( 50, 5 ) == l.end() );
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.contains( 150 ) == l.end() );
- CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ) != l.end() );
- it = l.contains( 150 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 150 );
- CPPUNIT_ASSERT( it.val().m_val == 1500 );
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
- it.val().m_val = 25;
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 25 );
- CPPUNIT_ASSERT( !l.empty() );
-
- // update existing item
- std::pair<iterator, bool> updateResult;
- updateResult = l.update( 100 );
- CPPUNIT_ASSERT( !updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 100 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 );
- updateResult.first.val().m_val = 5;
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 5 );
-
- CPPUNIT_ASSERT( !l.empty() );
-
- // update new item
- updateResult = l.update( 1000 );
- CPPUNIT_ASSERT( updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 1000 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 );
- updateResult.first.val().m_val = 33;
- updateResult = l.update( 1000 );
- CPPUNIT_ASSERT( !updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 1000 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 33 );
-
- // clear test
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) != l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end());
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end());
-
- it = l.contains(501);
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 501 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
-
- it = l.contains(251);
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 251 );
- CPPUNIT_ASSERT( it.val().m_val == 152 );
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Iterator test
- {
- int nCount = 100;
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 2 ) != l.end() );
-
- {
- typename OrdList::iterator it( l.begin() );
- typename OrdList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
- int i = 0;
- for ( typename OrdList::iterator iter = l.begin(), itEnd = l.end(); iter != itEnd; ++iter, ++i ) {
- CPPUNIT_ASSERT( iter.key() == i );
- CPPUNIT_ASSERT( iter->first == i );
- CPPUNIT_ASSERT( (*iter).first == i );
-
- CPPUNIT_ASSERT( iter.val().m_val == i * 2 );
- CPPUNIT_ASSERT( iter->second.m_val == i * 2 );
- CPPUNIT_ASSERT( (*iter).second.m_val == i * 2 );
-
- iter.val().m_val = i * 3;
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i ) {
- it = l.contains( i );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == i );
- CPPUNIT_ASSERT( it.val().m_val == i * 3 );
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Const iterator
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 7) != l.end() );
-
- i = 0;
- const OrdList& rl = l;
- for ( typename OrdList::const_iterator iter = rl.begin(), itEnd = rl.end(); iter != itEnd; ++iter, ++i ) {
- CPPUNIT_ASSERT( iter.key() == i );
- CPPUNIT_ASSERT( iter->first == i );
- CPPUNIT_ASSERT( (*iter).first == i );
-
- CPPUNIT_ASSERT( iter.val().m_val == i * 7 );
- CPPUNIT_ASSERT( iter->second.m_val == i * 7 );
- CPPUNIT_ASSERT( (*iter).second.m_val == i * 7 );
- // it.val().m_val = i * 3 ; // error: const-iterator
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
-
- }
- }
-
- template <class UnordList>
- void nogc_unord_test()
- {
- typedef typename UnordList::value_type value_type;
- typedef typename UnordList::iterator iterator;
-
- {
- UnordList l;
- iterator it;
-
- CPPUNIT_ASSERT( l.empty() );
-
- // insert / find test
- CPPUNIT_ASSERT( l.contains( 100 ) == l.end() );
- CPPUNIT_ASSERT( l.insert( 100 ) != l.end() );
- CPPUNIT_ASSERT( !l.empty() );
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
-
- CPPUNIT_ASSERT( l.contains( 50, eq<key_type>() ) == l.end() );
- CPPUNIT_ASSERT( l.insert( 50, 500 ) != l.end());
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
-
- CPPUNIT_ASSERT( l.insert( 50, 5 ) == l.end() );
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.contains( 150 ) == l.end() );
- CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ) != l.end() );
- it = l.contains( 150 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 150 );
- CPPUNIT_ASSERT( it.val().m_val == 1500 );
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
- it.val().m_val = 25;
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 25 );
- CPPUNIT_ASSERT( !l.empty() );
-
- // update existing item
- std::pair<iterator, bool> updateResult;
- updateResult = l.update( 100 );
- CPPUNIT_ASSERT( !updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 100 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 );
- updateResult.first.val().m_val = 5;
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 5 );
-
- CPPUNIT_ASSERT( !l.empty() );
-
- // update new item
- updateResult = l.update( 1000 );
- CPPUNIT_ASSERT( updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 1000 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 );
- updateResult.first.val().m_val = 33;
- updateResult = l.update( 1000 );
- CPPUNIT_ASSERT( !updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 1000 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 33 );
-
- // clear test
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) != l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end());
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end());
-
- it = l.contains(501);
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 501 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
-
- it = l.contains(251);
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 251 );
- CPPUNIT_ASSERT( it.val().m_val == 152 );
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Iterator test
- {
- int nCount = 100;
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 2 ) != l.end() );
-
- {
- typename UnordList::iterator it( l.begin() );
- typename UnordList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
- int i = 0;
- for ( typename UnordList::iterator iter = l.begin(), itEnd = l.end(); iter != itEnd; ++iter, ++i ) {
- CPPUNIT_ASSERT( iter.key() == i );
- CPPUNIT_ASSERT( iter->first == i );
- CPPUNIT_ASSERT( (*iter).first == i );
-
- CPPUNIT_ASSERT( iter.val().m_val == i * 2 );
- CPPUNIT_ASSERT( iter->second.m_val == i * 2 );
- CPPUNIT_ASSERT( (*iter).second.m_val == i * 2 );
-
- iter.val().m_val = i * 3;
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i ) {
- it = l.contains( i );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == i );
- CPPUNIT_ASSERT( it.val().m_val == i * 3 );
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Const iterator
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 7) != l.end() );
-
- i = 0;
- const UnordList& rl = l;
- for ( typename UnordList::const_iterator iter = rl.begin(), itEnd = rl.end(); iter != itEnd; ++iter, ++i ) {
- CPPUNIT_ASSERT( iter.key() == i );
- CPPUNIT_ASSERT( iter->first == i );
- CPPUNIT_ASSERT( (*iter).first == i );
-
- CPPUNIT_ASSERT( iter.val().m_val == i * 7 );
- CPPUNIT_ASSERT( iter->second.m_val == i * 7 );
- CPPUNIT_ASSERT( (*iter).second.m_val == i * 7 );
- // it.val().m_val = i * 3 ; // error: const-iterator
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
-
- }
- }
-
-
- void HP_cmp();
- void HP_less();
- void HP_cmpmix();
- void HP_ic();
-
- void DHP_cmp();
- void DHP_less();
- void DHP_cmpmix();
- void DHP_ic();
-
- void RCU_GPI_cmp();
- void RCU_GPI_less();
- void RCU_GPI_cmpmix();
- void RCU_GPI_ic();
-
- void RCU_GPB_cmp();
- void RCU_GPB_less();
- void RCU_GPB_cmpmix();
- void RCU_GPB_ic();
-
- void RCU_GPT_cmp();
- void RCU_GPT_less();
- void RCU_GPT_cmpmix();
- void RCU_GPT_ic();
-
- void RCU_SHB_cmp();
- void RCU_SHB_less();
- void RCU_SHB_cmpmix();
- void RCU_SHB_ic();
-
- void RCU_SHT_cmp();
- void RCU_SHT_less();
- void RCU_SHT_cmpmix();
- void RCU_SHT_ic();
-
- void NOGC_cmp();
- void NOGC_less();
- void NOGC_cmpmix();
- void NOGC_ic();
-
- void NOGC_cmp_unord();
- void NOGC_less_unord();
- void NOGC_equal_to_unord();
- void NOGC_cmpmix_unord();
- void NOGC_ic_unord();
-
- CPPUNIT_TEST_SUITE(LazyKVListTestHeader)
- CPPUNIT_TEST(HP_cmp)
- CPPUNIT_TEST(HP_less)
- CPPUNIT_TEST(HP_cmpmix)
- CPPUNIT_TEST(HP_ic)
-
- CPPUNIT_TEST(DHP_cmp)
- CPPUNIT_TEST(DHP_less)
- CPPUNIT_TEST(DHP_cmpmix)
- CPPUNIT_TEST(DHP_ic)
-
- CPPUNIT_TEST(RCU_GPI_cmp)
- CPPUNIT_TEST(RCU_GPI_less)
- CPPUNIT_TEST(RCU_GPI_cmpmix)
- CPPUNIT_TEST(RCU_GPI_ic)
-
- CPPUNIT_TEST(RCU_GPB_cmp)
- CPPUNIT_TEST(RCU_GPB_less)
- CPPUNIT_TEST(RCU_GPB_cmpmix)
- CPPUNIT_TEST(RCU_GPB_ic)
-
- CPPUNIT_TEST(RCU_GPT_cmp)
- CPPUNIT_TEST(RCU_GPT_less)
- CPPUNIT_TEST(RCU_GPT_cmpmix)
- CPPUNIT_TEST(RCU_GPT_ic)
-
- CPPUNIT_TEST(RCU_SHB_cmp)
- CPPUNIT_TEST(RCU_SHB_less)
- CPPUNIT_TEST(RCU_SHB_cmpmix)
- CPPUNIT_TEST(RCU_SHB_ic)
-
- CPPUNIT_TEST(RCU_SHT_cmp)
- CPPUNIT_TEST(RCU_SHT_less)
- CPPUNIT_TEST(RCU_SHT_cmpmix)
- CPPUNIT_TEST(RCU_SHT_ic)
-
- CPPUNIT_TEST(NOGC_cmp)
- CPPUNIT_TEST(NOGC_less)
- CPPUNIT_TEST(NOGC_cmpmix)
- CPPUNIT_TEST(NOGC_ic)
-
- CPPUNIT_TEST(NOGC_cmp_unord)
- CPPUNIT_TEST(NOGC_less_unord)
- CPPUNIT_TEST(NOGC_equal_to_unord)
- CPPUNIT_TEST(NOGC_cmpmix_unord)
- CPPUNIT_TEST(NOGC_ic_unord)
-
- CPPUNIT_TEST_SUITE_END()
- };
-
-} // namespace ordlist
-
-#endif // #ifndef CDSTEST_HDR_LAZY_KV_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 "list/hdr_lazy_kv.h"
-#include <cds/container/lazy_kvlist_dhp.h>
-
-namespace ordlist {
- namespace {
- struct DHP_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- };
- }
- void LazyKVListTestHeader::DHP_cmp()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, DHP_cmp_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_less_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::DHP_less()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, DHP_less_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::DHP_cmpmix()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, DHP_cmpmix_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyKVListTestHeader::DHP_ic()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, DHP_ic_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy_kv.h"
-#include <cds/container/lazy_kvlist_hp.h>
-
-namespace ordlist {
- namespace {
- struct HP_cmp_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- };
-
- }
- void LazyKVListTestHeader::HP_cmp()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, HP_cmp_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::HP,
- key_type,
- value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_less_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::HP_less()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, HP_less_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::HP, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::HP_cmpmix()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, HP_cmpmix_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::HP, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyKVListTestHeader::HP_ic()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, HP_ic_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::HP, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
-} // namespace ordlist
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::LazyKVListTestHeader);
+++ /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 "list/hdr_lazy_kv.h"
-#include <cds/container/lazy_kvlist_nogc.h>
-
-namespace ordlist {
- namespace {
- struct NOGC_cmp_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- };
-
- }
- void LazyKVListTestHeader::NOGC_cmp()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_cmp_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::nogc,
- key_type,
- value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_less_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::NOGC_less()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_less_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::NOGC_cmpmix()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_cmpmix_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyKVListTestHeader::NOGC_ic()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_ic_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy_kv.h"
-#include <cds/container/lazy_kvlist_nogc.h>
-
-namespace ordlist {
- namespace {
- struct NOGC_cmp_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- static const bool sort = false;
- };
-
- }
- void LazyKVListTestHeader::NOGC_cmp_unord()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_cmp_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyKVList< cds::gc::nogc,
- key_type,
- value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
- namespace {
- struct NOGC_less_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- static const bool sort = false;
- };
- }
- void LazyKVListTestHeader::NOGC_less_unord()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_less_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
- namespace {
- struct NOGC_equal_to_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::eq<LazyKVListTestHeader::key_type> equal_to;
- static const bool sort = false;
- };
- }
- void LazyKVListTestHeader::NOGC_equal_to_unord()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_equal_to_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::equal_to< eq<key_type> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
- namespace {
- struct NOGC_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef LazyKVListTestHeader::eq<LazyKVListTestHeader::key_type> equal_to;
- static const bool sort = false;
- };
- }
- void LazyKVListTestHeader::NOGC_cmpmix_unord()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_cmpmix_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- ,cc::opt::equal_to< eq<key_type> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
- namespace {
- struct NOGC_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::eq<LazyKVListTestHeader::key_type> equal_to;
- typedef cds::atomicity::item_counter item_counter;
- static const bool sort = false;
- };
- }
- void LazyKVListTestHeader::NOGC_ic_unord()
- {
- // traits-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_ic_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::equal_to< eq<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_lazy_kv.h"
-#include <cds/urcu/general_buffered.h>
-#include <cds/container/lazy_kvlist_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
-
- struct RCU_GPB_cmp_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- };
- }
- void LazyKVListTestHeader::RCU_GPB_cmp()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPB_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_less_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::RCU_GPB_less()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPB_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::RCU_GPB_cmpmix()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPB_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyKVListTestHeader::RCU_GPB_ic()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPB_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy_kv.h"
-#include <cds/urcu/general_instant.h>
-#include <cds/container/lazy_kvlist_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type;
-
- struct RCU_GPI_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- };
- }
- void LazyKVListTestHeader::RCU_GPI_cmp()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPI_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_less_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::RCU_GPI_less()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPI_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::RCU_GPI_cmpmix()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPI_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyKVListTestHeader::RCU_GPI_ic()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPI_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy_kv.h"
-#include <cds/urcu/general_threaded.h>
-#include <cds/container/lazy_kvlist_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type;
-
- struct RCU_GPT_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- };
- }
- void LazyKVListTestHeader::RCU_GPT_cmp()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPT_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_less_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::RCU_GPT_less()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPT_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
- void LazyKVListTestHeader::RCU_GPT_cmpmix()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPT_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyKVListTestHeader::RCU_GPT_ic()
- {
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPT_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy_kv.h"
-#include <cds/urcu/signal_buffered.h>
-#include <cds/container/lazy_kvlist_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type;
-
- struct RCU_SHB_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- };
- }
-#endif
-
- void LazyKVListTestHeader::RCU_SHB_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_less_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
-#endif
-
- void LazyKVListTestHeader::RCU_SHB_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_cmpmix_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
-#endif
-
- void LazyKVListTestHeader::RCU_SHB_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_ic_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
-#endif
-
- void LazyKVListTestHeader::RCU_SHB_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_lazy_kv.h"
-#include <cds/urcu/signal_threaded.h>
-#include <cds/container/lazy_kvlist_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type;
-
- struct RCU_SHT_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- };
- }
-#endif
- void LazyKVListTestHeader::RCU_SHT_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHT_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_less_traits : public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
-#endif
- void LazyKVListTestHeader::RCU_SHT_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHT_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_cmpmix_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type> compare;
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- };
- }
-#endif
- void LazyKVListTestHeader::RCU_SHT_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHT_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_ic_traits: public cc::lazy_list::traits
- {
- typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
-#endif
- void LazyKVListTestHeader::RCU_SHT_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHT_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyKVList< rcu_type, key_type, value_type,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy.h"
-#include <cds/container/lazy_list_nogc.h>
-
-namespace ordlist {
- namespace {
- struct NOGC_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- };
- }
- void LazyListTestHeader::NOGC_cmp()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmp_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_less_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::NOGC_less()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_less_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::NOGC_cmpmix()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmpmix_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyListTestHeader::NOGC_ic()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_ic_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy.h"
-#include <cds/container/lazy_list_nogc.h>
-
-namespace ordlist {
- namespace {
- struct NOGC_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- static const bool sort = false;
- };
- }
- void LazyListTestHeader::NOGC_cmp_unord()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmp_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
- namespace {
- struct NOGC_less_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- static const bool sort = false;
- };
- }
- void LazyListTestHeader::NOGC_less_unord()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_less_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
- namespace {
- struct NOGC_equal_to_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::equal_to<LazyListTestHeader::item> equal_to;
- static const bool sort = false;
- };
- }
- void LazyListTestHeader::NOGC_equal_to_unord()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_equal_to_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::equal_to< equal_to<item> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
- namespace {
- struct NOGC_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- static const bool sort = false;
- };
- }
- void LazyListTestHeader::NOGC_cmpmix_unord()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmpmix_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
- namespace {
- struct NOGC_equal_to_mix_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef LazyListTestHeader::equal_to<LazyListTestHeader::item> equal_to;
- static const bool sort = false;
- };
- }
- void LazyListTestHeader::NOGC_equal_to_mix_unord()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_equal_to_mix_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- ,cc::opt::equal_to< equal_to<item> >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
- namespace {
- struct NOGC_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::equal_to<LazyListTestHeader::item> equal_to;
- typedef cds::atomicity::item_counter item_counter;
- static const bool sort = false;
- };
- }
- void LazyListTestHeader::NOGC_ic_unord()
- {
- // traits-based version
- typedef cc::LazyList< cds::gc::nogc, item, NOGC_ic_traits > list;
- nogc_unord_test< list >();
-
- // option-based version
- typedef cc::LazyList< cds::gc::nogc, item,
- cc::lazy_list::make_traits<
- cc::opt::equal_to< equal_to<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- ,cc::opt::sort<false>
- >::type
- > opt_list;
- nogc_unord_test< opt_list >();
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_lazy.h"
-#include <cds/urcu/general_buffered.h>
-#include <cds/container/lazy_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
-
- struct RCU_GPB_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- };
- }
- void LazyListTestHeader::RCU_GPB_cmp()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPB_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_less_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::RCU_GPB_less()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPB_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::RCU_GPB_cmpmix()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPB_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyListTestHeader::RCU_GPB_ic()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPB_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy.h"
-#include <cds/urcu/general_instant.h>
-#include <cds/container/lazy_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type;
-
- struct RCU_GPI_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- };
- }
- void LazyListTestHeader::RCU_GPI_cmp()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPI_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_less_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::RCU_GPI_less()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPI_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::RCU_GPI_cmpmix()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPI_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyListTestHeader::RCU_GPI_ic()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPI_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy.h"
-#include <cds/urcu/general_threaded.h>
-#include <cds/container/lazy_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type;
-
- struct RCU_GPT_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- };
- }
- void LazyListTestHeader::RCU_GPT_cmp()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPT_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_less_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::RCU_GPT_less()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPT_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_cmpmix_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
- void LazyListTestHeader::RCU_GPT_cmpmix()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPT_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_ic_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void LazyListTestHeader::RCU_GPT_ic()
- {
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_GPT_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy.h"
-#include <cds/urcu/signal_buffered.h>
-#include <cds/container/lazy_list_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type;
-
- struct RCU_SHB_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- };
- }
-#endif
- void LazyListTestHeader::RCU_SHB_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_SHB_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_less_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
-#endif
- void LazyListTestHeader::RCU_SHB_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_SHB_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_cmpmix_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
-#endif
- void LazyListTestHeader::RCU_SHB_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_SHB_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_ic_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
-#endif
- void LazyListTestHeader::RCU_SHB_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_SHB_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_lazy.h"
-#include <cds/urcu/signal_threaded.h>
-#include <cds/container/lazy_list_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type;
-
- struct RCU_SHT_cmp_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- };
- }
-#endif
- void LazyListTestHeader::RCU_SHT_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_SHT_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_less_traits : public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
-#endif
- void LazyListTestHeader::RCU_SHT_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_SHT_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_cmpmix_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- };
- }
-#endif
- void LazyListTestHeader::RCU_SHT_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_SHT_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_ic_traits: public cc::lazy_list::traits
- {
- typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
-#endif
- void LazyListTestHeader::RCU_SHT_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::LazyList< rcu_type, item, RCU_SHT_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::LazyList< rcu_type, item,
- cc::lazy_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-} // namespace ordlist
-
+++ /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_MICHAEL_H
-#define CDSTEST_HDR_MICHAEL_H
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/container/details/michael_list_base.h>
-
-namespace ordlist {
- namespace cc = cds::container;
- namespace co = cds::container::opt;
-
- class MichaelListTestHeader: public CppUnitMini::TestCase
- {
- public:
- struct stat {
- int nUpdateExistsCall;
- int nUpdateNewCall;
-
- stat()
- {
- nUpdateExistsCall
- = nUpdateNewCall
- = 0;
- }
- };
-
- struct item {
- int nKey;
- int nVal;
-
- stat s;
-
- item(int key)
- : nKey( key )
- , nVal( key * 2 )
- , s()
- {}
-
- item(int key, int val)
- : nKey( key )
- , nVal(val)
- , s()
- {}
-
- item( const item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- int key() const
- {
- return nKey;
- }
- };
-
- template <typename T>
- struct lt
- {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1.key() < v2.key();
- }
-
- template <typename Q>
- bool operator ()(const T& v1, const Q& v2 ) const
- {
- return v1.key() < v2;
- }
-
- template <typename Q>
- bool operator ()(const Q& v1, const T& v2 ) const
- {
- return v1 < v2.key();
- }
- };
-
- template <typename T>
- struct cmp {
- int operator ()(const T& v1, const T& v2 ) const
- {
- if ( v1.key() < v2.key() )
- return -1;
- return v1.key() > v2.key() ? 1 : 0;
- }
-
- template <typename Q>
- int operator ()(const T& v1, const Q& v2 ) const
- {
- if ( v1.key() < v2 )
- return -1;
- return v1.key() > v2 ? 1 : 0;
- }
-
- template <typename Q>
- int operator ()(const Q& v1, const T& v2 ) const
- {
- if ( v1 < v2.key() )
- return -1;
- return v1 > v2.key() ? 1 : 0;
- }
- };
-
- struct insert_functor {
- void operator ()( item& i )
- {
- i.nVal = i.nKey * 1033;
- }
- };
- struct dummy_insert_functor {
- void operator ()( item& /*i*/ )
- {
- // This functor should not be called
- TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_functor should not be called", __FILE__, __LINE__ );
- }
- };
-
- struct erase_functor {
- unsigned int nEraseCall;
-
- erase_functor()
- : nEraseCall(0)
- {}
-
- void operator()( item const& /*i*/)
- {
- ++nEraseCall;
- }
- };
-
- static void insert_function( item& i )
- {
- i.nVal = i.nKey * 1024;
- }
- static void dummy_insert_function( item& /*i*/ )
- {
- // This function should not be called
- TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_function should not be called", __FILE__, __LINE__ );
- }
-
-
- struct check_value {
- unsigned int m_nMultiplier;
-
- check_value( unsigned int nMultiplier )
- : m_nMultiplier( nMultiplier )
- {}
-
- check_value( const check_value& s )
- : m_nMultiplier( s.m_nMultiplier )
- {}
-
- void operator()( item& i, int )
- {
- CPPUNIT_ASSERT_CURRENT( int(i.nKey * m_nMultiplier) == i.nVal );
- }
- };
-
- struct check_exact_value {
- int m_nExpected;
-
- check_exact_value( int nExpected )
- : m_nExpected( nExpected )
- {}
-
- check_exact_value( check_exact_value const& s)
- : m_nExpected( s.m_nExpected )
- {}
-
- void operator()( item& i, int )
- {
- CPPUNIT_ASSERT_CURRENT( i.nVal == m_nExpected );
- }
- };
-
- struct dummy_check_value {
- void operator()( item& /*i*/, int )
- {
- // This functor should not be called
- TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_check_value should not be called", __FILE__, __LINE__ );
- }
- };
-
- struct update_functor {
- void operator()( bool /*bNew*/, item& i, int /*n*/ )
- {
- i.nVal = i.nKey * 1024;
- }
- };
-
- static void update_func( bool /*bNew*/, item& i, int n )
- {
- i.nVal = n * 1033;
- }
-
- struct other_item
- {
- int nKey;
-
- other_item()
- {}
-
- other_item(int n)
- : nKey(n)
- {}
- };
-
- struct other_less
- {
- template <typename T1, typename T2>
- bool operator()( T1 const& t1, T2 const& t2 ) const
- {
- return t1.nKey < t2.nKey;
- }
- };
-
- protected:
- template <class OrdList>
- void test_with( OrdList& l )
- {
- typedef typename OrdList::value_type value_type;
-
- // The list should be empty
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.insert( 50 ) );
- CPPUNIT_ASSERT( l.insert( item( 25 )) );
- CPPUNIT_ASSERT( l.insert( item( 100 )) );
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( !l.insert( 50 ) );
- CPPUNIT_ASSERT( !l.insert( item( 100 )) );
-
- // clear test
-
- // The list should not be empty
- CPPUNIT_ASSERT( !l.empty() );
- l.clear();
- // and now the list is empty
- CPPUNIT_ASSERT( l.empty() );
-
- // Test insert with functor
-
- CPPUNIT_ASSERT( l.insert( 100, insert_functor() ) );
- // passed by ref
- {
- insert_functor f;
- CPPUNIT_ASSERT( l.insert( item( 25 ), std::ref( f ) ) );
- CPPUNIT_ASSERT( !l.insert( item( 100 ), std::ref( f ) ) );
- }
- // Test insert with function
- CPPUNIT_ASSERT( l.insert( 50, insert_function ));
- CPPUNIT_ASSERT( !l.insert( 25, dummy_insert_function ));
- CPPUNIT_ASSERT( !l.insert( 100, dummy_insert_functor() ));
-
- // The list should not be empty
- CPPUNIT_ASSERT( !l.empty() );
-
- // Check inserted values
- {
- int i;
- i = 100;
- CPPUNIT_ASSERT( l.contains( 100 ));
- CPPUNIT_ASSERT( l.find( i, check_value(1033) ));
- {
- check_value f(1033);
- i = 25;
- CPPUNIT_ASSERT( l.contains( 25, lt<value_type>() ));
- CPPUNIT_ASSERT( l.find_with( i, lt<value_type>(), std::ref( f ) ) );
- }
- i = 50;
- CPPUNIT_ASSERT( l.contains( 50 ));
- CPPUNIT_ASSERT( l.find( i, check_value(1024) ));
-
- i = 10;
- CPPUNIT_ASSERT( !l.contains( 10, lt<value_type>() ));
- CPPUNIT_ASSERT( !l.find_with( i, lt<value_type>(), dummy_check_value() ));
- i = 75;
- CPPUNIT_ASSERT( !l.contains( 75 ));
- CPPUNIT_ASSERT( !l.find( i, dummy_check_value() ));
- i = 150;
- CPPUNIT_ASSERT( !l.contains( 150 ));
- CPPUNIT_ASSERT( !l.find( i, dummy_check_value() ));
- }
-
- // The list should not be empty
- CPPUNIT_ASSERT( !l.empty() );
- l.clear();
- // and now the list is empty
- CPPUNIT_ASSERT( l.empty() );
-
- // Update test
- {
- std::pair<bool, bool> updateResult;
- update_functor f;
- updateResult = l.update( 100, update_functor() );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( updateResult.second );
-
- updateResult = l.update( 200, std::ref( f ) );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( updateResult.second );
-
- updateResult = l.update( 50, update_func );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( updateResult.second );
-
- int i;
- i = 100;
- CPPUNIT_ASSERT( l.find( i, check_value(1024) ));
- i = 50;
- CPPUNIT_ASSERT( l.find( i, check_value(1033) ));
- i = 200;
- CPPUNIT_ASSERT( l.find( i, check_value(1024) ));
-
- // update existing key
- updateResult = l.update( 200, update_func );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( !updateResult.second );
- i = 200;
- CPPUNIT_ASSERT( l.find( i, check_value(1033) ));
-
- updateResult = l.update( 50, update_functor() );
- CPPUNIT_ASSERT( updateResult.first );
- CPPUNIT_ASSERT( !updateResult.second );
- i = 50;
- CPPUNIT_ASSERT( l.find( i, check_value(1024) ));
- }
-
- // erase test (list: 50, 100, 200)
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( l.insert(160));
- CPPUNIT_ASSERT( l.insert(250));
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( !l.erase( 150 ));
-
- CPPUNIT_ASSERT( l.erase( 100 ));
- CPPUNIT_ASSERT( !l.erase( 100 ));
-
- CPPUNIT_ASSERT( l.erase_with( 200, lt<value_type>() ));
- CPPUNIT_ASSERT( !l.erase_with( 200, lt<value_type>() ));
-
- {
- erase_functor ef;
- CPPUNIT_ASSERT( ef.nEraseCall == 0 );
- CPPUNIT_ASSERT( l.erase_with( 160, lt<value_type>(), std::ref(ef) ));
- CPPUNIT_ASSERT( ef.nEraseCall == 1 );
- CPPUNIT_ASSERT( !l.erase_with( 160, lt<value_type>(), std::ref(ef) ));
- CPPUNIT_ASSERT( ef.nEraseCall == 1 );
-
- CPPUNIT_ASSERT( l.erase( 250, std::ref(ef) ));
- CPPUNIT_ASSERT( ef.nEraseCall == 2 );
- CPPUNIT_ASSERT( !l.erase( 250, std::ref(ef) ));
- CPPUNIT_ASSERT( ef.nEraseCall == 2 );
- }
-
- CPPUNIT_ASSERT( l.erase( 50 ));
- CPPUNIT_ASSERT( !l.erase( 50 ));
-
- CPPUNIT_ASSERT( l.empty() );
-
- // clear empty list
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- {
- int i;
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) );
- CPPUNIT_ASSERT( l.emplace( 251, 152 ));
- CPPUNIT_ASSERT( l.emplace( item( 1001 )) );
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( !l.emplace( 501, 2 ) );
- CPPUNIT_ASSERT( !l.emplace( 251, 10) );
-
- i = 501;
- CPPUNIT_ASSERT( l.find( i, check_exact_value(501*2) ));
- i = 251;
- CPPUNIT_ASSERT( l.find( i, check_exact_value(152) ));
- i = 1001;
- CPPUNIT_ASSERT( l.find( i, check_exact_value(1001*2) ));
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
-
- // Iterator test
- {
- int nCount = 100;
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i) );
-
- {
- typename OrdList::iterator it( l.begin() );
- typename OrdList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
- int i = 0;
- for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) {
- it->nVal = i * 2;
- CPPUNIT_ASSERT( it->nKey == i );
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.find( i, check_value(2) ));
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Const iterator
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i) );
-
- i = 0;
- const OrdList& rl = l;
- for ( typename OrdList::const_iterator it = rl.begin(), itEnd = rl.end(); it != itEnd; ++it, ++i ) {
- // it->nVal = i * 2 ; // not!
- CPPUNIT_ASSERT( it->nKey == i );
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.find( i, check_value(2) ));
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
- }
-
- template <typename OrdList>
- void test()
- {
- typedef typename OrdList::guarded_ptr guarded_ptr;
- typedef typename OrdList::value_type value_type;
-
- OrdList l;
- test_with(l);
-
- static int const nLimit = 20;
- int arr[nLimit];
- for ( int i = 0; i < nLimit; i++ )
- arr[i] = i;
- shuffle( arr, arr + nLimit );
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- l.insert( arr[i] );
- {
- guarded_ptr gp;
- for ( int i = 0; i < nLimit; ++i ) {
- int nKey = arr[i];
-
- gp = l.get( nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == nKey );
- CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- gp.release();
-
- gp = l.extract( nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == nKey );
- CPPUNIT_CHECK( gp->nVal == nKey*2 );
- gp.release();
-
- gp = l.get( nKey );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( nKey));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get(arr[0]));
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( arr[0]));
- CPPUNIT_CHECK( gp.empty());
- }
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i )
- l.insert( arr[i] );
- {
- guarded_ptr gp;
- for ( int i = 0; i < nLimit; ++i ) {
- int nKey = arr[i];
- other_item key( nKey );
-
- gp = l.get_with( key, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == nKey );
- CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- gp.release();
-
- gp = l.extract_with( key, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->nKey == nKey );
- CPPUNIT_CHECK( gp->nVal == nKey*2 );
- gp.release();
-
- gp = l.get_with( key, other_less() );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( key, other_less()));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get_with(other_item(arr[0]), other_less()));
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( other_item(arr[0]), other_less()));
- CPPUNIT_CHECK( gp.empty());
- }
- }
-
- template <typename OrdList>
- void test_rcu()
- {
- OrdList l;
- test_with(l);
-
- static int const nLimit = 20;
-
- typedef typename OrdList::rcu_lock rcu_lock;
- typedef typename OrdList::value_type value_type;
- typedef typename OrdList::gc rcu_type;
-
- {
- int a[nLimit];
- for (int i = 0; i < nLimit; ++i)
- a[i]=i;
- shuffle( a, a + nLimit );
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( a[i] ) );
-
- typename OrdList::exempt_ptr ep;
- typename OrdList::raw_ptr rp;
-
- for ( int i = 0; i < nLimit; ++i ) {
- {
- rcu_lock lock;
- rp = l.get( a[i] );
- CPPUNIT_ASSERT( rp );
- CPPUNIT_CHECK( rp->nKey == a[i] );
- CPPUNIT_CHECK( rp->nVal == a[i] * 2 );
- }
- rp.release();
-
- ep = l.extract( a[i] );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->nKey == a[i] );
- CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 );
- ep.release();
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get( a[i] ));
- }
- ep = l.extract( a[i] );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get( a[0] ));
- }
- CPPUNIT_CHECK( !l.extract( a[0] ) );
- CPPUNIT_CHECK( ep.empty() );
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i ) {
- CPPUNIT_ASSERT( l.insert( a[i] ) );
- }
-
- for ( int i = 0; i < nLimit; ++i ) {
- other_item itm( a[i] );
- {
- rcu_lock lock;
- rp = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT( rp );
- CPPUNIT_CHECK( rp->nKey == a[i] );
- CPPUNIT_CHECK( rp->nVal == a[i] * 2 );
- }
- rp.release();
-
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->nKey == a[i] );
- CPPUNIT_CHECK( ep->nVal == a[i] * 2 );
- ep.release();
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get_with( itm, other_less()));
- }
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get_with( other_item( 0 ), other_less()));
- }
- CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() ));
- CPPUNIT_CHECK( ep.empty() );
- }
-
- }
-
- template <class OrdList>
- void nogc_test()
- {
- typedef OrdList list;
- typedef typename list::value_type value_type;
- typedef std::pair<typename list::iterator, bool> update_result;
-
- typename list::iterator it;
-
- list l;
- CPPUNIT_ASSERT( l.empty() );
- CPPUNIT_ASSERT( l.insert(50) != l.end() );
- CPPUNIT_ASSERT( !l.empty() );
-
- update_result eres = l.update( item(100, 33) );
- CPPUNIT_ASSERT( eres.second );
- CPPUNIT_ASSERT( eres.first != l.end() );
- CPPUNIT_ASSERT( l.insert( item(150) ) != l.end() );
-
- CPPUNIT_ASSERT( l.insert(100) == l.end() );
- eres = l.update( item(50, 33) );
- CPPUNIT_ASSERT( !eres.second );
- CPPUNIT_ASSERT( eres.first->nVal == eres.first->nKey * 2 );
- eres.first->nVal = 63;
-
- it = l.contains( 33 );
- CPPUNIT_ASSERT( it == l.end() );
-
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 50 );
- CPPUNIT_ASSERT( it->nVal == 63 );
-
- it = l.contains( 100, lt<value_type>() );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 100 );
- CPPUNIT_ASSERT( it->nVal == 33 );
-
- it = l.contains( 150 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 150 );
- CPPUNIT_ASSERT( it->nVal == it->nKey * 2 );
-
- CPPUNIT_ASSERT( !l.empty() );
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) != l.end() );
- CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end());
- CPPUNIT_ASSERT( l.emplace( item( 1001 )) != l.end() );
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end() );
- CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end() );
-
- it = l.contains( 501 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 501 );
- CPPUNIT_ASSERT( it->nVal == 501 * 2 );
-
- it = l.contains( 251 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 251 );
- CPPUNIT_ASSERT( it->nVal == 152 );
-
- it = l.contains( 1001 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it->nKey == 1001 );
- CPPUNIT_ASSERT( it->nVal == 1001 * 2 );
-
- {
- typename OrdList::iterator it( l.begin() );
- typename OrdList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
-
- void HP_cmp();
- void HP_less();
- void HP_cmpmix();
- void HP_ic();
-
- void DHP_cmp();
- void DHP_less();
- void DHP_cmpmix();
- void DHP_ic();
-
- void RCU_GPI_cmp();
- void RCU_GPI_less();
- void RCU_GPI_cmpmix();
- void RCU_GPI_ic();
-
- void RCU_GPB_cmp();
- void RCU_GPB_less();
- void RCU_GPB_cmpmix();
- void RCU_GPB_ic();
-
- void RCU_GPT_cmp();
- void RCU_GPT_less();
- void RCU_GPT_cmpmix();
- void RCU_GPT_ic();
-
- void RCU_SHB_cmp();
- void RCU_SHB_less();
- void RCU_SHB_cmpmix();
- void RCU_SHB_ic();
-
- void RCU_SHT_cmp();
- void RCU_SHT_less();
- void RCU_SHT_cmpmix();
- void RCU_SHT_ic();
-
- void NOGC_cmp();
- void NOGC_less();
- void NOGC_cmpmix();
- void NOGC_ic();
-
- CPPUNIT_TEST_SUITE(MichaelListTestHeader)
- CPPUNIT_TEST(HP_cmp)
- CPPUNIT_TEST(HP_less)
- CPPUNIT_TEST(HP_cmpmix)
- CPPUNIT_TEST(HP_ic)
-
- CPPUNIT_TEST(DHP_cmp)
- CPPUNIT_TEST(DHP_less)
- CPPUNIT_TEST(DHP_cmpmix)
- CPPUNIT_TEST(DHP_ic)
-
- CPPUNIT_TEST(RCU_GPI_cmp)
- CPPUNIT_TEST(RCU_GPI_less)
- CPPUNIT_TEST(RCU_GPI_cmpmix)
- CPPUNIT_TEST(RCU_GPI_ic)
-
- CPPUNIT_TEST(RCU_GPB_cmp)
- CPPUNIT_TEST(RCU_GPB_less)
- CPPUNIT_TEST(RCU_GPB_cmpmix)
- CPPUNIT_TEST(RCU_GPB_ic)
-
- CPPUNIT_TEST(RCU_GPT_cmp)
- CPPUNIT_TEST(RCU_GPT_less)
- CPPUNIT_TEST(RCU_GPT_cmpmix)
- CPPUNIT_TEST(RCU_GPT_ic)
-
- CPPUNIT_TEST(RCU_SHB_cmp)
- CPPUNIT_TEST(RCU_SHB_less)
- CPPUNIT_TEST(RCU_SHB_cmpmix)
- CPPUNIT_TEST(RCU_SHB_ic)
-
- CPPUNIT_TEST(RCU_SHT_cmp)
- CPPUNIT_TEST(RCU_SHT_less)
- CPPUNIT_TEST(RCU_SHT_cmpmix)
- CPPUNIT_TEST(RCU_SHT_ic)
-
- CPPUNIT_TEST(NOGC_cmp)
- CPPUNIT_TEST(NOGC_less)
- CPPUNIT_TEST(NOGC_cmpmix)
- CPPUNIT_TEST(NOGC_ic)
- CPPUNIT_TEST_SUITE_END()
- };
-
-} // namespace ordlist
-
-#endif // #ifndef CDSTEST_HDR_MICHAEL_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 "list/hdr_michael.h"
-#include <cds/container/michael_list_dhp.h>
-
-namespace ordlist {
- namespace {
- struct DHP_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- };
- }
- void MichaelListTestHeader::DHP_cmp()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::DHP, item, DHP_cmp_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::DHP, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_less_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::DHP_less()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::DHP, item, DHP_less_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::DHP, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_cmpmix_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::DHP_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::DHP, item, DHP_cmpmix_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::DHP, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_ic_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelListTestHeader::DHP_ic()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::DHP, item, DHP_ic_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::DHP, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael.h"
-#include <cds/container/michael_list_hp.h>
-
-namespace ordlist {
- namespace {
- struct HP_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- };
-
- }
- void MichaelListTestHeader::HP_cmp()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::HP, item, HP_cmp_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::HP, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_less_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::HP_less()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::HP, item, HP_less_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::HP, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_cmpmix_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::HP_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::HP, item, HP_cmpmix_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::HP, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_ic_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelListTestHeader::HP_ic()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::HP, item, HP_ic_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::HP, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
-} // namespace ordlist
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::MichaelListTestHeader);
+++ /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_MICHAEL_KV_H
-#define CDSTEST_HDR_MICHAEL_KV_H
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/container/details/michael_list_base.h>
-
-namespace ordlist {
- namespace cc = cds::container;
- namespace co = cds::container::opt;
-
- class MichaelKVListTestHeader: public CppUnitMini::TestCase
- {
- public:
- typedef int key_type;
- struct value_type {
- int m_val;
-
- value_type()
- : m_val(0)
- {}
-
- value_type( int n )
- : m_val( n )
- {}
- };
-
- template <typename T>
- struct lt
- {
- bool operator ()(const T& v1, const T& v2 ) const
- {
- return v1 < v2;
- }
- };
-
- template <typename T>
- struct cmp {
- int operator ()(const T& v1, const T& v2 ) const
- {
- if ( v1 < v2 )
- return -1;
- return v1 > v2 ? 1 : 0;
- }
- };
-
- struct check_value {
- int m_nExpected;
-
- check_value( int nExpected )
- : m_nExpected( nExpected )
- {}
-
- template <typename T>
- void operator ()( T& pair )
- {
- CPPUNIT_ASSERT_CURRENT( pair.second.m_val == m_nExpected );
- }
- };
-
- struct insert_functor {
- template <typename T>
- void operator()( T& pair )
- {
- pair.second.m_val = pair.first * 10;
- }
- };
-
- struct update_functor {
- template <typename T>
- void operator()( bool /*bNew*/, T& pair )
- {
- pair.second.m_val = pair.first * 50;
- }
- };
-
- struct erase_functor {
- int nKey;
- int nVal;
-
- erase_functor()
- : nKey(0)
- , nVal(0)
- {}
-
- template <typename T>
- void operator()( T& i )
- {
- nKey = i.first;
- nVal = i.second.m_val;
- }
- };
-
- typedef float other_key;
- struct other_less {
- bool operator()( float f, int i ) const
- {
- return int(f) < i;
- }
- bool operator()( int i, float f ) const
- {
- return i < int(f);
- }
- };
-
- protected:
- template <class OrdList>
- void test_with( OrdList& l)
- {
- typedef typename OrdList::value_type value_type;
-
- typename OrdList::iterator itTest;
- typename OrdList::const_iterator citTest;
-
- CPPUNIT_ASSERT( l.empty() );
-
- // insert / contains test
- CPPUNIT_ASSERT( !l.contains( 100 ));
- CPPUNIT_ASSERT( l.insert( 100 ));
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( l.contains( 100 ));
-
- check_value chk(0);
- CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
-
- CPPUNIT_ASSERT( !l.contains( 50, lt<key_type>() ));
- CPPUNIT_ASSERT( l.insert( 50, 500 ));
- CPPUNIT_ASSERT( l.contains( 50, lt<key_type>() ));
- CPPUNIT_ASSERT( !l.insert( 50, 5 ));
- chk.m_nExpected = 500;
- CPPUNIT_ASSERT( l.find_with( 50, lt<key_type>(), std::ref( chk ) ) );
- chk.m_nExpected = 0;
- CPPUNIT_ASSERT( l.find_with( 100, lt<key_type>(), std::ref( chk ) ) );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( !l.contains( 150 ));
- CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ));
- CPPUNIT_ASSERT( l.contains( 150 ));
- chk.m_nExpected = 1500;
- CPPUNIT_ASSERT( l.find( 150, std::ref( chk ) ) );
- chk.m_nExpected = 0;
- CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
- chk.m_nExpected = 500;
- CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
- CPPUNIT_ASSERT( !l.empty() );
-
- // erase test
-
- CPPUNIT_ASSERT( !l.erase( 500 ));
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.contains( 50 ));
- {
- erase_functor ef;
- l.erase( 50, std::ref( ef ) );
- CPPUNIT_ASSERT( ef.nKey == 50 );
- CPPUNIT_ASSERT( ef.nVal == 500 );
- }
- CPPUNIT_ASSERT( !l.contains( 50 ));
-
- // update test
- std::pair<bool, bool> bupdateResult;
- bupdateResult = l.update( 100, update_functor() );
- CPPUNIT_ASSERT( bupdateResult.first );
- CPPUNIT_ASSERT( !bupdateResult.second );
- chk.m_nExpected = 5000;
- CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
-
- {
- update_functor ef;
- bupdateResult = l.update( 50, std::ref( ef ) );
- }
- CPPUNIT_ASSERT( bupdateResult.first );
- CPPUNIT_ASSERT( bupdateResult.second );
- chk.m_nExpected = 2500;
- CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
-
- // erase test
- CPPUNIT_ASSERT( !l.empty() );
- CPPUNIT_ASSERT( l.insert_with( 200, insert_functor() ));
- CPPUNIT_ASSERT( l.insert( 25 ));
- CPPUNIT_ASSERT( l.erase( 100 ));
- CPPUNIT_ASSERT( l.erase( 150 ));
- {
- erase_functor ef;
- CPPUNIT_ASSERT( l.erase_with( 200, lt<key_type>(), std::ref(ef)) );
- CPPUNIT_ASSERT( ef.nKey == 200 );
- CPPUNIT_ASSERT( ef.nVal == 2000 );
- }
- CPPUNIT_ASSERT( l.erase_with( 25, lt<key_type>()))
- CPPUNIT_ASSERT( l.erase( 50 ));
- CPPUNIT_ASSERT( l.empty() );
-
- // clear empty list
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) );
- CPPUNIT_ASSERT( l.emplace( 251, 152 ));
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( !l.emplace( 501, 2 ) );
- CPPUNIT_ASSERT( !l.emplace( 251, 10) );
-
- check_value cv(0);
- CPPUNIT_ASSERT( l.find( 501, std::ref(cv) ));
- cv.m_nExpected = 152;
- CPPUNIT_ASSERT( l.find( 251, std::ref(cv) ));
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Iterator test
- {
- int nCount = 100;
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 2 ) );
-
- {
- typename OrdList::iterator it( l.begin() );
- typename OrdList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
- int i = 0;
- for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) {
- CPPUNIT_ASSERT( it.key() == i );
- CPPUNIT_ASSERT( it->first == i );
- CPPUNIT_ASSERT( (*it).first == i );
-
- CPPUNIT_ASSERT( it.val().m_val == i * 2 );
- CPPUNIT_ASSERT( it->second.m_val == i * 2 );
- CPPUNIT_ASSERT( (*it).second.m_val == i * 2 );
- it.val().m_val = i * 3;
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i ) {
- chk.m_nExpected = i * 3;
- CPPUNIT_ASSERT( l.find( i, std::ref( chk ) ) );
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Const iterator
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 7) );
-
- i = 0;
- const OrdList& rl = l;
- for ( typename OrdList::const_iterator it = rl.begin(), itEnd = rl.end(); it != itEnd; ++it, ++i ) {
- CPPUNIT_ASSERT( it.key() == i );
- CPPUNIT_ASSERT( it->first == i );
- CPPUNIT_ASSERT( (*it).first == i );
-
- CPPUNIT_ASSERT( it.val().m_val == i * 7 );
- CPPUNIT_ASSERT( it->second.m_val == i * 7 );
- CPPUNIT_ASSERT( (*it).second.m_val == i * 7 );
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i ) {
- chk.m_nExpected = i * 7;
- CPPUNIT_ASSERT( l.find_with( i, lt<key_type>(), std::ref( chk ) ) );
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
- }
-
- template <class OrdList>
- void test()
- {
- OrdList l;
- test_with(l);
-
- typedef typename OrdList::guarded_ptr guarded_ptr;
-
- static int const nLimit = 20;
- int arr[nLimit];
- for ( int i = 0; i < nLimit; i++ )
- arr[i] = i;
- shuffle( arr, arr + nLimit );
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- l.insert( arr[i], arr[i] * 2 );
- {
- guarded_ptr gp;
- for ( int i = 0; i < nLimit; ++i ) {
- int nKey = arr[i];
-
- gp = l.get( nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->first == nKey );
- CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
- gp.release();
- CPPUNIT_CHECK( gp.empty() );
-
- gp = l.extract( nKey );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->first == nKey );
- CPPUNIT_CHECK( gp->second.m_val == nKey*2 );
- gp.release();
-
- gp = l.get( nKey );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( nKey));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get(arr[0]));
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( arr[0]));
- CPPUNIT_CHECK( gp.empty());
- }
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i )
- l.insert( arr[i], arr[i] * 2 );
- {
- guarded_ptr gp;
- for ( int i = 0; i < nLimit; ++i ) {
- int nKey = arr[i];
- other_key key = float(nKey + 0.3);
-
- gp = l.get_with( key, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->first == nKey );
- CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
- gp.release();
-
- gp = l.extract_with( key, other_less() );
- CPPUNIT_ASSERT( gp );
- CPPUNIT_ASSERT( !gp.empty());
- CPPUNIT_CHECK( gp->first == nKey );
- CPPUNIT_CHECK( gp->second.m_val == nKey*2 );
- gp.release();
-
- gp = l.get_with( key, other_less() );
- CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( key, other_less()));
- CPPUNIT_CHECK( gp.empty());
- }
- CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get_with( 3.4f, other_less()));
- CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( 3.4f, other_less()));
- CPPUNIT_CHECK( gp.empty());
- }
- }
-
- template <class OrdList>
- void test_rcu()
- {
- OrdList l;
- test_with(l);
-
- static int const nLimit = 20;
-
- typedef typename OrdList::rcu_lock rcu_lock;
- typedef typename OrdList::value_type value_type;
- typedef typename OrdList::gc rcu_type;
-
- {
- int a[nLimit];
- for (int i = 0; i < nLimit; ++i)
- a[i]=i;
- shuffle( a, a + nLimit );
-
- // extract/get
- for ( int i = 0; i < nLimit; ++i )
- CPPUNIT_ASSERT( l.insert( a[i], a[i]*2 ) );
-
- typename OrdList::exempt_ptr ep;
- typename OrdList::raw_ptr rp;
-
- for ( int i = 0; i < nLimit; ++i ) {
- {
- rcu_lock lock;
- rp = l.get( a[i] );
- CPPUNIT_ASSERT( rp );
- CPPUNIT_CHECK( rp->first == a[i] );
- CPPUNIT_CHECK( rp->second.m_val == a[i] * 2 );
- }
- rp.release();
-
- ep = l.extract( a[i] );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->first == a[i] );
- CPPUNIT_CHECK( (*ep).second.m_val == a[i] * 2 );
- ep.release();
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get( a[i] ));
- }
- ep = l.extract( a[i] );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get( a[0] ));
- }
- CPPUNIT_CHECK( !l.extract( a[0] ) );
- CPPUNIT_CHECK( ep.empty() );
-
- // extract_with/get_with
- for ( int i = 0; i < nLimit; ++i ) {
- CPPUNIT_ASSERT( l.insert( a[i], a[i]*2 ) );
- }
-
- for ( int i = 0; i < nLimit; ++i ) {
- float itm = a[i] + 0.3f;
- {
- rcu_lock lock;
- rp = l.get_with( itm, other_less() );
- CPPUNIT_ASSERT( rp );
- CPPUNIT_CHECK( rp->first == a[i] );
- CPPUNIT_CHECK( rp->second.m_val == a[i] * 2 );
- }
- rp.release();
-
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_ASSERT( ep );
- CPPUNIT_ASSERT( !ep.empty() );
- CPPUNIT_CHECK( ep->first == a[i] );
- CPPUNIT_CHECK( ep->second.m_val == a[i] * 2 );
- ep.release();
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get_with( itm, other_less()));
- }
- ep = l.extract_with( itm, other_less() );
- CPPUNIT_CHECK( !ep );
- CPPUNIT_CHECK( ep.empty() );
- }
- CPPUNIT_ASSERT( l.empty() );
-
- {
- rcu_lock lock;
- CPPUNIT_CHECK( !l.get_with( 3.14f, other_less() ));
- }
- CPPUNIT_CHECK( !l.extract_with( 3.14f, other_less() ));
- CPPUNIT_CHECK( ep.empty() );
- }
- }
-
- template <class OrdList>
- void nogc_test()
- {
- typedef typename OrdList::value_type value_type;
- typedef typename OrdList::iterator iterator;
-
- {
- OrdList l;
- iterator it;
-
- CPPUNIT_ASSERT( l.empty() );
-
- // insert / find test
- CPPUNIT_ASSERT( l.contains( 100 ) == l.end() );
- CPPUNIT_ASSERT( l.insert( 100 ) != l.end() );
- CPPUNIT_ASSERT( !l.empty() );
- it = l.contains( 100, lt<key_type>() );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
-
- CPPUNIT_ASSERT( l.contains( 50, lt<key_type>() ) == l.end() );
- CPPUNIT_ASSERT( l.insert( 50, 500 ) != l.end());
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
-
- CPPUNIT_ASSERT( l.insert( 50, 5 ) == l.end() );
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
- CPPUNIT_ASSERT( !l.empty() );
-
- CPPUNIT_ASSERT( l.contains( 150 ) == l.end() );
- CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ) != l.end() );
- it = l.contains( 150 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 150 );
- CPPUNIT_ASSERT( it.val().m_val == 1500 );
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 500 );
- it.val().m_val = 25;
- it = l.contains( 50 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 50 );
- CPPUNIT_ASSERT( it.val().m_val == 25 );
- CPPUNIT_ASSERT( !l.empty() );
-
- // update existing item
- std::pair<iterator, bool> updateResult;
- updateResult = l.update( 100 );
- CPPUNIT_ASSERT( !updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 100 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 );
- updateResult.first.val().m_val = 5;
- it = l.contains( 100 );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == 100 );
- CPPUNIT_ASSERT( it.val().m_val == 5 );
-
- CPPUNIT_ASSERT( !l.empty() );
-
- // update new item
- updateResult = l.update( 1000 );
- CPPUNIT_ASSERT( updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 1000 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 );
- updateResult.first.val().m_val = 33;
- updateResult = l.update( 1000 );
- CPPUNIT_ASSERT( !updateResult.second );
- CPPUNIT_ASSERT( updateResult.first.key() == 1000 );
- CPPUNIT_ASSERT( updateResult.first.val().m_val == 33 );
-
- // clear test
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // insert test
- CPPUNIT_ASSERT( l.emplace( 501 ) != l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end());
-
- // insert failed - such key exists
- CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end());
- CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end());
-
- it = l.contains( 501 );
- CPPUNIT_ASSERT( it != l.end());
- CPPUNIT_ASSERT( it.key() == 501 );
- CPPUNIT_ASSERT( it.val().m_val == 0 );
-
- it = l.contains( 251 );
- CPPUNIT_ASSERT( it != l.end());
- CPPUNIT_ASSERT( it.key() == 251 );
- CPPUNIT_ASSERT( it.val().m_val == 152 );
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Iterator test
- {
- int nCount = 100;
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 2 ) != l.end() );
-
- {
- typename OrdList::iterator it( l.begin() );
- typename OrdList::const_iterator cit( l.cbegin() );
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++it;
- CPPUNIT_CHECK( it != cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- ++cit;
- CPPUNIT_CHECK( it == cit );
- CPPUNIT_CHECK( it != l.end() );
- CPPUNIT_CHECK( it != l.cend() );
- CPPUNIT_CHECK( cit != l.end() );
- CPPUNIT_CHECK( cit != l.cend() );
- }
-
- int i = 0;
- for ( typename OrdList::iterator iter = l.begin(), itEnd = l.end(); iter != itEnd; ++iter, ++i ) {
- CPPUNIT_ASSERT( iter.key() == i );
- CPPUNIT_ASSERT( iter->first == i );
- CPPUNIT_ASSERT( (*iter).first == i );
-
- CPPUNIT_ASSERT( iter.val().m_val == i * 2 );
- CPPUNIT_ASSERT( iter->second.m_val == i * 2 );
- CPPUNIT_ASSERT( (*iter).second.m_val == i * 2 );
-
- iter.val().m_val = i * 3;
- }
-
- // Check that we have visited all items
- for ( int i = 0; i < nCount; ++i ) {
- it = l.contains( i );
- CPPUNIT_ASSERT( it != l.end() );
- CPPUNIT_ASSERT( it.key() == i );
- CPPUNIT_ASSERT( it.val().m_val == i * 3 );
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
-
- // Const iterator
- for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i, i * 7) != l.end() );
-
- i = 0;
- const OrdList& rl = l;
- for ( typename OrdList::const_iterator iter = rl.begin(), itEnd = rl.end(); iter != itEnd; ++iter, ++i ) {
- CPPUNIT_ASSERT( iter.key() == i );
- CPPUNIT_ASSERT( iter->first == i );
- CPPUNIT_ASSERT( (*iter).first == i );
-
- CPPUNIT_ASSERT( iter.val().m_val == i * 7 );
- CPPUNIT_ASSERT( iter->second.m_val == i * 7 );
- CPPUNIT_ASSERT( (*iter).second.m_val == i * 7 );
-
- // it.val().m_val = i * 3 ; // error: const-iterator
- }
-
- l.clear();
- CPPUNIT_ASSERT( l.empty() );
- }
-
- }
- }
-
- void HP_cmp();
- void HP_less();
- void HP_cmpmix();
- void HP_ic();
-
- void DHP_cmp();
- void DHP_less();
- void DHP_cmpmix();
- void DHP_ic();
-
- void RCU_GPI_cmp();
- void RCU_GPI_less();
- void RCU_GPI_cmpmix();
- void RCU_GPI_ic();
-
- void RCU_GPB_cmp();
- void RCU_GPB_less();
- void RCU_GPB_cmpmix();
- void RCU_GPB_ic();
-
- void RCU_GPT_cmp();
- void RCU_GPT_less();
- void RCU_GPT_cmpmix();
- void RCU_GPT_ic();
-
- void RCU_SHB_cmp();
- void RCU_SHB_less();
- void RCU_SHB_cmpmix();
- void RCU_SHB_ic();
-
- void RCU_SHT_cmp();
- void RCU_SHT_less();
- void RCU_SHT_cmpmix();
- void RCU_SHT_ic();
-
- void NOGC_cmp();
- void NOGC_less();
- void NOGC_cmpmix();
- void NOGC_ic();
-
- CPPUNIT_TEST_SUITE(MichaelKVListTestHeader)
- CPPUNIT_TEST(HP_cmp)
- CPPUNIT_TEST(HP_less)
- CPPUNIT_TEST(HP_cmpmix)
- CPPUNIT_TEST(HP_ic)
-
- CPPUNIT_TEST(DHP_cmp)
- CPPUNIT_TEST(DHP_less)
- CPPUNIT_TEST(DHP_cmpmix)
- CPPUNIT_TEST(DHP_ic)
-
- CPPUNIT_TEST(RCU_GPI_cmp)
- CPPUNIT_TEST(RCU_GPI_less)
- CPPUNIT_TEST(RCU_GPI_cmpmix)
- CPPUNIT_TEST(RCU_GPI_ic)
-
- CPPUNIT_TEST(RCU_GPB_cmp)
- CPPUNIT_TEST(RCU_GPB_less)
- CPPUNIT_TEST(RCU_GPB_cmpmix)
- CPPUNIT_TEST(RCU_GPB_ic)
-
- CPPUNIT_TEST(RCU_GPT_cmp)
- CPPUNIT_TEST(RCU_GPT_less)
- CPPUNIT_TEST(RCU_GPT_cmpmix)
- CPPUNIT_TEST(RCU_GPT_ic)
-
- CPPUNIT_TEST(RCU_SHB_cmp)
- CPPUNIT_TEST(RCU_SHB_less)
- CPPUNIT_TEST(RCU_SHB_cmpmix)
- CPPUNIT_TEST(RCU_SHB_ic)
-
- CPPUNIT_TEST(RCU_SHT_cmp)
- CPPUNIT_TEST(RCU_SHT_less)
- CPPUNIT_TEST(RCU_SHT_cmpmix)
- CPPUNIT_TEST(RCU_SHT_ic)
-
- CPPUNIT_TEST(NOGC_cmp)
- CPPUNIT_TEST(NOGC_less)
- CPPUNIT_TEST(NOGC_cmpmix)
- CPPUNIT_TEST(NOGC_ic)
- CPPUNIT_TEST_SUITE_END()
- };
-
-} // namespace ordlist
-
-#endif // #ifndef CDSTEST_HDR_MICHAEL_KV_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 "list/hdr_michael_kv.h"
-#include <cds/container/michael_kvlist_dhp.h>
-
-namespace ordlist {
- namespace {
- struct DHP_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- };
- }
- void MichaelKVListTestHeader::DHP_cmp()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, DHP_cmp_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_less_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::DHP_less()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, DHP_less_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_cmpmix_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::DHP_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, DHP_cmpmix_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct DHP_ic_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelKVListTestHeader::DHP_ic()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, DHP_ic_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael_kv.h"
-#include <cds/container/michael_kvlist_hp.h>
-
-namespace ordlist {
- namespace {
- struct HP_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- };
-
- }
- void MichaelKVListTestHeader::HP_cmp()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, HP_cmp_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::HP,
- key_type,
- value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_less_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::HP_less()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, HP_less_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_cmpmix_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::HP_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, HP_cmpmix_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
- namespace {
- struct HP_ic_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelKVListTestHeader::HP_ic()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, HP_ic_traits > list;
- test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test< opt_list >();
- }
-
-} // namespace ordlist
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::MichaelKVListTestHeader);
+++ /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 "list/hdr_michael_kv.h"
-#include <cds/container/michael_kvlist_nogc.h>
-
-namespace ordlist {
- namespace {
- struct NOGC_cmp_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- };
-
- }
- void MichaelKVListTestHeader::NOGC_cmp()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, NOGC_cmp_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::nogc,
- key_type,
- value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_less_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::NOGC_less()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, NOGC_less_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_cmpmix_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::NOGC_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, NOGC_cmpmix_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_ic_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelKVListTestHeader::NOGC_ic()
- {
- // traits-based version
- typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, NOGC_ic_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael_kv.h"
-#include <cds/urcu/general_buffered.h>
-#include <cds/container/michael_kvlist_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
- struct RCU_GPB_cmp_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- };
- }
- void MichaelKVListTestHeader::RCU_GPB_cmp()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPB_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_less_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::RCU_GPB_less()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPB_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_cmpmix_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::RCU_GPB_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPB_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_ic_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelKVListTestHeader::RCU_GPB_ic()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPB_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael_kv.h"
-#include <cds/urcu/general_instant.h>
-#include <cds/container/michael_kvlist_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type;
- struct RCU_GPI_cmp_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- };
- }
- void MichaelKVListTestHeader::RCU_GPI_cmp()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPI_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_less_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::RCU_GPI_less()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPI_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_cmpmix_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::RCU_GPI_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPI_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_ic_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelKVListTestHeader::RCU_GPI_ic()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPI_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael_kv.h"
-#include <cds/urcu/general_threaded.h>
-#include <cds/container/michael_kvlist_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type;
- struct RCU_GPT_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- };
- }
- void MichaelKVListTestHeader::RCU_GPT_cmp()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPT_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_less_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::RCU_GPT_less()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPT_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_cmpmix_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
- void MichaelKVListTestHeader::RCU_GPT_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPT_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_ic_traits : public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelKVListTestHeader::RCU_GPT_ic()
- {
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPT_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael_kv.h"
-#include <cds/urcu/signal_buffered.h>
-#include <cds/container/michael_kvlist_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type;
- struct RCU_SHB_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- };
- }
-#endif
- void MichaelKVListTestHeader::RCU_SHB_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHB_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_less_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
-#endif
- void MichaelKVListTestHeader::RCU_SHB_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHB_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_cmpmix_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
-#endif
- void MichaelKVListTestHeader::RCU_SHB_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHB_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_ic_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
-#endif
- void MichaelKVListTestHeader::RCU_SHB_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHB_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_michael_kv.h"
-#include <cds/urcu/signal_threaded.h>
-#include <cds/container/michael_kvlist_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type;
- struct RCU_SHT_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- };
- }
-#endif
- void MichaelKVListTestHeader::RCU_SHT_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHT_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_less_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
-#endif
- void MichaelKVListTestHeader::RCU_SHT_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHT_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_cmpmix_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::cmp<MichaelKVListTestHeader::key_type> compare;
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- };
- }
-#endif
- void MichaelKVListTestHeader::RCU_SHT_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHT_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<key_type> >
- ,cc::opt::less< lt<key_type> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_ic_traits: public cc::michael_list::traits
- {
- typedef MichaelKVListTestHeader::lt<MichaelKVListTestHeader::key_type> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
-#endif
- void MichaelKVListTestHeader::RCU_SHT_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHT_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelKVList< rcu_type, key_type, value_type,
- cc::michael_list::make_traits<
- cc::opt::less< lt<key_type> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_michael.h"
-#include <cds/container/michael_list_nogc.h>
-
-namespace ordlist {
- namespace {
- struct NOGC_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- };
- }
- void MichaelListTestHeader::NOGC_cmp()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::nogc, item, NOGC_cmp_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::nogc, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_less_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::NOGC_less()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::nogc, item, NOGC_less_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::nogc, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_cmpmix_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::NOGC_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::nogc, item, NOGC_cmpmix_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::nogc, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
- namespace {
- struct NOGC_ic_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelListTestHeader::NOGC_ic()
- {
- // traits-based version
- typedef cc::MichaelList< cds::gc::nogc, item, NOGC_ic_traits > list;
- nogc_test< list >();
-
- // option-based version
-
- typedef cc::MichaelList< cds::gc::nogc, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- nogc_test< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael.h"
-#include <cds/urcu/general_buffered.h>
-#include <cds/container/michael_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
-
- struct RCU_GPB_cmp_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- };
- }
-
- void MichaelListTestHeader::RCU_GPB_cmp()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPB_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_less_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::RCU_GPB_less()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPB_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_cmpmix_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::RCU_GPB_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPB_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPB_ic_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelListTestHeader::RCU_GPB_ic()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPB_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael.h"
-#include <cds/urcu/general_instant.h>
-#include <cds/container/michael_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type;
-
- struct RCU_GPI_cmp_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- };
- }
-
- void MichaelListTestHeader::RCU_GPI_cmp()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPI_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_less_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::RCU_GPI_less()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPI_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_cmpmix_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::RCU_GPI_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPI_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPI_ic_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelListTestHeader::RCU_GPI_ic()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPI_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael.h"
-#include <cds/urcu/general_threaded.h>
-#include <cds/container/michael_list_rcu.h>
-
-namespace ordlist {
- namespace {
- typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type;
-
- struct RCU_GPT_cmp_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- };
- }
-
- void MichaelListTestHeader::RCU_GPT_cmp()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPT_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_less_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::RCU_GPT_less()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPT_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_cmpmix_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
- void MichaelListTestHeader::RCU_GPT_cmpmix()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPT_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
- namespace {
- struct RCU_GPT_ic_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
- void MichaelListTestHeader::RCU_GPT_ic()
- {
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_GPT_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
- }
-
-} // namespace ordlist
-
+++ /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 "list/hdr_michael.h"
-#include <cds/urcu/signal_buffered.h>
-#include <cds/container/michael_list_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type;
-
- struct RCU_SHB_cmp_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- };
- }
-#endif
-
- void MichaelListTestHeader::RCU_SHB_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_SHB_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_less_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
-#endif
- void MichaelListTestHeader::RCU_SHB_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_SHB_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_cmpmix_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
-#endif
- void MichaelListTestHeader::RCU_SHB_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_SHB_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHB_ic_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
-#endif
- void MichaelListTestHeader::RCU_SHB_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_SHB_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-} // namespace ordlist
+++ /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 "list/hdr_michael.h"
-#include <cds/urcu/signal_threaded.h>
-#include <cds/container/michael_list_rcu.h>
-
-namespace ordlist {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type;
-
- struct RCU_SHT_cmp_traits : public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- };
- }
-#endif
-
- void MichaelListTestHeader::RCU_SHT_cmp()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_SHT_cmp_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_less_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
-#endif
- void MichaelListTestHeader::RCU_SHT_less()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_SHT_less_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_cmpmix_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::cmp<MichaelListTestHeader::item> compare;
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- };
- }
-#endif
- void MichaelListTestHeader::RCU_SHT_cmpmix()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_SHT_cmpmix_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::compare< cmp<item> >
- ,cc::opt::less< lt<item> >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- namespace {
- struct RCU_SHT_ic_traits: public cc::michael_list::traits
- {
- typedef MichaelListTestHeader::lt<MichaelListTestHeader::item> less;
- typedef cds::atomicity::item_counter item_counter;
- };
- }
-#endif
- void MichaelListTestHeader::RCU_SHT_ic()
- {
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- // traits-based version
- typedef cc::MichaelList< rcu_type, item, RCU_SHT_ic_traits > list;
- test_rcu< list >();
-
- // option-based version
-
- typedef cc::MichaelList< rcu_type, item,
- cc::michael_list::make_traits<
- cc::opt::less< lt<item> >
- ,cc::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > opt_list;
- test_rcu< opt_list >();
-#endif
- }
-
-} // namespace ordlist
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pqueue)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/queue)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/set2)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stack)
\ No newline at end of file
+++ /dev/null
-set(PACKAGE_NAME cdsu-stack)
-
-set(CDSUNIT_STACK_SOURCES
- stack_push.cpp
- stack_pushpop.cpp
- stack_intrusive_pushpop.cpp)
-
-add_executable(${PACKAGE_NAME} ${CDSUNIT_STACK_SOURCES} $<TARGET_OBJECTS:${TEST_COMMON}>)
-target_link_libraries(${PACKAGE_NAME} ${CDS_SHARED_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.
-*/
-
-#ifndef CDSUNIT_INTRUSIVE_STACK_DEFS_H
-#define CDSUNIT_INTRUSIVE_STACK_DEFS_H
-
-#define CDSUNIT_DECLARE_TreiberStack \
- TEST_CASE( Treiber_HP, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_CASE( Treiber_HP_seqcst, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- /*TEST_CASE( Treiber_HP_yield, cds::intrusive::treiber_stack::node< cds::gc::HP > )*/ \
- TEST_CASE( Treiber_HP_pause, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_CASE( Treiber_HP_exp, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_CASE( Treiber_HP_stat, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_CASE( Treiber_DHP, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- /*TEST_CASE( Treiber_DHP_yield, cds::intrusive::treiber_stack::node< cds::gc::DHP > )*/ \
- TEST_CASE( Treiber_DHP_pause, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_CASE( Treiber_DHP_exp, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_CASE( Treiber_DHP_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP > )
-
-#define CDSUNIT_TEST_TreiberStack \
- CPPUNIT_TEST( Treiber_HP ) \
- CPPUNIT_TEST( Treiber_HP_seqcst ) \
- /*CPPUNIT_TEST( Treiber_HP_yield )*/ \
- CPPUNIT_TEST( Treiber_HP_pause ) \
- CPPUNIT_TEST( Treiber_HP_exp ) \
- CPPUNIT_TEST( Treiber_HP_stat ) \
- CPPUNIT_TEST( Treiber_DHP ) \
- /*CPPUNIT_TEST( Treiber_DHP_yield )*/ \
- CPPUNIT_TEST( Treiber_DHP_pause ) \
- CPPUNIT_TEST( Treiber_DHP_exp ) \
- CPPUNIT_TEST( Treiber_DHP_stat )
-
-#define CDSUNIT_DECLARE_EliminationStack \
- TEST_ELIMINATION( Elimination_HP, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_ELIMINATION( Elimination_HP_2ms, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_ELIMINATION( Elimination_HP_2ms_stat, cds::intrusive::treiber_stack::node< cds::gc::HP >) \
- TEST_ELIMINATION( Elimination_HP_5ms, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_ELIMINATION( Elimination_HP_5ms_stat, cds::intrusive::treiber_stack::node< cds::gc::HP >) \
- TEST_ELIMINATION( Elimination_HP_10ms, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_ELIMINATION( Elimination_HP_10ms_stat, cds::intrusive::treiber_stack::node< cds::gc::HP >) \
- TEST_ELIMINATION( Elimination_HP_seqcst, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- /*TEST_ELIMINATION( Elimination_HP_yield, cds::intrusive::treiber_stack::node< cds::gc::HP > )*/ \
- TEST_ELIMINATION( Elimination_HP_pause, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_ELIMINATION( Elimination_HP_exp, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_ELIMINATION( Elimination_HP_stat, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_ELIMINATION( Elimination_HP_dyn, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \
- TEST_ELIMINATION( Elimination_HP_dyn_stat, cds::intrusive::treiber_stack::node< cds::gc::HP >) \
- TEST_ELIMINATION( Elimination_DHP, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_ELIMINATION( Elimination_DHP_2ms, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_ELIMINATION( Elimination_DHP_2ms_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP >) \
- TEST_ELIMINATION( Elimination_DHP_5ms, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_ELIMINATION( Elimination_DHP_5ms_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP >) \
- TEST_ELIMINATION( Elimination_DHP_10ms, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_ELIMINATION( Elimination_DHP_10ms_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP >) \
- TEST_ELIMINATION( Elimination_DHP_seqcst, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- /*TEST_ELIMINATION( Elimination_DHP_yield, cds::intrusive::treiber_stack::node< cds::gc::DHP > )*/ \
- TEST_ELIMINATION( Elimination_DHP_pause, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_ELIMINATION( Elimination_DHP_exp, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_ELIMINATION( Elimination_DHP_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_ELIMINATION( Elimination_DHP_dyn, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \
- TEST_ELIMINATION( Elimination_DHP_dyn_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP >)
-
-#define CDSUNIT_TEST_EliminationStack \
- CPPUNIT_TEST( Elimination_HP ) \
- CPPUNIT_TEST( Elimination_HP_2ms ) \
- CPPUNIT_TEST( Elimination_HP_2ms_stat) \
- CPPUNIT_TEST( Elimination_HP_5ms ) \
- CPPUNIT_TEST( Elimination_HP_5ms_stat) \
- CPPUNIT_TEST( Elimination_HP_10ms ) \
- CPPUNIT_TEST( Elimination_HP_10ms_stat) \
- CPPUNIT_TEST( Elimination_HP_seqcst ) \
- /*CPPUNIT_TEST( Elimination_HP_yield )*/ \
- CPPUNIT_TEST( Elimination_HP_pause ) \
- CPPUNIT_TEST( Elimination_HP_exp ) \
- CPPUNIT_TEST( Elimination_HP_stat ) \
- CPPUNIT_TEST( Elimination_HP_dyn ) \
- CPPUNIT_TEST( Elimination_HP_dyn_stat) \
- CPPUNIT_TEST( Elimination_DHP ) \
- CPPUNIT_TEST( Elimination_DHP_seqcst ) \
- CPPUNIT_TEST( Elimination_DHP_2ms ) \
- CPPUNIT_TEST( Elimination_DHP_2ms_stat) \
- CPPUNIT_TEST( Elimination_DHP_5ms ) \
- CPPUNIT_TEST( Elimination_DHP_5ms_stat) \
- CPPUNIT_TEST( Elimination_DHP_10ms ) \
- CPPUNIT_TEST( Elimination_DHP_10ms_stat) \
- /*CPPUNIT_TEST( Elimination_DHP_yield )*/ \
- CPPUNIT_TEST( Elimination_DHP_pause ) \
- CPPUNIT_TEST( Elimination_DHP_exp ) \
- CPPUNIT_TEST( Elimination_DHP_stat ) \
- CPPUNIT_TEST( Elimination_DHP_dyn ) \
- CPPUNIT_TEST( Elimination_DHP_dyn_stat)
-
-#define CDSUNIT_DECLARE_FCStack \
- TEST_FCSTACK( FCStack_slist, boost::intrusive::slist_base_hook<> ) \
- TEST_FCSTACK( FCStack_slist_stat, boost::intrusive::slist_base_hook<> ) \
- TEST_FCSTACK( FCStack_slist_elimination, boost::intrusive::slist_base_hook<> ) \
- TEST_FCSTACK( FCStack_slist_elimination_stat, boost::intrusive::slist_base_hook<> ) \
- TEST_FCSTACK( FCStack_slist_mutex_stat, boost::intrusive::slist_base_hook<> ) \
- TEST_FCSTACK( FCStack_slist_mutex_elimination, boost::intrusive::slist_base_hook<> ) \
- TEST_FCSTACK( FCStack_slist_mutex_elimination_stat, boost::intrusive::slist_base_hook<> ) \
- TEST_FCSTACK( FCStack_list, boost::intrusive::list_base_hook<> ) \
- TEST_FCSTACK( FCStack_list_stat, boost::intrusive::list_base_hook<> ) \
- TEST_FCSTACK( FCStack_list_elimination, boost::intrusive::list_base_hook<> ) \
- TEST_FCSTACK( FCStack_list_elimination_stat, boost::intrusive::list_base_hook<> ) \
- TEST_FCSTACK( FCStack_list_mutex_stat, boost::intrusive::list_base_hook<> ) \
- TEST_FCSTACK( FCStack_list_mutex_elimination, boost::intrusive::list_base_hook<> ) \
- TEST_FCSTACK( FCStack_list_mutex_elimination_stat, boost::intrusive::list_base_hook<> )
-
-#define CDSUNIT_TEST_FCStack \
- CPPUNIT_TEST( FCStack_slist ) \
- CPPUNIT_TEST( FCStack_slist_stat ) \
- CPPUNIT_TEST( FCStack_slist_elimination ) \
- CPPUNIT_TEST( FCStack_slist_elimination_stat ) \
- CPPUNIT_TEST( FCStack_slist_mutex_stat ) \
- CPPUNIT_TEST( FCStack_slist_mutex_elimination ) \
- CPPUNIT_TEST( FCStack_slist_mutex_elimination_stat ) \
- CPPUNIT_TEST( FCStack_list ) \
- CPPUNIT_TEST( FCStack_list_stat ) \
- CPPUNIT_TEST( FCStack_list_elimination ) \
- CPPUNIT_TEST( FCStack_list_elimination_stat ) \
- CPPUNIT_TEST( FCStack_list_mutex_stat ) \
- CPPUNIT_TEST( FCStack_list_mutex_elimination ) \
- CPPUNIT_TEST( FCStack_list_mutex_elimination_stat )
-
-
-#define CDSUNIT_DECLARE_StdStack \
- TEST_STDSTACK( StdStack_Deque_Mutex ) \
- TEST_STDSTACK( StdStack_Deque_Spin ) \
- TEST_STDSTACK( StdStack_Vector_Mutex ) \
- TEST_STDSTACK( StdStack_Vector_Spin ) \
- TEST_STDSTACK( StdStack_List_Mutex ) \
- TEST_STDSTACK( StdStack_List_Spin )
-
-#define CDSUNIT_TEST_StdStack \
- CPPUNIT_TEST( StdStack_Deque_Mutex ) \
- CPPUNIT_TEST( StdStack_Deque_Spin ) \
- CPPUNIT_TEST( StdStack_Vector_Mutex ) \
- CPPUNIT_TEST( StdStack_Vector_Spin ) \
- CPPUNIT_TEST( StdStack_List_Mutex ) \
- CPPUNIT_TEST( StdStack_List_Spin )
-
-#endif // #ifndef CDSUNIT_INTRUSIVE_STACK_DEFS_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_INTRUSIVE_STACK_TYPES_H
-#define CDSUNIT_INTRUSIVE_STACK_TYPES_H
-
-#include <cds/intrusive/treiber_stack.h>
-#include <cds/intrusive/fcstack.h>
-
-#include <cds/gc/hp.h>
-#include <cds/gc/dhp.h>
-
-#include <mutex>
-#include <cds/sync/spinlock.h>
-#include <stack>
-#include <list>
-#include <vector>
-#include <boost/intrusive/list.hpp>
-
-namespace istack {
-
- namespace details {
-
- template < typename T, typename Stack, typename Lock>
- class StdStack
- {
- Stack m_Impl;
- mutable Lock m_Lock;
- cds::intrusive::treiber_stack::empty_stat m_stat;
-
- typedef std::unique_lock<Lock> unique_lock;
-
- public:
- typedef T value_type;
-
- bool push( T& v )
- {
- unique_lock l( m_Lock );
- m_Impl.push( &v );
- return true;
- }
-
- T * pop()
- {
- unique_lock l( m_Lock );
- if ( !m_Impl.empty() ) {
- T * v = m_Impl.top();
- m_Impl.pop();
- return v;
- }
- return nullptr;
- }
-
- bool empty() const
- {
- unique_lock l( m_Lock );
- return m_Impl.empty();
- }
-
- cds::intrusive::treiber_stack::empty_stat const& statistics() const
- {
- return m_stat;
- }
- };
- }
-
- template <typename T>
- struct Types {
-
- template <class GC>
- using base_hook = cds::intrusive::treiber_stack::base_hook < cds::opt::gc< GC > >;
-
- // TreiberStack
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T > Treiber_HP;
- struct traits_Treiber_DHP: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<cds::gc::DHP> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_DHP >Treiber_DHP;
-
- template <class GC> struct traits_Treiber_seqcst : public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::memory_model<cds::opt::v::sequential_consistent>
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_seqcst<cds::gc::HP> > Treiber_HP_seqcst;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_seqcst<cds::gc::DHP> > Treiber_DHP_seqcst;
-
- template <class GC> struct traits_Treiber_stat: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_stat<cds::gc::HP> > Treiber_HP_stat;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_stat<cds::gc::DHP> > Treiber_DHP_stat;
-
- template <class GC> struct traits_Treiber_yield: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::back_off<cds::backoff::yield>
- , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_yield<cds::gc::HP> > Treiber_HP_yield;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_yield<cds::gc::DHP> > Treiber_DHP_yield;
-
- template <class GC> struct traits_Treiber_pause: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::back_off<cds::backoff::pause>
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_pause<cds::gc::HP> > Treiber_HP_pause;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_pause<cds::gc::DHP> > Treiber_DHP_pause;
-
- template <class GC> struct traits_Treiber_exp: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- ,cds::opt::back_off<
- cds::backoff::exponential<
- cds::backoff::pause,
- cds::backoff::yield
- >
- >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_exp<cds::gc::HP> > Treiber_HP_exp;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_exp<cds::gc::DHP> > Treiber_DHP_exp;
-
-
- // Elimination stack
- template <class GC> struct traits_Elimination_on : public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_on<cds::gc::HP> > Elimination_HP;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_on<cds::gc::DHP> > Elimination_DHP;
-
- template <class GC> struct traits_Elimination_seqcst : public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::memory_model< cds::opt::v::sequential_consistent >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_seqcst<cds::gc::HP> > Elimination_HP_seqcst;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_seqcst<cds::gc::DHP> > Elimination_DHP_seqcst;
-
- template <class GC> struct traits_Elimination_2ms: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<2> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_2ms<cds::gc::HP> > Elimination_HP_2ms;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms<cds::gc::DHP> > Elimination_DHP_2ms;
-
- template <class GC> struct traits_Elimination_2ms_stat: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<2> >
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_2ms_stat<cds::gc::HP> > Elimination_HP_2ms_stat;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms_stat<cds::gc::DHP> > Elimination_DHP_2ms_stat;
-
- template <class GC> struct traits_Elimination_5ms: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<5> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_5ms<cds::gc::HP> > Elimination_HP_5ms;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms<cds::gc::DHP> > Elimination_DHP_5ms;
-
- template <class GC> struct traits_Elimination_5ms_stat: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<5> >
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_5ms_stat<cds::gc::HP> > Elimination_HP_5ms_stat;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms_stat<cds::gc::DHP> > Elimination_DHP_5ms_stat;
-
- template <class GC> struct traits_Elimination_10ms: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<10> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_10ms<cds::gc::HP> > Elimination_HP_10ms;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms<cds::gc::DHP> > Elimination_DHP_10ms;
-
- template <class GC> struct traits_Elimination_10ms_stat: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<10> >
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_10ms_stat<cds::gc::HP> > Elimination_HP_10ms_stat;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms_stat<cds::gc::DHP> > Elimination_DHP_10ms_stat;
-
- template <class GC> struct traits_Elimination_dyn: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::buffer< cds::opt::v::dynamic_buffer<int> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_dyn<cds::gc::HP> > Elimination_HP_dyn;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn<cds::gc::DHP> > Elimination_DHP_dyn;
-
- template <class GC> struct traits_Elimination_stat: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_stat<cds::gc::HP> > Elimination_HP_stat;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_stat<cds::gc::DHP> > Elimination_DHP_stat;
-
- template <class GC> struct traits_Elimination_dyn_stat: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::buffer< cds::opt::v::dynamic_buffer<int> >
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_dyn_stat<cds::gc::HP> > Elimination_HP_dyn_stat;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn_stat<cds::gc::DHP> > Elimination_DHP_dyn_stat;
-
- template <class GC> struct traits_Elimination_yield: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::back_off<cds::backoff::yield>
- , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_yield<cds::gc::HP> > Elimination_HP_yield;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_yield<cds::gc::DHP> > Elimination_DHP_yield;
-
- template <class GC> struct traits_Elimination_pause: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- , cds::opt::back_off<cds::backoff::pause>
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_pause<cds::gc::HP> > Elimination_HP_pause;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_pause<cds::gc::DHP> > Elimination_DHP_pause;
-
- template <class GC> struct traits_Elimination_exp: public
- cds::intrusive::treiber_stack::make_traits <
- cds::intrusive::opt::hook< base_hook<GC> >
- , cds::opt::enable_elimination<true>
- ,cds::opt::back_off<
- cds::backoff::exponential<
- cds::backoff::pause,
- cds::backoff::yield
- >
- >
- > ::type
- {};
- typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_exp<cds::gc::HP> > Elimination_HP_exp;
- typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_exp<cds::gc::DHP> > Elimination_DHP_exp;
-
- // FCStack
- typedef cds::intrusive::FCStack< T > FCStack_slist;
-
- struct traits_FCStack_stat:
- public cds::intrusive::fcstack::make_traits<
- cds::opt::stat< cds::intrusive::fcstack::stat<> >
- >::type
- {};
- struct traits_FCStack_elimination:
- public cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- >::type
- {};
- struct traits_FCStack_elimination_stat:
- public cds::intrusive::fcstack::make_traits<
- cds::opt::stat< cds::intrusive::fcstack::stat<> >,
- cds::opt::enable_elimination< true >
- >::type
- {};
-
- struct traits_FCStack_mutex_stat:
- public cds::intrusive::fcstack::make_traits<
- cds::opt::stat< cds::intrusive::fcstack::stat<> >
- ,cds::opt::lock_type< std::mutex >
- >::type
- {};
- struct traits_FCStack_mutex_elimination:
- public cds::intrusive::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- ,cds::opt::lock_type< std::mutex >
- >::type
- {};
- struct traits_FCStack_mutex_elimination_stat:
- public cds::intrusive::fcstack::make_traits<
- cds::opt::stat< cds::intrusive::fcstack::stat<> >
- ,cds::opt::enable_elimination< true >
- ,cds::opt::lock_type< std::mutex >
- >::type
- {};
-
- typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_stat > FCStack_slist_stat;
- typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_elimination > FCStack_slist_elimination;
- typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_elimination_stat > FCStack_slist_elimination_stat;
- typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_mutex_stat > FCStack_slist_mutex_stat;
- typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_mutex_elimination > FCStack_slist_mutex_elimination;
- typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_mutex_elimination_stat > FCStack_slist_mutex_elimination_stat;
- typedef cds::intrusive::FCStack< T, boost::intrusive::list< T > > FCStack_list;
- typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_stat > FCStack_list_stat;
- typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_elimination > FCStack_list_elimination;
- typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_elimination_stat > FCStack_list_elimination_stat;
- typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_mutex_stat > FCStack_list_mutex_stat;
- typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_mutex_elimination > FCStack_list_mutex_elimination;
- typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_mutex_elimination_stat > FCStack_list_mutex_elimination_stat;
-
-
- // std::stack
- typedef details::StdStack< T, std::stack< T* >, std::mutex > StdStack_Deque_Mutex;
- typedef details::StdStack< T, std::stack< T* >, cds::sync::spin > StdStack_Deque_Spin;
- typedef details::StdStack< T, std::stack< T*, std::vector<T*> >, std::mutex > StdStack_Vector_Mutex;
- typedef details::StdStack< T, std::stack< T*, std::vector<T*> >, cds::sync::spin > StdStack_Vector_Spin;
- typedef details::StdStack< T, std::stack< T*, std::list<T*> >, std::mutex > StdStack_List_Mutex;
- typedef details::StdStack< T, std::stack< T*, std::list<T*> >, cds::sync::spin > StdStack_List_Spin;
-
- };
-} // namespace istack
-
-namespace std {
- static inline ostream& operator <<( ostream& o, cds::intrusive::treiber_stack::stat<> const& s )
- {
- return o << "\tStatistics:\n"
- << "\t Push: " << s.m_PushCount.get() << "\n"
- << "\t Pop: " << s.m_PopCount.get() << "\n"
- << "\t Push contention: " << s.m_PushRace.get() << "\n"
- << "\t Pop contention: " << s.m_PopRace.get() << "\n"
- << "\t m_ActivePushCollision: " << s.m_ActivePushCollision.get() << "\n"
- << "\t m_PassivePopCollision: " << s.m_PassivePopCollision.get() << "\n"
- << "\t m_ActivePopCollision: " << s.m_ActivePopCollision.get() << "\n"
- << "\t m_PassivePushCollision: " << s.m_PassivePushCollision.get() << "\n"
- << "\t m_EliminationFailed: " << s.m_EliminationFailed.get() << "\n";
- }
-
- static inline ostream& operator <<( ostream& o, cds::intrusive::treiber_stack::empty_stat const& /*s*/ )
- {
- return o;
- }
-
- static inline ostream& operator <<( ostream& o, cds::intrusive::fcstack::empty_stat const& /*s*/ )
- {
- return o;
- }
-
- static inline ostream& operator <<( ostream& o, cds::intrusive::fcstack::stat<> const& s )
- {
- return o << "\tStatistics:\n"
- << "\t Push: " << s.m_nPush.get() << "\n"
- << "\t Pop: " << s.m_nPop.get() << "\n"
- << "\t FailedPop: " << s.m_nFailedPop.get() << "\n"
- << "\t Collided push/pop pair: " << s.m_nCollided.get() << "\n"
- << "\tFlat combining statistics:\n"
- << "\t Combining factor: " << s.combining_factor() << "\n"
- << "\t Operation count: " << s.m_nOperationCount.get() << "\n"
- << "\t Combine call count: " << s.m_nCombiningCount.get() << "\n"
- << "\t Compact pub-list: " << s.m_nCompactPublicationList.get() << "\n"
- << "\t Deactivate pub-record: " << s.m_nDeactivatePubRecord.get() << "\n"
- << "\t Activate pub-record: " << s.m_nActivatePubRecord.get() << "\n"
- << "\t Create pub-record: " << s.m_nPubRecordCreated.get() << "\n"
- << "\t Delete pub-record: " << s.m_nPubRecordDeteted.get() << "\n"
- << "\t Acquire pub-record: " << s.m_nAcquirePubRecCount.get()<< "\n"
- << "\t Release pub-record: " << s.m_nReleasePubRecCount.get()<< "\n";
- }
-
-} // namespace std
-
-#endif // #ifndef CDSUNIT_INTRUSIVE_STACK_TYPES_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_DEFS_H
-#define CDSUNIT_STACK_DEFS_H
-
-#define CDSUNIT_DECLARE_TreiberStack \
- TEST_CASE( Treiber_HP ) \
- TEST_CASE( Treiber_HP_seqcst ) \
- /*TEST_CASE( Treiber_HP_yield )*/ \
- TEST_CASE( Treiber_HP_pause ) \
- TEST_CASE( Treiber_HP_exp ) \
- TEST_CASE( Treiber_HP_stat ) \
- TEST_CASE( Treiber_DHP ) \
- /*TEST_CASE( Treiber_DHP_yield )*/ \
- TEST_CASE( Treiber_DHP_pause ) \
- TEST_CASE( Treiber_DHP_exp ) \
- TEST_CASE( Treiber_DHP_stat )
-
-#define CDSUNIT_TEST_TreiberStack \
- CPPUNIT_TEST( Treiber_HP ) \
- CPPUNIT_TEST( Treiber_HP_seqcst ) \
- /*CPPUNIT_TEST( Treiber_HP_yield )*/ \
- CPPUNIT_TEST( Treiber_HP_pause ) \
- CPPUNIT_TEST( Treiber_HP_exp ) \
- CPPUNIT_TEST( Treiber_HP_stat ) \
- CPPUNIT_TEST( Treiber_DHP ) \
- /*CPPUNIT_TEST( Treiber_DHP_yield )*/ \
- CPPUNIT_TEST( Treiber_DHP_pause ) \
- CPPUNIT_TEST( Treiber_DHP_exp ) \
- CPPUNIT_TEST( Treiber_DHP_stat )
-
-#define CDSUNIT_DECLARE_EliminationStack \
- TEST_ELIMINATION( Elimination_HP ) \
- TEST_ELIMINATION( Elimination_HP_2ms ) \
- TEST_ELIMINATION( Elimination_HP_2ms_stat) \
- TEST_ELIMINATION( Elimination_HP_5ms ) \
- TEST_ELIMINATION( Elimination_HP_5ms_stat) \
- TEST_ELIMINATION( Elimination_HP_10ms ) \
- TEST_ELIMINATION( Elimination_HP_10ms_stat) \
- TEST_ELIMINATION( Elimination_HP_seqcst ) \
- /*TEST_ELIMINATION( Elimination_HP_yield )*/ \
- TEST_ELIMINATION( Elimination_HP_pause ) \
- TEST_ELIMINATION( Elimination_HP_exp ) \
- TEST_ELIMINATION( Elimination_HP_stat ) \
- TEST_ELIMINATION( Elimination_HP_dyn ) \
- TEST_ELIMINATION( Elimination_HP_dyn_stat) \
- TEST_ELIMINATION( Elimination_DHP ) \
- TEST_ELIMINATION( Elimination_DHP_2ms ) \
- TEST_ELIMINATION( Elimination_DHP_2ms_stat) \
- TEST_ELIMINATION( Elimination_DHP_5ms ) \
- TEST_ELIMINATION( Elimination_DHP_5ms_stat) \
- TEST_ELIMINATION( Elimination_DHP_10ms ) \
- TEST_ELIMINATION( Elimination_DHP_10ms_stat) \
- /*TEST_ELIMINATION( Elimination_DHP_yield )*/ \
- TEST_ELIMINATION( Elimination_DHP_pause ) \
- TEST_ELIMINATION( Elimination_DHP_exp ) \
- TEST_ELIMINATION( Elimination_DHP_stat ) \
- TEST_ELIMINATION( Elimination_DHP_dyn ) \
- TEST_ELIMINATION( Elimination_DHP_dyn_stat)
-
-#define CDSUNIT_TEST_EliminationStack \
- CPPUNIT_TEST( Elimination_HP ) \
- CPPUNIT_TEST( Elimination_HP_2ms ) \
- CPPUNIT_TEST( Elimination_HP_2ms_stat) \
- CPPUNIT_TEST( Elimination_HP_5ms ) \
- CPPUNIT_TEST( Elimination_HP_5ms_stat) \
- CPPUNIT_TEST( Elimination_HP_10ms ) \
- CPPUNIT_TEST( Elimination_HP_10ms_stat) \
- CPPUNIT_TEST( Elimination_HP_seqcst ) \
- /*CPPUNIT_TEST( Elimination_HP_yield )*/ \
- CPPUNIT_TEST( Elimination_HP_pause ) \
- CPPUNIT_TEST( Elimination_HP_exp ) \
- CPPUNIT_TEST( Elimination_HP_stat ) \
- CPPUNIT_TEST( Elimination_HP_dyn ) \
- CPPUNIT_TEST( Elimination_HP_dyn_stat) \
- CPPUNIT_TEST( Elimination_DHP ) \
- CPPUNIT_TEST( Elimination_DHP_2ms ) \
- CPPUNIT_TEST( Elimination_DHP_2ms_stat) \
- CPPUNIT_TEST( Elimination_DHP_5ms ) \
- CPPUNIT_TEST( Elimination_DHP_5ms_stat) \
- CPPUNIT_TEST( Elimination_DHP_10ms ) \
- CPPUNIT_TEST( Elimination_DHP_10ms_stat) \
- /*CPPUNIT_TEST( Elimination_DHP_yield )*/ \
- CPPUNIT_TEST( Elimination_DHP_pause ) \
- CPPUNIT_TEST( Elimination_DHP_exp ) \
- CPPUNIT_TEST( Elimination_DHP_stat ) \
- CPPUNIT_TEST( Elimination_DHP_dyn ) \
- CPPUNIT_TEST( Elimination_DHP_dyn_stat)
-
-
-#define CDSUNIT_DECLARE_FCStack \
- TEST_CASE( FCStack_deque ) \
- TEST_CASE( FCStack_deque_mutex ) \
- TEST_CASE( FCStack_deque_stat ) \
- TEST_CASE( FCStack_deque_elimination ) \
- TEST_CASE( FCStack_deque_elimination_stat ) \
- TEST_CASE( FCStack_vector ) \
- TEST_CASE( FCStack_vector_mutex ) \
- TEST_CASE( FCStack_vector_stat ) \
- TEST_CASE( FCStack_vector_elimination ) \
- TEST_CASE( FCStack_vector_elimination_stat ) \
- TEST_CASE( FCStack_list ) \
- TEST_CASE( FCStack_list_mutex ) \
- TEST_CASE( FCStack_list_stat ) \
- TEST_CASE( FCStack_list_elimination ) \
- TEST_CASE( FCStack_list_elimination_stat )
-
-#define CDSUNIT_TEST_FCStack \
- CPPUNIT_TEST( FCStack_deque ) \
- CPPUNIT_TEST( FCStack_deque_mutex ) \
- CPPUNIT_TEST( FCStack_deque_stat ) \
- CPPUNIT_TEST( FCStack_deque_elimination ) \
- CPPUNIT_TEST( FCStack_deque_elimination_stat ) \
- CPPUNIT_TEST( FCStack_vector ) \
- CPPUNIT_TEST( FCStack_vector_mutex ) \
- CPPUNIT_TEST( FCStack_vector_stat ) \
- CPPUNIT_TEST( FCStack_vector_elimination ) \
- CPPUNIT_TEST( FCStack_vector_elimination_stat ) \
- CPPUNIT_TEST( FCStack_list ) \
- CPPUNIT_TEST( FCStack_list_mutex ) \
- CPPUNIT_TEST( FCStack_list_stat ) \
- CPPUNIT_TEST( FCStack_list_elimination ) \
- CPPUNIT_TEST( FCStack_list_elimination_stat )
-
-
-#define CDSUNIT_DECLARE_FCDeque \
- TEST_CASE( FCDequeL_default ) \
- TEST_CASE( FCDequeL_mutex ) \
- TEST_CASE( FCDequeL_stat ) \
- TEST_CASE( FCDequeL_elimination ) \
- TEST_CASE( FCDequeL_elimination_stat ) \
- TEST_CASE( FCDequeR_default ) \
- TEST_CASE( FCDequeR_mutex ) \
- TEST_CASE( FCDequeR_stat ) \
- TEST_CASE( FCDequeR_elimination ) \
- TEST_CASE( FCDequeR_elimination_stat )
-
-#define CDSUNIT_TEST_FCDeque \
- CPPUNIT_TEST( FCDequeL_default ) \
- CPPUNIT_TEST( FCDequeL_mutex ) \
- CPPUNIT_TEST( FCDequeL_stat ) \
- CPPUNIT_TEST( FCDequeL_elimination ) \
- CPPUNIT_TEST( FCDequeL_elimination_stat ) \
- CPPUNIT_TEST( FCDequeR_default ) \
- CPPUNIT_TEST( FCDequeR_mutex ) \
- CPPUNIT_TEST( FCDequeR_stat ) \
- CPPUNIT_TEST( FCDequeR_elimination ) \
- CPPUNIT_TEST( FCDequeR_elimination_stat )
-
-
-#define CDSUNIT_DECLARE_StdStack \
- TEST_CASE( StdStack_Deque_Mutex ) \
- TEST_CASE( StdStack_Deque_Spin ) \
- TEST_CASE( StdStack_Vector_Mutex ) \
- TEST_CASE( StdStack_Vector_Spin ) \
- TEST_CASE( StdStack_List_Mutex ) \
- TEST_CASE( StdStack_List_Spin )
-
-#define CDSUNIT_TEST_StdStack \
- CPPUNIT_TEST( StdStack_Deque_Mutex ) \
- CPPUNIT_TEST( StdStack_Deque_Spin ) \
- CPPUNIT_TEST( StdStack_Vector_Mutex ) \
- CPPUNIT_TEST( StdStack_Vector_Spin ) \
- CPPUNIT_TEST( StdStack_List_Mutex ) \
- CPPUNIT_TEST( StdStack_List_Spin )
-
-#endif // #ifndef CDSUNIT_STACK_DEFS_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 "cppunit/thread.h"
-#include "stack/intrusive_stack_type.h"
-
-// Multi-threaded stack test for push/pop operation
-namespace istack {
-
-#define TEST_CASE( Q, HOOK ) void Q() { test_unbounded< Types<SimpleValue<HOOK> >::Q >(); }
-#define TEST_ELIMINATION( Q, HOOK ) void Q() { test_elimination< Types<SimpleValue<HOOK> >::Q >(); }
-#define TEST_BOUNDED( Q, HOOK ) void Q() { test_bounded< Types<SimpleValue<HOOK> >::Q >(); }
-#define TEST_FCSTACK( Q, HOOK ) void Q() { test_fcstack< Types<SimpleValue<HOOK> >::Q >(); }
-#define TEST_STDSTACK( Q ) void Q() { test_stdstack< Types<SimpleValue<> >::Q >(); }
-
- namespace {
- static size_t s_nPushThreadCount = 4;
- static size_t s_nPopThreadCount = 4;
- static size_t s_nStackSize = 10000000;
- static size_t s_nEliminationSize = 4;
- static bool s_bFCIterative = false;
- static unsigned int s_nFCCombinePassCount = 64;
- static unsigned int s_nFCCompactFactor = 1024;
-
- struct empty {};
-
- template <typename Base = empty >
- struct SimpleValue: public Base
- {
- atomics::atomic<size_t> nNo;
- size_t nProducer;
- size_t nConsumer;
-
- SimpleValue() {}
- SimpleValue( size_t n ): nNo(n) {}
- };
-
- } // namespace
-
- class IntrusiveStack_PushPop: public CppUnitMini::TestCase
- {
- atomics::atomic<size_t> m_nWorkingProducers;
- static CDS_CONSTEXPR const size_t c_nValArraySize = 1024;
- static CDS_CONSTEXPR const size_t c_nBadConsumer = 0xbadc0ffe;
-
- template <class Stack>
- class Producer: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Producer( *this );
- }
- public:
- Stack& m_Stack;
- size_t m_nPushError;
- size_t m_arrPush[c_nValArraySize];
-
- // Interval in m_arrValue
- typename Stack::value_type * m_pStart;
- typename Stack::value_type * m_pEnd;
-
- public:
- Producer( CppUnitMini::ThreadPool& pool, Stack& s )
- : CppUnitMini::TestThread( pool )
- , m_Stack( s )
- {}
- Producer( Producer& src )
- : CppUnitMini::TestThread( src )
- , m_Stack( src.m_Stack )
- {}
-
- IntrusiveStack_PushPop& getTest()
- {
- return static_cast<IntrusiveStack_PushPop&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPushError = 0;
- memset( m_arrPush, 0, sizeof(m_arrPush));
-
- size_t i = 0;
- for ( typename Stack::value_type * p = m_pStart; p < m_pEnd; ++p, ++i ) {
- p->nProducer = m_nThreadNo;
- size_t no;
- p->nNo.store( no = i % c_nValArraySize, atomics::memory_order_release );
- if ( m_Stack.push( *p ))
- ++m_arrPush[ no ];
- else
- ++m_nPushError;
- }
-
- getTest().m_nWorkingProducers.fetch_sub( 1, atomics::memory_order_release );
- }
- };
-
- template <class Stack>
- class Consumer: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Consumer( *this );
- }
- public:
- Stack& m_Stack;
- size_t m_nPopCount;
- size_t m_nPopEmpty;
- size_t m_arrPop[c_nValArraySize];
- size_t m_nDirtyPop;
- public:
- Consumer( CppUnitMini::ThreadPool& pool, Stack& s )
- : CppUnitMini::TestThread( pool )
- , m_Stack( s )
- {}
- Consumer( Consumer& src )
- : CppUnitMini::TestThread( src )
- , m_Stack( src.m_Stack )
- {}
-
- IntrusiveStack_PushPop& getTest()
- {
- return static_cast<IntrusiveStack_PushPop&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPopEmpty = 0;
- m_nPopCount = 0;
- m_nDirtyPop = 0;
- memset( m_arrPop, 0, sizeof(m_arrPop));
-
- while ( !(getTest().m_nWorkingProducers.load(atomics::memory_order_acquire) == 0 && m_Stack.empty()) ) {
- typename Stack::value_type * p = m_Stack.pop();
- if ( p ) {
- p->nConsumer = m_nThreadNo;
- ++m_nPopCount;
- size_t no = p->nNo.load( atomics::memory_order_acquire );
- if ( no < sizeof(m_arrPop)/sizeof(m_arrPop[0]) )
- ++m_arrPop[no];
- else
- ++m_nDirtyPop;
- }
- else
- ++m_nPopEmpty;
- }
- }
- };
-
- template <typename T>
- class value_array
- {
- T * m_pArr;
- public:
- value_array( size_t nSize )
- : m_pArr( new T[nSize] )
- {}
-
- ~value_array()
- {
- delete [] m_pArr;
- }
-
- T * get() const { return m_pArr; }
- };
-
- protected:
- void setUpParams( const CppUnitMini::TestCfg& cfg ) {
- s_nPushThreadCount = cfg.getULong("PushThreadCount", 4 );
- s_nPopThreadCount = cfg.getULong("PopThreadCount", 4 );
- s_nStackSize = cfg.getULong("StackSize", 1000000 );
- s_nEliminationSize = cfg.getULong("EliminationSize", 4 );
- s_bFCIterative = cfg.getBool( "FCIterate", false );
- s_nFCCombinePassCount = cfg.getUInt( "FCCombinePassCount", 64 );
- s_nFCCompactFactor = cfg.getUInt( "FCCompactFactor", 1024 );
- }
-
- template <class Stack>
- void analyze( CppUnitMini::ThreadPool& pool, Stack& /*testStack*/ )
- {
- size_t nPushError = 0;
- size_t nPopEmpty = 0;
- size_t nPopCount = 0;
- size_t arrVal[c_nValArraySize];
- memset( arrVal, 0, sizeof(arrVal));
- size_t nDirtyPop = 0;
-
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- CppUnitMini::TestThread * pThread = *it;
- Producer<Stack> * pPusher = dynamic_cast< Producer<Stack> *>( pThread );
- if ( pPusher ) {
- nPushError += pPusher->m_nPushError;
- for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i )
- arrVal[i] += pPusher->m_arrPush[i];
- }
- else {
- Consumer<Stack> * pPopper = dynamic_cast<Consumer<Stack> *>( pThread );
- assert( pPopper );
- nPopEmpty += pPopper->m_nPopEmpty;
- nPopCount += pPopper->m_nPopCount;
- nDirtyPop += pPopper->m_nDirtyPop;
- for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i )
- arrVal[i] -= pPopper->m_arrPop[i];
- }
- }
-
- CPPUNIT_MSG( "Push count=" << s_nStackSize
- << " push error=" << nPushError
- << " pop count=" << nPopCount
- << " pop empty=" << nPopEmpty
- << " dirty pop=" << nDirtyPop
- );
- CPPUNIT_CHECK( nPopCount == s_nStackSize );
- CPPUNIT_CHECK( nDirtyPop == 0 );
- for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i ) {
- CPPUNIT_CHECK_EX( arrVal[i] == 0, "arrVal[" << i << "]=" << long(arrVal[i]) );
- }
- }
-
- template <class Stack>
- void test( Stack& testStack, value_array<typename Stack::value_type>& arrValue )
- {
- m_nWorkingProducers.store( s_nPushThreadCount, atomics::memory_order_release );
- size_t const nPushCount = s_nStackSize / s_nPushThreadCount;
-
- typename Stack::value_type * pValStart = arrValue.get();
- typename Stack::value_type * pValEnd = pValStart + s_nStackSize;
-
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new Producer<Stack>( pool, testStack ), s_nPushThreadCount );
- {
- for ( typename Stack::value_type * it = pValStart; it != pValEnd; ++it )
- it->nConsumer = c_nBadConsumer;
-
- typename Stack::value_type * pStart = pValStart;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- static_cast<Producer<Stack>* >( *it )->m_pStart = pStart;
- pStart += nPushCount;
- static_cast<Producer<Stack>* >( *it )->m_pEnd = pStart;
- }
- }
- pool.add( new Consumer<Stack>( pool, testStack ), s_nPopThreadCount );
-
- CPPUNIT_MSG( " Push/Pop test, push thread count=" << s_nPushThreadCount
- << " pop thread count=" << s_nPopThreadCount
- << " items=" << (nPushCount * s_nPushThreadCount)
- << "...");
- pool.run();
- CPPUNIT_MSG( " Duration=" << pool.avgDuration() );
-
- s_nStackSize = nPushCount * s_nPushThreadCount;
-
- {
- typename Stack::value_type * pEnd = pValStart + s_nStackSize;
- for ( typename Stack::value_type * it = pValStart; it != pEnd; ++it )
- CPPUNIT_CHECK( it->nConsumer != c_nBadConsumer );
- }
-
- analyze( pool, testStack );
- CPPUNIT_MSG( testStack.statistics() );
- }
-
- public:
- // Unbounded stack test
- template <class Stack>
- void test_unbounded()
- {
- value_array<typename Stack::value_type> arrValue( s_nStackSize );
- {
- Stack testStack;
- test( testStack, arrValue );
- }
- Stack::gc::force_dispose();
- }
-
- template <class Stack>
- void test_fcstack()
- {
- if ( s_bFCIterative ) {
- for (unsigned int nCompactFactor = 1; nCompactFactor <= s_nFCCompactFactor; nCompactFactor *= 2 ) {
- for ( unsigned int nPass = 1; nPass <= s_nFCCombinePassCount; nPass *= 2 ) {
- CPPUNIT_MSG( "Compact factor=" << nCompactFactor << ", combine pass count=" << nPass );
- value_array<typename Stack::value_type> arrValue( s_nStackSize );
- Stack testStack( nCompactFactor, nPass );
- test( testStack, arrValue );
- }
- }
- }
- else {
- if ( s_nFCCompactFactor && s_nFCCombinePassCount ) {
- CPPUNIT_MSG( "Compact factor=" << s_nFCCompactFactor << ", combine pass count=" << s_nFCCombinePassCount );
- value_array<typename Stack::value_type> arrValue( s_nStackSize );
- Stack testStack( s_nFCCompactFactor, s_nFCCombinePassCount );
- test( testStack, arrValue );
- }
- else {
- value_array<typename Stack::value_type> arrValue( s_nStackSize );
- Stack testStack;
- test( testStack, arrValue );
- }
- }
- }
-
- // Unbounded elimination stack test
- template <class Stack>
- void test_elimination()
- {
- value_array<typename Stack::value_type> arrValue( s_nStackSize );
- {
- Stack testStack( s_nEliminationSize );
- test( testStack, arrValue );
- check_elimination_stat( testStack.statistics() );
- }
- Stack::gc::force_dispose();
- }
- void check_elimination_stat( cds::intrusive::treiber_stack::empty_stat const& )
- {}
- void check_elimination_stat( cds::intrusive::treiber_stack::stat<> const& s )
- {
- CPPUNIT_CHECK( s.m_PushCount.get() + s.m_ActivePushCollision.get() + s.m_PassivePushCollision.get() == s_nStackSize );
- CPPUNIT_CHECK( s.m_PopCount.get() + s.m_ActivePopCollision.get() + s.m_PassivePopCollision.get() == s_nStackSize );
- CPPUNIT_CHECK( s.m_PushCount.get() == s.m_PopCount.get() );
- CPPUNIT_CHECK( s.m_ActivePopCollision.get() == s.m_PassivePushCollision.get() );
- CPPUNIT_CHECK( s.m_ActivePushCollision.get() == s.m_PassivePopCollision.get() );
- }
-
- // Bounded stack test
- template <class Stack>
- void test_bounded()
- {
- value_array<typename Stack::value_type> arrValue( s_nStackSize );
- Stack testStack( s_nStackSize );
- test( testStack, arrValue );
- }
-
- template <class Stack>
- void test_stdstack()
- {
- value_array<typename Stack::value_type> arrValue( s_nStackSize );
- Stack testStack;
- test( testStack, arrValue );
- }
-
- protected:
-# include "stack/intrusive_stack_defs.h"
- CDSUNIT_DECLARE_TreiberStack
- CDSUNIT_DECLARE_EliminationStack
- CDSUNIT_DECLARE_FCStack
- CDSUNIT_DECLARE_StdStack
-
- CPPUNIT_TEST_SUITE(IntrusiveStack_PushPop)
- CDSUNIT_TEST_TreiberStack
- CDSUNIT_TEST_EliminationStack
- CDSUNIT_TEST_FCStack
- CDSUNIT_TEST_StdStack
- CPPUNIT_TEST_SUITE_END();
- };
-} // namespace istack
-
-CPPUNIT_TEST_SUITE_REGISTRATION(istack::IntrusiveStack_PushPop);
+++ /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/thread.h"
-#include "stack/stack_type.h"
-
-// Multi-threaded stack test for push operation
-namespace stack {
-
-#define TEST_CASE( Q ) void Q() { test_unbounded< Types<SimpleValue>::Q >(); }
-#define TEST_ELIMINATION( Q ) void Q() { test_elimination< Types<SimpleValue>::Q >(); }
-#define TEST_BOUNDED( Q ) void Q() { test_bounded< Types<SimpleValue>::Q >(); }
-
- namespace {
- static size_t s_nThreadCount = 8;
- static size_t s_nStackSize = 10000000;
- static size_t s_nEliminationSize = 4;
-
- struct SimpleValue {
- size_t nNo;
- size_t nThread;
-
- SimpleValue(): nNo(0), nThread(0) {}
- SimpleValue( size_t n ): nNo(n), nThread(0) {}
- size_t getNo() const { return nNo; }
- };
- }
-
- class Stack_Push: public CppUnitMini::TestCase
- {
- template <class Stack>
- class Thread: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Thread( *this );
- }
- public:
- Stack& m_Stack;
- double m_fTime;
- size_t m_nStartItem;
- size_t m_nEndItem;
- size_t m_nPushError;
-
- public:
- Thread( CppUnitMini::ThreadPool& pool, Stack& s )
- : CppUnitMini::TestThread( pool )
- , m_Stack( s )
- {}
- Thread( Thread& src )
- : CppUnitMini::TestThread( src )
- , m_Stack( src.m_Stack )
- {}
-
- Stack_Push& getTest()
- {
- return reinterpret_cast<Stack_Push&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_fTime = m_Timer.duration();
-
- m_nPushError = 0;
- SimpleValue v;
- v.nThread = m_nThreadNo;
- for ( v.nNo = m_nStartItem; v.nNo < m_nEndItem; ++v.nNo ) {
- if ( !m_Stack.push( v ))
- ++m_nPushError;
- }
-
- m_fTime = m_Timer.duration() - m_fTime;
- }
- };
-
- protected:
- void setUpParams( const CppUnitMini::TestCfg& cfg ) {
- s_nThreadCount = cfg.getULong("ThreadCount", 8 );
- s_nStackSize = cfg.getULong("StackSize", 10000000 );
- s_nEliminationSize = cfg.getULong("EliminationSize", 4 );
- }
-
- template <class Stack>
- void analyze( CppUnitMini::ThreadPool& pool, Stack& testStack )
- {
- size_t nThreadItems = s_nStackSize / s_nThreadCount;
- std::vector<size_t> aThread;
- aThread.resize(s_nThreadCount);
-
- double fTime = 0;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Thread<Stack> * pThread = reinterpret_cast<Thread<Stack> *>(*it);
- fTime += pThread->m_fTime;
- if ( pThread->m_nPushError != 0 )
- CPPUNIT_MSG(" ERROR: thread push error count=" << pThread->m_nPushError );
- aThread[ pThread->m_nThreadNo] = pThread->m_nEndItem - 1;
- }
- CPPUNIT_MSG( " Duration=" << (fTime / s_nThreadCount) );
- CPPUNIT_ASSERT( !testStack.empty() )
-
- size_t * arr = new size_t[ s_nStackSize ];
- memset(arr, 0, sizeof(arr[0]) * s_nStackSize );
-
- cds::OS::Timer timer;
- CPPUNIT_MSG( " Pop (single-threaded)..." );
- size_t nPopped = 0;
- SimpleValue val;
- while ( testStack.pop( val )) {
- nPopped++;
- ++arr[ val.getNo() ];
- CPPUNIT_ASSERT( val.nThread < s_nThreadCount);
- CPPUNIT_ASSERT( aThread[val.nThread] == val.nNo );
- aThread[val.nThread]--;
- }
- CPPUNIT_MSG( " Duration=" << timer.duration() );
-
- size_t nTotalItems = nThreadItems * s_nThreadCount;
- size_t nError = 0;
- for ( size_t i = 0; i < nTotalItems; ++i ) {
- if ( arr[i] != 1 ) {
- CPPUNIT_MSG( " ERROR: Item " << i << " has not been pushed" );
- CPPUNIT_ASSERT( ++nError > 10 );
- }
- }
-
- delete [] arr;
- }
-
- // Unbounded stack test
- template <class Stack>
- void test_unbounded()
- {
- Stack testStack;
- test( testStack );
- }
-
- // Unbounded elimination stack test
- template <class Stack>
- void test_elimination()
- {
- Stack testStack( s_nEliminationSize );
- test( testStack );
- check_elimination_stat( testStack.statistics() );
- }
- void check_elimination_stat( cds::container::treiber_stack::empty_stat const& )
- {}
- void check_elimination_stat( cds::container::treiber_stack::stat<> const& s )
- {
- CPPUNIT_CHECK( s.m_PushCount.get() == s.m_PopCount.get() );
- }
-
- // Bounded stack test
- template <class Stack>
- void test_bounded()
- {
- Stack testStack( s_nStackSize );
- test( testStack );
- }
-
- template <class Stack>
- void test( Stack& testStack )
- {
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new Thread<Stack>( pool, testStack ), s_nThreadCount );
-
- size_t nStart = 0;
- size_t nThreadItemCount = s_nStackSize / s_nThreadCount;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Thread<Stack> * pThread = reinterpret_cast<Thread<Stack> *>(*it);
- pThread->m_nStartItem = nStart;
- nStart += nThreadItemCount;
- pThread->m_nEndItem = nStart;
- }
-
- CPPUNIT_MSG( " Push test, thread count=" << s_nThreadCount
- << " items=" << (nThreadItemCount * s_nThreadCount)
- << "...");
- pool.run();
-
- analyze( pool, testStack );
- CPPUNIT_MSG( testStack.statistics() );
- }
-
- protected:
-# include "stack/stack_defs.h"
- CDSUNIT_DECLARE_TreiberStack
- CDSUNIT_DECLARE_EliminationStack
- CDSUNIT_DECLARE_FCStack
- CDSUNIT_DECLARE_FCDeque
- CDSUNIT_DECLARE_StdStack
-
- CPPUNIT_TEST_SUITE(Stack_Push)
- CDSUNIT_TEST_TreiberStack
- CDSUNIT_TEST_EliminationStack
- CDSUNIT_TEST_FCStack
- CDSUNIT_TEST_FCDeque
- CDSUNIT_TEST_StdStack
- CPPUNIT_TEST_SUITE_END();
- };
-} // namespace stack
-
-CPPUNIT_TEST_SUITE_REGISTRATION(stack::Stack_Push);
+++ /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/thread.h"
-#include "stack/stack_type.h"
-
-// Multi-threaded stack test for push/pop operation
-namespace stack {
-
-#define TEST_CASE( Q ) void Q() { test_unbounded< Types<SimpleValue>::Q >(); }
-#define TEST_ELIMINATION( Q ) void Q() { test_elimination< Types<SimpleValue>::Q >(); }
-#define TEST_BOUNDED( Q ) void Q() { test_bounded< Types<SimpleValue>::Q >(); }
-
- namespace {
- static size_t s_nPushThreadCount = 4;
- static size_t s_nPopThreadCount = 4;
- static size_t s_nStackSize = 1000000;
- static size_t s_nEliminationSize = 4;
-
- struct SimpleValue {
- size_t nNo;
- size_t nThread;
-
- SimpleValue(): nNo(0), nThread(0) {}
- SimpleValue( size_t n ): nNo(n), nThread(0) {}
- size_t getNo() const { return nNo; }
- };
- }
-
- class Stack_PushPop: public CppUnitMini::TestCase
- {
- atomics::atomic<size_t> m_nWorkingProducers;
- static size_t const c_nValArraySize = 1024;
-
- template <class Stack>
- class Pusher: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Pusher( *this );
- }
- public:
- Stack& m_Stack;
- size_t m_nItemCount;
- size_t m_nPushError;
- size_t m_arrPush[c_nValArraySize];
-
- public:
- Pusher( CppUnitMini::ThreadPool& pool, Stack& s )
- : CppUnitMini::TestThread( pool )
- , m_Stack( s )
- {}
- Pusher( Pusher& src )
- : CppUnitMini::TestThread( src )
- , m_Stack( src.m_Stack )
- {}
-
- Stack_PushPop& getTest()
- {
- return reinterpret_cast<Stack_PushPop&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPushError = 0;
- memset( m_arrPush, 0, sizeof(m_arrPush));
-
- SimpleValue v;
- v.nThread = m_nThreadNo;
- for ( size_t i = 0; i < m_nItemCount; ++i ) {
- v.nNo = i % c_nValArraySize;
- if ( m_Stack.push( v ))
- ++m_arrPush[v.nNo];
- else
- ++m_nPushError;
- }
-
-
- getTest().m_nWorkingProducers.fetch_sub(1, atomics::memory_order_release);
- }
- };
-
- template <class Stack>
- class Popper: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Popper( *this );
- }
- public:
- Stack& m_Stack;
- size_t m_nPopCount;
- size_t m_nPopEmpty;
- size_t m_arrPop[c_nValArraySize];
- size_t m_nDirtyPop;
- public:
- Popper( CppUnitMini::ThreadPool& pool, Stack& s )
- : CppUnitMini::TestThread( pool )
- , m_Stack( s )
- {}
- Popper( Popper& src )
- : CppUnitMini::TestThread( src )
- , m_Stack( src.m_Stack )
- {}
-
- Stack_PushPop& getTest()
- {
- return reinterpret_cast<Stack_PushPop&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPopEmpty = 0;
- m_nPopCount = 0;
- m_nDirtyPop = 0;
- memset( m_arrPop, 0, sizeof(m_arrPop));
-
- SimpleValue v;
- while ( !(getTest().m_nWorkingProducers.load(atomics::memory_order_acquire) == 0 && m_Stack.empty()) ) {
- if ( m_Stack.pop( v )) {
- ++m_nPopCount;
- if ( v.nNo < sizeof(m_arrPop)/sizeof(m_arrPop[0]) )
- ++m_arrPop[v.nNo];
- else
- ++m_nDirtyPop;
- }
- else
- ++m_nPopEmpty;
- }
- }
- };
-
- protected:
- void setUpParams( const CppUnitMini::TestCfg& cfg ) {
- s_nPushThreadCount = cfg.getULong("PushThreadCount", 4 );
- s_nPopThreadCount = cfg.getULong("PopThreadCount", 4 );
- s_nStackSize = cfg.getULong("StackSize", 1000000 );
- s_nEliminationSize = cfg.getULong("EliminationSize", 4 );
- }
-
- template <class Stack>
- void analyze( CppUnitMini::ThreadPool& pool, Stack& /*testStack*/ )
- {
- size_t nPushError = 0;
- size_t nPopEmpty = 0;
- size_t nPopCount = 0;
- size_t arrVal[c_nValArraySize];
- memset( arrVal, 0, sizeof(arrVal));
- size_t nDirtyPop = 0;
-
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- CppUnitMini::TestThread * pThread = *it;
- Pusher<Stack> * pPusher = dynamic_cast< Pusher<Stack> *>( pThread );
- if ( pPusher ) {
- nPushError += pPusher->m_nPushError;
- for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i )
- arrVal[i] += pPusher->m_arrPush[i];
- }
- else {
- Popper<Stack> * pPopper = dynamic_cast<Popper<Stack> *>( pThread );
- assert( pPopper );
- nPopEmpty += pPopper->m_nPopEmpty;
- nPopCount += pPopper->m_nPopCount;
- nDirtyPop += pPopper->m_nDirtyPop;
- for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i )
- arrVal[i] -= pPopper->m_arrPop[i];
- }
- }
-
- CPPUNIT_MSG( "Push count=" << s_nStackSize
- << " push error=" << nPushError
- << " pop count=" << nPopCount
- << " pop empty=" << nPopEmpty
- << " dirty pop=" << nDirtyPop
- );
- CPPUNIT_CHECK( nPopCount == s_nStackSize );
- CPPUNIT_CHECK( nDirtyPop == 0 );
- for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i ) {
- CPPUNIT_CHECK_EX( arrVal[i] == 0, "arrVal[" << i << "]=" << long(arrVal[i]) );
- }
- }
-
- // Unbounded stack test
- template <class Stack>
- void test_unbounded()
- {
- Stack testStack;
- test( testStack );
- }
-
- // Unbounded elimination stack test
- template <class Stack>
- void test_elimination()
- {
- Stack testStack( s_nEliminationSize );
- test( testStack );
- check_elimination_stat( testStack.statistics() );
- }
- void check_elimination_stat( cds::container::treiber_stack::empty_stat const& )
- {}
- void check_elimination_stat( cds::container::treiber_stack::stat<> const& s )
- {
- CPPUNIT_CHECK( s.m_PushCount.get() + s.m_ActivePushCollision.get() + s.m_PassivePushCollision.get() == s_nStackSize );
- CPPUNIT_CHECK( s.m_PopCount.get() + s.m_ActivePopCollision.get() + s.m_PassivePopCollision.get() == s_nStackSize );
- CPPUNIT_CHECK( s.m_PushCount.get() == s.m_PopCount.get() );
- CPPUNIT_CHECK( s.m_ActivePopCollision.get() == s.m_PassivePushCollision.get() );
- CPPUNIT_CHECK( s.m_ActivePushCollision.get() == s.m_PassivePopCollision.get() );
- }
-
- // Bounded stack test
- template <class Stack>
- void test_bounded()
- {
- Stack testStack( s_nStackSize );
- test( testStack );
- }
-
- template <class Stack>
- void test( Stack& testStack )
- {
- m_nWorkingProducers.store(s_nPushThreadCount, atomics::memory_order_release);
- size_t const nPushCount = s_nStackSize / s_nPushThreadCount;
-
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new Pusher<Stack>( pool, testStack ), s_nPushThreadCount );
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it )
- static_cast<Pusher<Stack>* >( *it )->m_nItemCount = nPushCount;
- pool.add( new Popper<Stack>( pool, testStack ), s_nPopThreadCount );
-
- CPPUNIT_MSG( " Push/Pop test, push thread count=" << s_nPushThreadCount
- << " pop thread count=" << s_nPopThreadCount
- << " items=" << (nPushCount * s_nPushThreadCount)
- << "...");
- pool.run();
- CPPUNIT_MSG( " Duration=" << pool.avgDuration() );
-
- s_nStackSize = nPushCount * s_nPushThreadCount;
- analyze( pool, testStack );
- CPPUNIT_MSG( testStack.statistics() );
- }
-
- protected:
-# include "stack/stack_defs.h"
- CDSUNIT_DECLARE_TreiberStack
- CDSUNIT_DECLARE_EliminationStack
- CDSUNIT_DECLARE_FCStack
- CDSUNIT_DECLARE_FCDeque
- CDSUNIT_DECLARE_StdStack
-
- CPPUNIT_TEST_SUITE(Stack_PushPop)
- CDSUNIT_TEST_TreiberStack
- CDSUNIT_TEST_EliminationStack
- CDSUNIT_TEST_FCStack
- CDSUNIT_TEST_FCDeque
- CDSUNIT_TEST_StdStack
- CPPUNIT_TEST_SUITE_END();
- };
-} // namespace stack
-
-CPPUNIT_TEST_SUITE_REGISTRATION(stack::Stack_PushPop);
+++ /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_TYPES_H
-#define CDSUNIT_STACK_TYPES_H
-
-#include <cds/container/treiber_stack.h>
-#include <cds/container/fcstack.h>
-#include <cds/container/fcdeque.h>
-
-#include <cds/gc/hp.h>
-#include <cds/gc/dhp.h>
-
-#include <mutex>
-#include <cds/sync/spinlock.h>
-#include <stack>
-#include <list>
-#include <vector>
-
-namespace stack {
-
- namespace details {
-
- template <typename T, typename Traits=cds::container::fcdeque::traits>
- class FCDequeL: public cds::container::FCDeque<T, std::deque<T>, Traits >
- {
- typedef cds::container::FCDeque<T, std::deque<T>, Traits > base_class;
- public:
- FCDequeL()
- {}
-
- FCDequeL(
- unsigned int nCompactFactor ///< Flat combining: publication list compacting factor
- ,unsigned int nCombinePassCount ///< Flat combining: number of combining passes for combiner thread
- )
- : base_class( nCompactFactor, nCombinePassCount )
- {}
-
- bool push( T const& v )
- {
- return base_class::push_front( v );
- }
-
- bool pop( T& v )
- {
- return base_class::pop_front( v );
- }
- };
-
- template <typename T, typename Traits=cds::container::fcdeque::traits>
- class FCDequeR: public cds::container::FCDeque<T, std::deque<T>, Traits >
- {
- typedef cds::container::FCDeque<T, std::deque<T>, Traits > base_class;
- public:
- FCDequeR()
- {}
-
- FCDequeR(
- unsigned int nCompactFactor ///< Flat combining: publication list compacting factor
- ,unsigned int nCombinePassCount ///< Flat combining: number of combining passes for combiner thread
- )
- : base_class( nCompactFactor, nCombinePassCount )
- {}
-
- bool push( T const& v )
- {
- return base_class::push_back( v );
- }
-
- bool pop( T& v )
- {
- return base_class::pop_back( v );
- }
- };
-
- template < typename T, typename Stack, typename Lock>
- class StdStack
- {
- Stack m_Impl;
- mutable Lock m_Lock;
- cds::container::treiber_stack::empty_stat m_stat;
-
- typedef std::unique_lock<Lock> unique_lock;
-
- public:
- bool push( T const& v )
- {
- unique_lock l( m_Lock );
- m_Impl.push( v );
- return true;
- }
-
- bool pop( T& v )
- {
- unique_lock l( m_Lock );
- if ( !m_Impl.empty() ) {
- v = m_Impl.top();
- m_Impl.pop();
- return true;
- }
- return false;
- }
-
- bool empty() const
- {
- unique_lock l( m_Lock );
- return m_Impl.empty();
- }
-
- cds::container::treiber_stack::empty_stat const& statistics() const
- {
- return m_stat;
- }
- };
- }
-
- template <typename T>
- struct Types {
-
- // TreiberStack
- typedef cds::container::TreiberStack< cds::gc::HP, T > Treiber_HP;
- typedef cds::container::TreiberStack< cds::gc::DHP, T > Treiber_DHP;
-
- struct traits_Treiber_seqcst: public
- cds::container::treiber_stack::make_traits<
- cds::opt::memory_model<cds::opt::v::sequential_consistent>
- >::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_seqcst > Treiber_HP_seqcst;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_seqcst > Treiber_DHP_seqcst;
-
- struct traits_Treiber_stat: public
- cds::container::treiber_stack::make_traits<
- cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- >::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_stat > Treiber_HP_stat;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_stat > Treiber_DHP_stat;
-
- struct traits_Treiber_yield: public
- cds::container::treiber_stack::make_traits<
- cds::opt::back_off<cds::backoff::yield>
- , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- >::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_yield > Treiber_HP_yield;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_yield > Treiber_DHP_yield;
-
- struct traits_Treiber_pause: public
- cds::container::treiber_stack::make_traits<
- cds::opt::back_off<cds::backoff::pause>
- >::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_pause > Treiber_HP_pause;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_pause > Treiber_DHP_pause;
-
- struct traits_Treiber_exp: public
- cds::container::treiber_stack::make_traits<
- cds::opt::back_off<
- cds::backoff::exponential<
- cds::backoff::pause,
- cds::backoff::yield
- >
- >
- >::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_exp > Treiber_HP_exp;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_exp > Treiber_DHP_exp;
-
-
- // Elimination stack
- struct traits_Elimination_on : public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_on > Elimination_HP;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_on > Elimination_DHP;
-
- struct traits_Elimination_stat : public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- ,cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_stat > Elimination_HP_stat;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_stat > Elimination_DHP_stat;
-
- struct traits_Elimination_2ms: public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- ,cds::opt::elimination_backoff< cds::backoff::delay_of<2> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_2ms > Elimination_HP_2ms;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms > Elimination_DHP_2ms;
-
- struct traits_Elimination_2ms_stat : public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<2> >
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_2ms_stat > Elimination_HP_2ms_stat;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms_stat > Elimination_DHP_2ms_stat;
-
- struct traits_Elimination_5ms : public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<5> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_5ms > Elimination_HP_5ms;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms > Elimination_DHP_5ms;
-
- struct traits_Elimination_5ms_stat : public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<5> >
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_5ms_stat > Elimination_HP_5ms_stat;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms_stat > Elimination_DHP_5ms_stat;
-
- struct traits_Elimination_10ms : public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<10> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_10ms > Elimination_HP_10ms;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms > Elimination_DHP_10ms;
-
- struct traits_Elimination_10ms_stat : public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::elimination_backoff< cds::backoff::delay_of<10> >
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_10ms_stat > Elimination_HP_10ms_stat;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms_stat > Elimination_DHP_10ms_stat;
-
- struct traits_Elimination_dyn: public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::buffer< cds::opt::v::dynamic_buffer<int> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_dyn > Elimination_HP_dyn;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn > Elimination_DHP_dyn;
-
- struct traits_Elimination_seqcst: public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::memory_model<cds::opt::v::sequential_consistent>
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_seqcst > Elimination_HP_seqcst;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_seqcst > Elimination_DHP_seqcst;
-
- struct traits_Elimination_dyn_stat: public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
- , cds::opt::buffer< cds::opt::v::dynamic_buffer<int> >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_dyn_stat > Elimination_HP_dyn_stat;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn_stat > Elimination_DHP_dyn_stat;
-
- struct traits_Elimination_yield: public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::back_off<cds::backoff::yield>
- , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_yield > Elimination_HP_yield;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_yield > Elimination_DHP_yield;
-
- struct traits_Elimination_pause: public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- , cds::opt::back_off<cds::backoff::pause>
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_pause > Elimination_HP_pause;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_pause > Elimination_DHP_pause;
-
- struct traits_Elimination_exp: public
- cds::container::treiber_stack::make_traits <
- cds::opt::enable_elimination<true>
- ,cds::opt::back_off<
- cds::backoff::exponential<
- cds::backoff::pause,
- cds::backoff::yield
- >
- >
- > ::type
- {};
- typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_exp > Elimination_HP_exp;
- typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_exp > Elimination_DHP_exp;
-
-
- // FCStack
- typedef cds::container::FCStack< T > FCStack_deque;
-
- struct traits_FCStack_stat:
- public cds::container::fcstack::make_traits<
- cds::opt::stat< cds::container::fcstack::stat<> >
- >::type
- {};
- struct traits_FCStack_elimination:
- public cds::container::fcstack::make_traits<
- cds::opt::enable_elimination< true >
- >::type
- {};
- struct traits_FCStack_elimination_stat:
- public cds::container::fcstack::make_traits<
- cds::opt::stat< cds::container::fcstack::stat<> >,
- cds::opt::enable_elimination< true >
- >::type
- {};
- struct traits_FCStack_mutex:
- public cds::container::fcstack::make_traits<
- cds::opt::lock_type< std::mutex >
- >::type
- {};
-
- typedef cds::container::FCStack< T, std::stack<T, std::deque<T> >, traits_FCStack_mutex > FCStack_deque_mutex;
- typedef cds::container::FCStack< T, std::stack<T, std::deque<T> >, traits_FCStack_stat > FCStack_deque_stat;
- typedef cds::container::FCStack< T, std::stack<T, std::deque<T> >, traits_FCStack_elimination > FCStack_deque_elimination;
- typedef cds::container::FCStack< T, std::stack<T, std::deque<T> >, traits_FCStack_elimination_stat > FCStack_deque_elimination_stat;
- typedef cds::container::FCStack< T, std::stack<T, std::vector<T> > > FCStack_vector;
- typedef cds::container::FCStack< T, std::stack<T, std::vector<T> >, traits_FCStack_mutex > FCStack_vector_mutex;
- typedef cds::container::FCStack< T, std::stack<T, std::vector<T> >, traits_FCStack_stat > FCStack_vector_stat;
- typedef cds::container::FCStack< T, std::stack<T, std::vector<T> >, traits_FCStack_elimination > FCStack_vector_elimination;
- typedef cds::container::FCStack< T, std::stack<T, std::vector<T> >, traits_FCStack_elimination_stat > FCStack_vector_elimination_stat;
- typedef cds::container::FCStack< T, std::stack<T, std::list<T> > > FCStack_list;
- typedef cds::container::FCStack< T, std::stack<T, std::list<T> >, traits_FCStack_mutex > FCStack_list_mutex;
- typedef cds::container::FCStack< T, std::stack<T, std::list<T> >, traits_FCStack_stat > FCStack_list_stat;
- typedef cds::container::FCStack< T, std::stack<T, std::list<T> >, traits_FCStack_elimination > FCStack_list_elimination;
- typedef cds::container::FCStack< T, std::stack<T, std::list<T> >, traits_FCStack_elimination_stat > FCStack_list_elimination_stat;
-
- // FCDeque
- struct traits_FCDeque_stat:
- public cds::container::fcdeque::make_traits<
- cds::opt::stat< cds::container::fcdeque::stat<> >
- >::type
- {};
- struct traits_FCDeque_elimination:
- public cds::container::fcdeque::make_traits<
- cds::opt::enable_elimination< true >
- >::type
- {};
- struct traits_FCDeque_elimination_stat:
- public cds::container::fcdeque::make_traits<
- cds::opt::stat< cds::container::fcdeque::stat<> >,
- cds::opt::enable_elimination< true >
- >::type
- {};
- struct traits_FCDeque_mutex:
- public cds::container::fcdeque::make_traits<
- cds::opt::lock_type< std::mutex >
- >::type
- {};
-
-
- typedef details::FCDequeL< T > FCDequeL_default;
- typedef details::FCDequeL< T, traits_FCDeque_mutex > FCDequeL_mutex;
- typedef details::FCDequeL< T, traits_FCDeque_stat > FCDequeL_stat;
- typedef details::FCDequeL< T, traits_FCDeque_elimination > FCDequeL_elimination;
- typedef details::FCDequeL< T, traits_FCDeque_elimination_stat > FCDequeL_elimination_stat;
-
- typedef details::FCDequeR< T > FCDequeR_default;
- typedef details::FCDequeR< T, traits_FCDeque_mutex > FCDequeR_mutex;
- typedef details::FCDequeR< T, traits_FCDeque_stat > FCDequeR_stat;
- typedef details::FCDequeR< T, traits_FCDeque_elimination > FCDequeR_elimination;
- typedef details::FCDequeR< T, traits_FCDeque_elimination_stat > FCDequeR_elimination_stat;
-
-
- // std::stack
- typedef details::StdStack< T, std::stack< T >, std::mutex > StdStack_Deque_Mutex;
- typedef details::StdStack< T, std::stack< T >, cds::sync::spin > StdStack_Deque_Spin;
- typedef details::StdStack< T, std::stack< T, std::vector<T> >, std::mutex > StdStack_Vector_Mutex;
- typedef details::StdStack< T, std::stack< T, std::vector<T> >, cds::sync::spin > StdStack_Vector_Spin;
- typedef details::StdStack< T, std::stack< T, std::list<T> >, std::mutex > StdStack_List_Mutex;
- typedef details::StdStack< T, std::stack< T, std::list<T> >, cds::sync::spin > StdStack_List_Spin;
-
- };
-} // namespace stack
-
-namespace std {
- static inline ostream& operator <<( ostream& o, cds::container::treiber_stack::stat<> const& s )
- {
- return o << "\tStatistics:\n"
- << "\t Push: " << s.m_PushCount.get() << "\n"
- << "\t Pop: " << s.m_PopCount.get() << "\n"
- << "\t Push contention: " << s.m_PushRace.get() << "\n"
- << "\t Pop contention: " << s.m_PopRace.get() << "\n"
- << "\t m_ActivePushCollision: " << s.m_ActivePushCollision.get() << "\n"
- << "\t m_PassivePopCollision: " << s.m_PassivePopCollision.get() << "\n"
- << "\t m_ActivePopCollision: " << s.m_ActivePopCollision.get() << "\n"
- << "\t m_PassivePushCollision: " << s.m_PassivePushCollision.get() << "\n"
- << "\t m_EliminationFailed: " << s.m_EliminationFailed.get() << "\n";
- }
-
- static inline ostream& operator <<(ostream& o, cds::container::treiber_stack::empty_stat const& /*s*/)
- {
- return o;
- }
-
- static inline ostream& operator <<( ostream& o, cds::container::fcstack::empty_stat const& /*s*/ )
- {
- return o;
- }
-
- static inline ostream& operator <<( ostream& o, cds::container::fcstack::stat<> const& s )
- {
- return o << "\tStatistics:\n"
- << "\t Push: " << s.m_nPush.get() << "\n"
- << "\t PushMove: " << s.m_nPushMove.get() << "\n"
- << "\t Pop: " << s.m_nPop.get() << "\n"
- << "\t FailedPop: " << s.m_nFailedPop.get() << "\n"
- << "\t Collided push/pop pair: " << s.m_nCollided.get() << "\n"
- << "\tFlat combining statistics:\n"
- << "\t Combining factor: " << s.combining_factor() << "\n"
- << "\t Operation count: " << s.m_nOperationCount.get() << "\n"
- << "\t Combine call count: " << s.m_nCombiningCount.get() << "\n"
- << "\t Compact pub-list: " << s.m_nCompactPublicationList.get() << "\n"
- << "\t Deactivate pub-record: " << s.m_nDeactivatePubRecord.get() << "\n"
- << "\t Activate pub-record: " << s.m_nActivatePubRecord.get() << "\n"
- << "\t Create pub-record: " << s.m_nPubRecordCreated.get() << "\n"
- << "\t Delete pub-record: " << s.m_nPubRecordDeteted.get() << "\n"
- << "\t Acquire pub-record: " << s.m_nAcquirePubRecCount.get()<< "\n"
- << "\t Release pub-record: " << s.m_nReleasePubRecCount.get()<< "\n";
- }
-
- static inline ostream& operator <<( ostream& o, cds::container::fcdeque::empty_stat const& /*s*/ )
- {
- return o;
- }
-
- static inline ostream& operator <<( ostream& o, cds::container::fcdeque::stat<> const& s )
- {
- return o << "\tStatistics:\n"
- << "\t Push front: " << s.m_nPushFront.get() << "\n"
- << "\t Push front move: " << s.m_nPushFrontMove.get() << "\n"
- << "\t Push back: " << s.m_nPushBack.get() << "\n"
- << "\t Push back move: " << s.m_nPushBackMove.get() << "\n"
- << "\t Pop front: " << s.m_nPopFront.get() << "\n"
- << "\t Failed pop front: " << s.m_nFailedPopFront.get() << "\n"
- << "\t Pop back: " << s.m_nPopBack.get() << "\n"
- << "\t Failed pop back: " << s.m_nFailedPopBack.get() << "\n"
- << "\t Collided push/pop pair: " << s.m_nCollided.get() << "\n"
- << "\tFlat combining statistics:\n"
- << "\t Combining factor: " << s.combining_factor() << "\n"
- << "\t Operation count: " << s.m_nOperationCount.get() << "\n"
- << "\t Combine call count: " << s.m_nCombiningCount.get() << "\n"
- << "\t Compact pub-list: " << s.m_nCompactPublicationList.get() << "\n"
- << "\t Deactivate pub-record: " << s.m_nDeactivatePubRecord.get() << "\n"
- << "\t Activate pub-record: " << s.m_nActivatePubRecord.get() << "\n"
- << "\t Create pub-record: " << s.m_nPubRecordCreated.get() << "\n"
- << "\t Delete pub-record: " << s.m_nPubRecordDeteted.get() << "\n"
- << "\t Acquire pub-record: " << s.m_nAcquirePubRecCount.get()<< "\n"
- << "\t Release pub-record: " << s.m_nReleasePubRecCount.get()<< "\n";
- }
-
-} // namespace std
-
-#endif // #ifndef CDSUNIT_STACK_TYPES_H