{408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
EndProjectSection\r
EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-intrusive-list", "gtest-intrusive-list.vcxproj", "{43563014-EE75-4855-87B5-A2F59762F413}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
+ EndProjectSection\r
+EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
Debug|Win32 = Debug|Win32\r
{79A6845E-85BF-4000-94FF-9DF2473460D4}.Release|Win32.Build.0 = Release|Win32\r
{79A6845E-85BF-4000-94FF-9DF2473460D4}.Release|x64.ActiveCfg = Release|x64\r
{79A6845E-85BF-4000-94FF-9DF2473460D4}.Release|x64.Build.0 = Release|x64\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.Debug|Win32.Build.0 = Debug|Win32\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.Debug|x64.ActiveCfg = Debug|x64\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.Debug|x64.Build.0 = Debug|x64\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.DebugVLD|Win32.Build.0 = DebugVLD|Win32\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.DebugVLD|x64.ActiveCfg = DebugVLD|x64\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.DebugVLD|x64.Build.0 = DebugVLD|x64\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.Release|Win32.ActiveCfg = Release|Win32\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.Release|Win32.Build.0 = Release|Win32\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.Release|x64.ActiveCfg = Release|x64\r
+ {43563014-EE75-4855-87B5-A2F59762F413}.Release|x64.Build.0 = Release|x64\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
{24DF3B87-387E-4EFC-BDE0-8DAD279FE19A} = {7D3EE35B-185D-40B5-88C2-7F9933426978}\r
{31952FA8-A303-4A0B-94C4-ABA5A8A6DBCE} = {0D83E8C7-97D1-4BA1-928A-6846E7089652}\r
{79A6845E-85BF-4000-94FF-9DF2473460D4} = {10E1FAF2-904D-405E-8AB5-6878A1B03346}\r
+ {43563014-EE75-4855-87B5-A2F59762F413} = {810490B7-31E5-49AE-8455-CAF99A9658B6}\r
EndGlobalSection\r
GlobalSection(DPCodeReviewSolutionGUID) = preSolution\r
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}\r
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
</Filter>\r
- <Filter Include="Resource Files">\r
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r
- </Filter>\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="..\..\..\test\unit\main.cpp">\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="DebugVLD|Win32">
+ <Configuration>DebugVLD</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="DebugVLD|x64">
+ <Configuration>DebugVLD</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_iterable_dhp.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_iterable_hp.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_dhp.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_hp.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_nogc.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_gpb.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_gpi.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_gpt.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_shb.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_sht.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_dhp.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_hp.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_nogc.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_gpb.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_gpi.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_gpt.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_shb.cpp" />
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_sht.cpp" />
+ <ClCompile Include="..\..\..\test\unit\main.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_iterable_list.h" />
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_iterable_list_hp.h" />
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_lazy_rcu.h" />
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_list.h" />
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_list_hp.h" />
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_list_nogc.h" />
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_list_rcu.h" />
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_michael_rcu.h" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{43563014-EE75-4855-87B5-A2F59762F413}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>intrusive_list</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
+ <TargetName>$(ProjectName)_d</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
+ <TargetName>$(ProjectName)_d</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
+ <TargetName>$(ProjectName)_d</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
+ <TargetName>$(ProjectName)_d</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_ENABLE_ATOMIC_ALIGNMENT_FIX;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4503</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_ENABLE_ATOMIC_ALIGNMENT_FIX;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4503</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_ENABLE_ATOMIC_ALIGNMENT_FIX;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4503</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_ENABLE_ATOMIC_ALIGNMENT_FIX;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4503</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>_ENABLE_ATOMIC_ALIGNMENT_FIX;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4503</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>gtest.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>_ENABLE_ATOMIC_ALIGNMENT_FIX;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4503</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>gtest.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Source Files\iterable_list">
+ <UniqueIdentifier>{f6bc2494-0971-483b-98b2-7675d2aee7c9}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\lazy_list">
+ <UniqueIdentifier>{b975977c-e055-46d0-95ea-bc94c66c6d50}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\michael_list">
+ <UniqueIdentifier>{edd852ff-4431-4c46-9592-dbbba4d9846e}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\test\unit\main.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_iterable_dhp.cpp">
+ <Filter>Source Files\iterable_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_iterable_hp.cpp">
+ <Filter>Source Files\iterable_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_dhp.cpp">
+ <Filter>Source Files\lazy_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_hp.cpp">
+ <Filter>Source Files\lazy_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_nogc.cpp">
+ <Filter>Source Files\lazy_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_gpb.cpp">
+ <Filter>Source Files\lazy_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_gpi.cpp">
+ <Filter>Source Files\lazy_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_gpt.cpp">
+ <Filter>Source Files\lazy_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_shb.cpp">
+ <Filter>Source Files\lazy_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_lazy_rcu_sht.cpp">
+ <Filter>Source Files\lazy_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_dhp.cpp">
+ <Filter>Source Files\michael_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_hp.cpp">
+ <Filter>Source Files\michael_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_nogc.cpp">
+ <Filter>Source Files\michael_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_gpb.cpp">
+ <Filter>Source Files\michael_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_gpi.cpp">
+ <Filter>Source Files\michael_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_gpt.cpp">
+ <Filter>Source Files\michael_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_shb.cpp">
+ <Filter>Source Files\michael_list</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\test\unit\intrusive-list\intrusive_michael_rcu_sht.cpp">
+ <Filter>Source Files\michael_list</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_iterable_list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_iterable_list_hp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_lazy_rcu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_list_hp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_list_nogc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_list_rcu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\test\unit\intrusive-list\test_intrusive_michael_rcu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file
</ProjectConfiguration>\r
</ItemGroup>\r
<ItemGroup>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_iterable_list.h" />\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_iterable_list_hp.h" />\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_lazy_rcu.h" />\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_list.h" />\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_list_hp.h" />\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_list_nogc.h" />\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_list_rcu.h" />\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_michael_rcu.h" />\r
<ClInclude Include="..\..\..\test\unit\list\test_iterable_list.h" />\r
<ClInclude Include="..\..\..\test\unit\list\test_iterable_list_hp.h" />\r
<ClInclude Include="..\..\..\test\unit\list\test_kv_iterable_list.h" />\r
<ClInclude Include="..\..\..\test\unit\list\test_michael_rcu.h" />\r
</ItemGroup>\r
<ItemGroup>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_iterable_dhp.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_iterable_hp.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_dhp.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_hp.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_nogc.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_gpb.cpp">\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_gpi.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_gpt.cpp">\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_shb.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_sht.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_dhp.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_hp.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_gpb.cpp">\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_gpi.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_gpt.cpp">\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
- <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_shb.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_sht.cpp" />\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_nogc.cpp" />\r
<ClCompile Include="..\..\..\test\unit\list\iterable_dhp.cpp" />\r
<ClCompile Include="..\..\..\test\unit\list\iterable_hp.cpp" />\r
<ClCompile Include="..\..\..\test\unit\list\kv_iterable_dhp.cpp" />\r
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
</Filter>\r
- <Filter Include="Resource Files">\r
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r
- </Filter>\r
<Filter Include="Source Files\iterable_list">\r
<UniqueIdentifier>{f6bc2494-0971-483b-98b2-7675d2aee7c9}</UniqueIdentifier>\r
</Filter>\r
</Filter>\r
</ItemGroup>\r
<ItemGroup>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_list.h">\r
- <Filter>Header Files</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_list_hp.h">\r
- <Filter>Header Files</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_list_nogc.h">\r
- <Filter>Header Files</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_list_rcu.h">\r
- <Filter>Header Files</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_michael_rcu.h">\r
- <Filter>Header Files</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_lazy_rcu.h">\r
- <Filter>Header Files</Filter>\r
- </ClInclude>\r
<ClInclude Include="..\..\..\test\unit\list\test_list.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
<ClInclude Include="..\..\..\test\unit\list\test_kv_lazy_rcu.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_iterable_list_hp.h">\r
- <Filter>Header Files</Filter>\r
- </ClInclude>\r
- <ClInclude Include="..\..\..\test\unit\list\test_intrusive_iterable_list.h">\r
- <Filter>Header Files</Filter>\r
- </ClInclude>\r
<ClInclude Include="..\..\..\test\unit\list\test_iterable_list.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
<ClCompile Include="..\..\..\test\unit\main.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_iterable_dhp.cpp">\r
- <Filter>Source Files\iterable_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_iterable_hp.cpp">\r
- <Filter>Source Files\iterable_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_dhp.cpp">\r
- <Filter>Source Files\lazy_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_hp.cpp">\r
- <Filter>Source Files\lazy_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_nogc.cpp">\r
- <Filter>Source Files\lazy_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_gpb.cpp">\r
- <Filter>Source Files\lazy_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_gpi.cpp">\r
- <Filter>Source Files\lazy_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_gpt.cpp">\r
- <Filter>Source Files\lazy_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_shb.cpp">\r
- <Filter>Source Files\lazy_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_lazy_rcu_sht.cpp">\r
- <Filter>Source Files\lazy_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_dhp.cpp">\r
- <Filter>Source Files\michael_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_hp.cpp">\r
- <Filter>Source Files\michael_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_nogc.cpp">\r
- <Filter>Source Files\michael_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_gpb.cpp">\r
- <Filter>Source Files\michael_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_gpi.cpp">\r
- <Filter>Source Files\michael_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_gpt.cpp">\r
- <Filter>Source Files\michael_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_shb.cpp">\r
- <Filter>Source Files\michael_list</Filter>\r
- </ClCompile>\r
- <ClCompile Include="..\..\..\test\unit\list\intrusive_michael_rcu_sht.cpp">\r
- <Filter>Source Files\michael_list</Filter>\r
- </ClCompile>\r
<ClCompile Include="..\..\..\test\unit\list\kv_lazy_dhp.cpp">\r
<Filter>Source Files\lazy_list</Filter>\r
</ClCompile>\r
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\test\unit\main.cpp">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
<Filter Include="Source Files\intrusive.EllenBinTree">
<UniqueIdentifier>{5e28703f-0f92-4c6c-b3a6-3bd837deb8f6}</UniqueIdentifier>
</Filter>
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
</Filter>\r
- <Filter Include="Resource Files">\r
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r
- </Filter>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\..\test\include\cds_test\stress_test.h">\r
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deque)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/intrusive-list)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/list)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/map)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/misc)
add_custom_target(unit-all
DEPENDS
unit-deque
+ unit-intrusive-list
unit-list
unit-map
unit-misc
--- /dev/null
+set(PACKAGE_NAME unit-intrusive-list)
+
+set(CDSGTEST_INTRUSIVE_LIST_SOURCES
+ ../main.cpp
+ intrusive_lazy_hp.cpp
+ intrusive_lazy_dhp.cpp
+ intrusive_lazy_nogc.cpp
+ intrusive_lazy_rcu_gpb.cpp
+ intrusive_lazy_rcu_gpi.cpp
+ intrusive_lazy_rcu_gpt.cpp
+ intrusive_lazy_rcu_shb.cpp
+ intrusive_lazy_rcu_sht.cpp
+ intrusive_michael_hp.cpp
+ intrusive_michael_dhp.cpp
+ intrusive_michael_nogc.cpp
+ intrusive_michael_rcu_gpb.cpp
+ intrusive_michael_rcu_gpi.cpp
+ intrusive_michael_rcu_gpt.cpp
+ intrusive_michael_rcu_shb.cpp
+ intrusive_michael_rcu_sht.cpp
+)
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+add_executable(${PACKAGE_NAME} ${CDSGTEST_INTRUSIVE_LIST_SOURCES})
+target_link_libraries(${PACKAGE_NAME}
+ ${CDS_SHARED_LIBRARY}
+ ${GTEST_LIBRARY}
+ ${Boost_THREAD_LIBRARY}
+ ${Boost_SYSTEM_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+)
+
+add_test(NAME ${PACKAGE_NAME} COMMAND ${PACKAGE_NAME} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
\ No newline at end of file
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_iterable_list_hp.h"
+#include <cds/intrusive/iterable_list_dhp.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::DHP gc_type;
+
+ class IntrusiveIterableList_DHP : public cds_test::intrusive_iterable_list_hp
+ {
+ protected:
+ void SetUp()
+ {
+ typedef ci::IterableList< gc_type, item_type > list_type;
+
+ // +1 - for guarded_ptr
+ // +3 - for iterator test
+ cds::gc::dhp::GarbageCollector::Construct( 16, list_type::c_nHazardPtrCount );
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ cds::gc::dhp::GarbageCollector::Destruct();
+ }
+ };
+
+ TEST_F( IntrusiveIterableList_DHP, less )
+ {
+ typedef ci::IterableList< gc_type, item_type,
+ typename ci::iterable_list::make_traits<
+ ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< item_type >>
+ , cds::opt::item_counter< cds::atomicity::item_counter >
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_DHP, compare )
+ {
+ typedef ci::IterableList< gc_type, item_type,
+ typename ci::iterable_list::make_traits<
+ ci::opt::disposer< mock_disposer >
+ , cds::opt::compare< cmp< item_type >>
+ , cds::opt::item_counter< cds::atomicity::item_counter >
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_DHP, item_counting )
+ {
+ struct traits : public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef cmp< item_type > compare;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_DHP, backoff )
+ {
+ struct traits : public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef cmp< item_type > compare;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_DHP, seqcst )
+ {
+ struct traits : public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_DHP, stat )
+ {
+ struct traits: public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::iterable_list::stat<> stat;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_DHP, wrapped_stat )
+ {
+ struct traits: public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::iterable_list::wrapped_stat<> stat;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ traits::stat::stat_type st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_iterable_list_hp.h"
+#include <cds/intrusive/iterable_list_hp.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::HP gc_type;
+
+ class IntrusiveIterableList_HP : public cds_test::intrusive_iterable_list_hp
+ {
+ protected:
+ void SetUp()
+ {
+ typedef ci::IterableList< gc_type, item_type > list_type;
+
+ // +1 - for guarded_ptr
+ // +3 - for iterator test
+ cds::gc::hp::GarbageCollector::Construct( list_type::c_nHazardPtrCount + 3, 1, 16 );
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ cds::gc::hp::GarbageCollector::Destruct( true );
+ }
+ };
+
+ TEST_F( IntrusiveIterableList_HP, less )
+ {
+ typedef ci::IterableList< gc_type, item_type,
+ typename ci::iterable_list::make_traits<
+ ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< item_type >>
+ ,cds::opt::item_counter< cds::atomicity::item_counter >
+
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_HP, compare )
+ {
+ typedef ci::IterableList< gc_type, item_type,
+ typename ci::iterable_list::make_traits<
+ ci::opt::disposer< mock_disposer >
+ , cds::opt::compare< cmp< item_type >>
+ , cds::opt::item_counter< cds::atomicity::item_counter >
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_HP, item_counting )
+ {
+ struct traits : public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef cmp< item_type > compare;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_HP, backoff )
+ {
+ struct traits : public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef cmp< item_type > compare;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_HP, seqcst )
+ {
+ struct traits : public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_HP, stat )
+ {
+ struct traits: public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::iterable_list::stat<> stat;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveIterableList_HP, wrapped_stat )
+ {
+ struct traits: public ci::iterable_list::traits {
+ typedef mock_disposer disposer;
+ typedef intrusive_iterable_list::less< item_type > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::iterable_list::wrapped_stat<> stat;
+ };
+ typedef ci::IterableList< gc_type, item_type, traits > list_type;
+
+ traits::stat::stat_type st;
+
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_list_hp.h"
+#include <cds/intrusive/lazy_list_dhp.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::DHP gc_type;
+
+ class IntrusiveLazyList_DHP : public cds_test::intrusive_list_hp
+ {
+ public:
+ typedef cds_test::intrusive_list_hp::base_item< ci::lazy_list::node< gc_type>> base_item;
+ typedef cds_test::intrusive_list_hp::member_item< ci::lazy_list::node< gc_type>> member_item;
+
+ typedef cds_test::intrusive_list_hp::base_item< ci::lazy_list::node< gc_type, std::mutex>> base_mutex_item;
+ typedef cds_test::intrusive_list_hp::member_item< ci::lazy_list::node< gc_type, std::mutex>> member_mutex_item;
+
+ protected:
+ void SetUp()
+ {
+ struct traits: public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ cds::gc::dhp::GarbageCollector::Construct( 16, list_type::c_nHazardPtrCount );
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ cds::gc::dhp::GarbageCollector::Destruct();
+ }
+ };
+
+ TEST_F( IntrusiveLazyList_DHP, base_hook )
+ {
+ typedef ci::LazyList< gc_type, base_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, base_hook_cmp )
+ {
+ typedef ci::LazyList< gc_type, base_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
+ , ci::opt::disposer< mock_disposer >
+ , cds::opt::compare< cmp< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, base_hook_item_counting )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, base_hook_mutex )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex>> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_mutex_item > compare;
+ typedef intrusive_list_common::less< base_mutex_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, base_mutex_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, base_hook_backoff )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, base_hook_seqcst )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, base_hook_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, base_hook_wrapped_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ cds::intrusive::lazy_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, member_hook )
+ {
+ typedef ci::LazyList< gc_type, member_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, member_hook_cmp )
+ {
+ typedef ci::LazyList< gc_type, member_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::compare< cmp< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, member_hook_item_counting )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, member_hook_seqcst )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, member_hook_mutex )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_mutex_item, hMember ), cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_mutex_item > compare;
+ typedef intrusive_list_common::less< member_mutex_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, member_mutex_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, member_hook_back_off )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::empty back_off;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, member_hook_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_DHP, member_hook_wrapped_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ cds::intrusive::lazy_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_list_hp.h"
+#include <cds/intrusive/lazy_list_hp.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::HP gc_type;
+
+ class IntrusiveLazyList_HP : public cds_test::intrusive_list_hp
+ {
+ public:
+ typedef cds_test::intrusive_list_hp::base_item< ci::lazy_list::node< gc_type>> base_item;
+ typedef cds_test::intrusive_list_hp::member_item< ci::lazy_list::node< gc_type>> member_item;
+
+ typedef cds_test::intrusive_list_hp::base_item< ci::lazy_list::node< gc_type, std::mutex>> base_mutex_item;
+ typedef cds_test::intrusive_list_hp::member_item< ci::lazy_list::node< gc_type, std::mutex>> member_mutex_item;
+
+ protected:
+ void SetUp()
+ {
+ struct traits: public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ // +1 - for guarded_ptr
+ cds::gc::hp::GarbageCollector::Construct( list_type::c_nHazardPtrCount + 1, 1, 16 );
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ cds::gc::hp::GarbageCollector::Destruct( true );
+ }
+ };
+
+ TEST_F( IntrusiveLazyList_HP, base_hook )
+ {
+ typedef ci::LazyList< gc_type, base_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, base_hook_cmp )
+ {
+ typedef ci::LazyList< gc_type, base_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
+ , ci::opt::disposer< mock_disposer >
+ , cds::opt::compare< cmp< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, base_hook_item_counting )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, base_hook_mutex )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex>> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_mutex_item > compare;
+ typedef intrusive_list_common::less< base_mutex_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, base_mutex_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, base_hook_backoff )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, base_hook_seqcst )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, base_hook_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, base_hook_wrapped_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ cds::intrusive::lazy_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, member_hook )
+ {
+ typedef ci::LazyList< gc_type, member_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, member_hook_cmp )
+ {
+ typedef ci::LazyList< gc_type, member_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::compare< cmp< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, member_hook_item_counting )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, member_hook_seqcst )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, member_hook_mutex )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_mutex_item, hMember ), cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_mutex_item > compare;
+ typedef intrusive_list_common::less< member_mutex_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, member_mutex_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, member_hook_back_off )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::empty back_off;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, member_hook_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveLazyList_HP, member_hook_wrapped_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ cds::intrusive::lazy_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_list_nogc.h"
+#include <cds/intrusive/lazy_list_nogc.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::nogc gc_type;
+
+ class IntrusiveLazyList_NOGC : public cds_test::intrusive_list_nogc
+ {
+ public:
+ typedef cds_test::intrusive_list_nogc::base_item< ci::lazy_list::node< gc_type>> base_item;
+ typedef cds_test::intrusive_list_nogc::member_item< ci::lazy_list::node< gc_type>> member_item;
+
+ typedef cds_test::intrusive_list_nogc::base_item< ci::lazy_list::node< gc_type, std::mutex>> base_mutex_item;
+ typedef cds_test::intrusive_list_nogc::member_item< ci::lazy_list::node< gc_type, std::mutex>> member_mutex_item;
+ };
+
+ TEST_F( IntrusiveLazyList_NOGC, base_hook )
+ {
+ typedef ci::LazyList< gc_type, base_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, base_hook_cmp )
+ {
+ typedef ci::LazyList< gc_type, base_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
+ , ci::opt::disposer< mock_disposer >
+ , cds::opt::compare< cmp< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, base_hook_item_counting )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_nogc::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, base_hook_mutex )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex>> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_mutex_item > compare;
+ typedef intrusive_list_nogc::less< base_mutex_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, base_mutex_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, base_hook_backoff )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_nogc::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, base_hook_seqcst )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_nogc::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, base_hook_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_nogc::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, base_hook_wrapped_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_nogc::less< base_item > less;
+ typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, base_item, traits > list_type;
+
+ cds::intrusive::lazy_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, member_hook )
+ {
+ typedef ci::LazyList< gc_type, member_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, member_hook_cmp )
+ {
+ typedef ci::LazyList< gc_type, member_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::compare< cmp< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, member_hook_item_counting )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_nogc::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, member_hook_seqcst )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_nogc::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, member_hook_mutex )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_mutex_item, hMember ), cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_mutex_item > compare;
+ typedef intrusive_list_nogc::less< member_mutex_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< gc_type, member_mutex_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, member_hook_back_off )
+ {
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_nogc::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::empty back_off;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, member_hook_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_nogc::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveLazyList_NOGC, member_hook_wrapped_stat )
+ {
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_nogc::less< member_item > less;
+ typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+ };
+ typedef ci::LazyList< gc_type, member_item, traits > list_type;
+
+ cds::intrusive::lazy_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/general_buffered.h>
+
+#include "test_intrusive_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_buffered<> rcu_implementation;
+ typedef cds::urcu::general_buffered_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveLazyList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB_stripped, IntrusiveLazyList, rcu_implementation_stripped );
--- /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 <cds/urcu/general_instant.h>
+
+#include "test_intrusive_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_instant<> rcu_implementation;
+ typedef cds::urcu::general_instant_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveLazyList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI_stripped, IntrusiveLazyList, rcu_implementation_stripped );
--- /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 <cds/urcu/general_threaded.h>
+
+#include "test_intrusive_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_threaded<> rcu_implementation;
+ typedef cds::urcu::general_threaded_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveLazyList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT_stripped, IntrusiveLazyList, rcu_implementation_stripped );
--- /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 <cds/urcu/signal_buffered.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_buffered<> rcu_implementation;
+ typedef cds::urcu::signal_buffered_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveLazyList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB_stripped, IntrusiveLazyList, rcu_implementation_stripped );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
--- /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 <cds/urcu/signal_threaded.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_threaded<> rcu_implementation;
+ typedef cds::urcu::signal_threaded_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveLazyList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT_stripped, IntrusiveLazyList, rcu_implementation_stripped );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
--- /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 "test_intrusive_list_hp.h"
+#include <cds/intrusive/michael_list_dhp.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::DHP gc_type;
+
+ class IntrusiveMichaelList_DHP : public cds_test::intrusive_list_hp
+ {
+ public:
+ typedef cds_test::intrusive_list_hp::base_item< ci::michael_list::node< gc_type>> base_item;
+ typedef cds_test::intrusive_list_hp::member_item< ci::michael_list::node< gc_type>> member_item;
+
+ protected:
+ void SetUp()
+ {
+ struct traits: public ci::michael_list::traits
+ {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ cds::gc::dhp::GarbageCollector::Construct( 16, list_type::c_nHazardPtrCount );
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ cds::gc::dhp::GarbageCollector::Destruct();
+ }
+ };
+
+ TEST_F( IntrusiveMichaelList_DHP, base_hook )
+ {
+ typedef ci::MichaelList< gc_type, base_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, base_hook_cmp )
+ {
+ typedef ci::MichaelList< gc_type, base_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
+ , ci::opt::disposer< mock_disposer >
+ , cds::opt::compare< cmp< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, base_hook_item_counting )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, base_hook_backoff )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, base_hook_seqcst )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+ TEST_F( IntrusiveMichaelList_DHP, base_hook_stat )
+ {
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::intrusive::michael_list::stat<> stat;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, base_hook_wrapped_stat )
+ {
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef cds::intrusive::michael_list::wrapped_stat<> stat;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ cds::intrusive::michael_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+
+ TEST_F( IntrusiveMichaelList_DHP, member_hook )
+ {
+ typedef ci::MichaelList< gc_type, member_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, member_hook_cmp )
+ {
+ typedef ci::MichaelList< gc_type, member_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::compare< cmp< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, member_hook_item_counting )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, member_hook_seqcst )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, member_hook_back_off )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::empty back_off;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, member_hook_stat )
+ {
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::intrusive::michael_list::stat<> stat;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_DHP, member_hook_wrapped_stat )
+ {
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef cds::intrusive::michael_list::wrapped_stat<> stat;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ cds::intrusive::michael_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_list_hp.h"
+#include <cds/intrusive/michael_list_hp.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::HP gc_type;
+
+ class IntrusiveMichaelList_HP : public cds_test::intrusive_list_hp
+ {
+ public:
+ typedef cds_test::intrusive_list_hp::base_item< ci::michael_list::node< gc_type>> base_item;
+ typedef cds_test::intrusive_list_hp::member_item< ci::michael_list::node< gc_type>> member_item;
+
+ protected:
+ void SetUp()
+ {
+ struct traits: public ci::michael_list::traits
+ {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ // +1 - for guarded_ptr
+ cds::gc::hp::GarbageCollector::Construct( list_type::c_nHazardPtrCount + 1, 1, 16 );
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ cds::gc::hp::GarbageCollector::Destruct( true );
+ }
+ };
+
+ TEST_F( IntrusiveMichaelList_HP, base_hook )
+ {
+ typedef ci::MichaelList< gc_type, base_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, base_hook_cmp )
+ {
+ typedef ci::MichaelList< gc_type, base_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
+ , ci::opt::disposer< mock_disposer >
+ , cds::opt::compare< cmp< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, base_hook_item_counting )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, base_hook_backoff )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, base_hook_seqcst )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, base_hook_stat )
+ {
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_common::less< base_item > less;
+ typedef cds::intrusive::michael_list::stat<> stat;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, base_hook_wrapped_stat )
+ {
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef cds::intrusive::michael_list::wrapped_stat<> stat;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ cds::intrusive::michael_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, member_hook )
+ {
+ typedef ci::MichaelList< gc_type, member_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, member_hook_cmp )
+ {
+ typedef ci::MichaelList< gc_type, member_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::compare< cmp< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, member_hook_item_counting )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, member_hook_seqcst )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, member_hook_back_off )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::empty back_off;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, member_hook_stat )
+ {
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_common::less< member_item > less;
+ typedef cds::intrusive::michael_list::stat<> stat;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_HP, member_hook_wrapped_stat )
+ {
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef cds::intrusive::michael_list::wrapped_stat<> stat;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ cds::intrusive::michael_list::stat<> st;
+ list_type l( st );
+ test_common( l );
+ test_ordered_iterator( l );
+ test_hp( l );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_list_nogc.h"
+#include <cds/intrusive/michael_list_nogc.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::nogc gc_type;
+
+ class IntrusiveMichaelList_NOGC : public cds_test::intrusive_list_nogc
+ {
+ public:
+ typedef cds_test::intrusive_list_nogc::base_item< ci::michael_list::node< gc_type>> base_item;
+ typedef cds_test::intrusive_list_nogc::member_item< ci::michael_list::node< gc_type>> member_item;
+ };
+
+ TEST_F( IntrusiveMichaelList_NOGC, base_hook )
+ {
+ typedef ci::MichaelList< gc_type, base_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, base_hook_cmp )
+ {
+ typedef ci::MichaelList< gc_type, base_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
+ , ci::opt::disposer< mock_disposer >
+ , cds::opt::compare< cmp< base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, base_hook_item_counting )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_nogc::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, base_hook_backoff )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_nogc::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, base_hook_seqcst )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< base_item > compare;
+ typedef intrusive_list_nogc::less< base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::MichaelList< gc_type, base_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, member_hook )
+ {
+ typedef ci::MichaelList< gc_type, member_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::less< less< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, member_hook_cmp )
+ {
+ typedef ci::MichaelList< gc_type, member_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
+ ,ci::opt::disposer< mock_disposer >
+ ,cds::opt::compare< cmp< member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, member_hook_item_counting )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_nogc::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, member_hook_seqcst )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_nogc::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+ TEST_F( IntrusiveMichaelList_NOGC, member_hook_back_off )
+ {
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
+ typedef mock_disposer disposer;
+ typedef cmp< member_item > compare;
+ typedef intrusive_list_nogc::less< member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::empty back_off;
+ };
+ typedef ci::MichaelList< gc_type, member_item, traits > list_type;
+
+ list_type l;
+ test_common( l );
+ test_ordered_iterator( l );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/general_buffered.h>
+
+#include "test_intrusive_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_buffered<> rcu_implementation;
+ typedef cds::urcu::general_buffered_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveMichaelList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
--- /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 <cds/urcu/general_instant.h>
+
+#include "test_intrusive_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_instant<> rcu_implementation;
+ typedef cds::urcu::general_instant_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveMichaelList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
--- /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 <cds/urcu/general_threaded.h>
+
+#include "test_intrusive_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_threaded<> rcu_implementation;
+ typedef cds::urcu::general_threaded_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveMichaelList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
--- /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 <cds/urcu/signal_buffered.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_buffered<> rcu_implementation;
+ typedef cds::urcu::signal_buffered_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveMichaelList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
--- /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 <cds/urcu/signal_threaded.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_threaded<> rcu_implementation;
+ typedef cds::urcu::signal_threaded_stripped rcu_implementation_stripped;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveMichaelList, rcu_implementation );
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
--- /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_LIST_TEST_INTRUSIVE_ITERABLE_LIST_H
+#define CDSUNIT_LIST_TEST_INTRUSIVE_ITERABLE_LIST_H
+
+#include <cds_test/check_size.h>
+#include <cds_test/fixture.h>
+
+namespace cds_test {
+
+ class intrusive_iterable_list : public fixture
+ {
+ public:
+ struct stat {
+ int nDisposeCount;
+ int nUpdateExistsCall;
+ int nUpdateNewCall;
+ int nFindCall;
+ int nEraseCall;
+ int nInsertCall;
+
+ stat()
+ : nDisposeCount( 0 )
+ , nUpdateExistsCall( 0 )
+ , nUpdateNewCall( 0 )
+ , nFindCall( 0 )
+ , nEraseCall( 0 )
+ , nInsertCall( 0 )
+ {}
+
+ stat( const stat& s )
+ {
+ *this = s;
+ }
+
+ stat& operator =( const stat& s )
+ {
+ memcpy( this, &s, sizeof( s ) );
+ return *this;
+ }
+ };
+
+ struct item_type
+ {
+ int nKey;
+ int nVal;
+
+ mutable stat s;
+
+ item_type()
+ {}
+
+ item_type( int key, int val )
+ : nKey( key )
+ , nVal( val )
+ , s()
+ {}
+
+ item_type( const item_type& v )
+ : nKey( v.nKey )
+ , nVal( v.nVal )
+ , s()
+ {}
+
+ const int& key() const
+ {
+ return nKey;
+ }
+
+ item_type& operator=( item_type const& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+
+ item_type& operator=( item_type&& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+ };
+
+ 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 mock_disposer
+ {
+ template <typename T>
+ void operator ()( T * p )
+ {
+ ++p->s.nDisposeCount;
+ }
+ };
+
+ struct update_functor
+ {
+ template <typename T>
+ void operator()( T& item, T * old )
+ {
+ if ( !old )
+ ++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++;
+ }
+ };
+
+ protected:
+ template <typename List>
+ void test_common( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[ nSize ];
+ value_type arr2[ nSize ];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>( i );
+ arr[i].nVal = arr[i].nKey * 10;
+
+ arr2[i] = arr[i];
+ }
+ shuffle( arr, arr + nSize );
+ shuffle( arr2, arr2 + nSize );
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ typedef typename List::iterator iterator;
+
+ // insert / find
+ for ( auto& i : arr ) {
+ EXPECT_FALSE( l.contains( i.nKey ));
+ EXPECT_FALSE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_FALSE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 0 );
+ EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 0 );
+
+ switch ( i.nKey % 4 ) {
+ case 0:
+ EXPECT_TRUE( l.insert( i ));
+ break;
+ case 1:
+ EXPECT_EQ( i.s.nInsertCall, 0 );
+ EXPECT_TRUE( l.insert( i, []( value_type& i ) { ++i.s.nInsertCall; } ));
+ EXPECT_EQ( i.s.nInsertCall, 1 );
+ break;
+ case 2:
+ {
+ std::pair<bool, bool> ret = l.update( i, []( value_type& i, value_type * old ) {
+ EXPECT_TRUE( old == nullptr );
+ EXPECT_EQ( i.s.nUpdateNewCall, 0 );
+ ++i.s.nUpdateNewCall;
+ }, false );
+ EXPECT_EQ( i.s.nUpdateNewCall, 0 );
+ EXPECT_EQ( ret.first, false );
+ EXPECT_EQ( ret.second, false );
+
+ ret = l.update( i, []( value_type& i, value_type * old ) {
+ EXPECT_TRUE( old == nullptr );
+ EXPECT_EQ( i.s.nUpdateNewCall, 0 );
+ ++i.s.nUpdateNewCall;
+ }, true );
+ EXPECT_EQ( i.s.nUpdateNewCall, 1 );
+ EXPECT_EQ( ret.first, true );
+ EXPECT_EQ( ret.second, true );
+ }
+ break;
+ case 3:
+ {
+ std::pair<bool, bool> ret = l.upsert( i, false );
+ EXPECT_EQ( ret.first, false );
+ EXPECT_EQ( ret.second, false );
+
+ ret = l.upsert( i );
+ EXPECT_EQ( ret.first, true );
+ EXPECT_EQ( ret.second, true );
+ }
+ break;
+ }
+
+ EXPECT_TRUE( l.contains( i.nKey ));
+ EXPECT_TRUE( l.contains( i ));
+ EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 1 );
+ EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 2 );
+ EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 3 );
+
+ EXPECT_FALSE( l.insert( i ) );
+ ASSERT_FALSE( l.empty() );
+
+ int const ckey = i.nKey;
+ iterator it = l.find( ckey );
+ ASSERT_FALSE( it == l.end() );
+ EXPECT_EQ( it->nKey, i.nKey );
+ EXPECT_EQ( (*it).nVal, i.nVal );
+ check_ordered( it, l.end() );
+
+ it = l.find( i.nKey );
+ ASSERT_FALSE( it == l.end() );
+ EXPECT_EQ( it->nKey, i.nKey );
+ EXPECT_EQ( (*it).nVal, i.nVal );
+ check_ordered( it, l.end() );
+
+ it = l.find_with( other_item( i.nKey ), other_less() );
+ ASSERT_FALSE( it == l.end() );
+ EXPECT_EQ( it->nKey, i.nKey );
+ EXPECT_EQ( it->nVal, i.nVal );
+ check_ordered( it, l.end() );
+
+ }
+ ASSERT_CONTAINER_SIZE( l, nSize );
+
+ // check all items
+ for ( auto const& i : arr ) {
+ EXPECT_TRUE( l.contains( i.nKey ));
+ EXPECT_TRUE( l.contains( i ));
+ EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 4 );
+ EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 5 );
+ EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 6 );
+ }
+ ASSERT_FALSE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, nSize );
+
+ // update existing test
+ for ( auto& i : arr2 ) {
+ EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
+ std::pair<bool, bool> ret = l.update( i, update_functor() );
+ EXPECT_TRUE( ret.first );
+ EXPECT_FALSE( ret.second );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
+ }
+
+ // update with the same value must be empty - no functor is called
+ for ( auto& i : arr2 ) {
+ EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
+ std::pair<bool, bool> ret = l.update( i, update_functor() );
+ EXPECT_TRUE( ret.first );
+ EXPECT_FALSE( ret.second );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
+ }
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+
+ for ( auto& i : arr ) {
+ EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
+ std::pair<bool, bool> ret = l.update( i, []( value_type& i, value_type * old ) {
+ EXPECT_FALSE( old == nullptr );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
+ ++i.s.nUpdateExistsCall;
+ });
+ EXPECT_TRUE( ret.first );
+ EXPECT_FALSE( ret.second );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
+ }
+
+ // erase test
+ for ( auto const& i : arr ) {
+ if ( i.nKey & 1 )
+ EXPECT_TRUE( l.erase( i.nKey ));
+ else
+ EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less() ));
+
+ EXPECT_FALSE( l.contains( i ));
+ }
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+
+ for ( auto const& i : arr )
+ EXPECT_EQ( i.s.nDisposeCount, 2 );
+ for ( auto const& i : arr2 )
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+
+ // erase with functor
+ for ( auto& i : arr ) {
+ int const updateNewCall = i.s.nUpdateNewCall;
+ std::pair<bool, bool> ret = l.update( i, update_functor(), false );
+ EXPECT_FALSE( ret.first );
+ EXPECT_FALSE( ret.second );
+ EXPECT_EQ( i.s.nUpdateNewCall, updateNewCall );
+
+ ret = l.update( i, update_functor(), true );
+ EXPECT_TRUE( ret.first );
+ EXPECT_TRUE( ret.second );
+ EXPECT_EQ( i.s.nUpdateNewCall, updateNewCall + 1 );
+ }
+ EXPECT_FALSE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, nSize );
+
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nEraseCall, 0 );
+ if ( i.nKey & 1 ) {
+ EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less(), erase_functor()));
+ EXPECT_FALSE( l.erase_with( other_item( i.nKey ), other_less(), erase_functor()));
+ }
+ else {
+ EXPECT_TRUE( l.erase( i.nKey, []( value_type& item) { ++item.s.nEraseCall; } ));
+ EXPECT_FALSE( l.erase( i.nKey, []( value_type& item) { ++item.s.nEraseCall; } ));
+ }
+ EXPECT_EQ( i.s.nEraseCall, 1 );
+ EXPECT_FALSE( l.contains( i.nKey ));
+ }
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+
+ for ( auto const& i : arr )
+ EXPECT_EQ( i.s.nDisposeCount, 3 );
+
+ // clear test
+ for ( auto& i : arr )
+ EXPECT_TRUE( l.insert( i ));
+
+ EXPECT_FALSE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, nSize );
+
+ l.clear();
+
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 4 );
+ EXPECT_FALSE( l.contains( i ));
+ }
+
+ // unlink test
+ for ( auto& i : arr )
+ EXPECT_TRUE( l.insert( i ) );
+ for ( auto& i : arr ) {
+ value_type val( i );
+ EXPECT_TRUE( l.contains( val ));
+ EXPECT_FALSE( l.unlink( val ));
+ EXPECT_TRUE( l.contains( val ) );
+ EXPECT_TRUE( l.unlink( i ));
+ EXPECT_FALSE( l.unlink( i ));
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 5 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+
+ // Iterators on empty list
+ {
+ auto it = l.begin();
+ auto itEnd = l.end();
+ auto cit = l.cbegin();
+ auto citEnd = l.cend();
+
+ EXPECT_TRUE( it == itEnd );
+ EXPECT_TRUE( it == cit );
+ EXPECT_TRUE( cit == citEnd );
+
+ ++it;
+ ++cit;
+
+ EXPECT_TRUE( it == itEnd );
+ EXPECT_TRUE( it == cit );
+ EXPECT_TRUE( cit == citEnd );
+ }
+ }
+
+ template <typename List>
+ void test_ordered_iterator( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[nSize];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>(i);
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ for ( auto& i : arr )
+ EXPECT_TRUE( l.insert( i ) );
+
+ int key = 0;
+ for ( auto it = l.begin(); it != l.end(); ++it ) {
+ EXPECT_EQ( it->nKey, key );
+ EXPECT_EQ( (*it).nKey, key );
+ ++key;
+ }
+
+ key = 0;
+ for ( auto it = l.cbegin(); it != l.cend(); ++it ) {
+ EXPECT_EQ( it->nKey, key );
+ EXPECT_EQ( (*it).nKey, key );
+ ++key;
+ }
+
+ l.clear();
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ }
+
+ template <typename Iterator>
+ void check_ordered( Iterator first, Iterator last )
+ {
+ while ( first != last ) {
+ Iterator it = first;
+ if ( ++it != last ) {
+ EXPECT_LT( first->nKey, it->nKey );
+ }
+ first = it;
+ }
+ }
+
+ };
+
+} // namespace cds_test
+
+#endif // CDSUNIT_LIST_TEST_INTRUSIVE_ITERABLE_LIST_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_LIST_TEST_INTRUSIVE_ITERABLE_LIST_HP_H
+#define CDSUNIT_LIST_TEST_INTRUSIVE_ITERABLE_LIST_HP_H
+
+#include "test_intrusive_iterable_list.h"
+
+namespace cds_test {
+
+ class intrusive_iterable_list_hp : public intrusive_iterable_list
+ {
+ protected:
+ template <typename List>
+ void test_hp( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[nSize];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>(i);
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ typedef typename List::guarded_ptr guarded_ptr;
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ guarded_ptr gp;
+
+ // get() test
+ for ( auto& i : arr ) {
+ gp = l.get( i.nKey );
+ EXPECT_TRUE( !gp );
+ gp = l.get_with( other_item( i.nKey ), other_less() );
+ EXPECT_TRUE( !gp );
+
+ EXPECT_TRUE( l.insert( i ) );
+
+ gp = l.get( i.nKey );
+ ASSERT_FALSE( !gp );
+ EXPECT_EQ( gp->nKey, i.nKey );
+ EXPECT_EQ( gp->nVal, i.nVal );
+ gp = l.get_with( other_item( i.nKey ), other_less() );
+ ASSERT_FALSE( !gp );
+ EXPECT_EQ( gp->nKey, i.nKey );
+ EXPECT_EQ( gp->nVal, i.nVal );
+ }
+
+ // extract() test
+ for ( int i = 0; i < static_cast<int>(nSize); ++i ) {
+ if ( i & 1 )
+ gp = l.extract( i );
+ else
+ gp = l.extract_with( other_item( i ), other_less() );
+ ASSERT_FALSE( !gp );
+ EXPECT_EQ( gp->nKey, i );
+
+ gp = l.extract( i );
+ EXPECT_TRUE( !gp );
+ gp = l.extract_with( other_item( i ), other_less() );
+ EXPECT_TRUE( !gp );
+ }
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ }
+ };
+
+} // namespace cds_test
+
+#endif // CDSUNIT_LIST_TEST_INTRUSIVE_ITERABLE_LIST_HP_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_LIST_TEST_INTRUSIVE_LAZY_LIST_RCU_H
+#define CDSUNIT_LIST_TEST_INTRUSIVE_LAZY_LIST_RCU_H
+
+#include "test_intrusive_list_rcu.h"
+#include <cds/intrusive/lazy_list_rcu.h>
+
+namespace ci = cds::intrusive;
+
+template <class RCU>
+class IntrusiveLazyList : public cds_test::intrusive_list_rcu
+{
+ typedef cds_test::intrusive_list_rcu base_class;
+public:
+ typedef cds::urcu::gc<RCU> rcu_type;
+ typedef typename base_class::base_item< ci::lazy_list::node< rcu_type >> base_item;
+ typedef typename base_class::member_item< ci::lazy_list::node< rcu_type >> member_item;
+
+protected:
+ void SetUp()
+ {
+ RCU::Construct();
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ RCU::Destruct();
+ }
+};
+
+TYPED_TEST_CASE_P( IntrusiveLazyList );
+
+TYPED_TEST_P( IntrusiveLazyList, base_hook )
+{
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >>>
+ , ci::opt::disposer< typename TestFixture::mock_disposer >
+ , cds::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, base_hook_cmp )
+{
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >>>
+ , ci::opt::disposer< typename TestFixture::mock_disposer >
+ , cds::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, base_hook_item_counting )
+{
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, base_hook_backoff )
+{
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, base_hook_seqcst )
+{
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, base_hook_stat )
+{
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::stat<> stat;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, base_hook_wrapped_stat )
+{
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ cds::intrusive::lazy_list::stat<> st;
+ list_type l( st );
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, member_hook )
+{
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >>>
+ ,ci::opt::disposer< typename TestFixture::mock_disposer >
+ ,cds::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, member_hook_cmp )
+{
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item,
+ typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >>>
+ ,ci::opt::disposer< typename TestFixture::mock_disposer >
+ ,cds::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, member_hook_item_counting )
+{
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, member_hook_seqcst )
+{
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template less< typename TestFixture::member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, member_hook_back_off )
+{
+ struct traits : public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::empty back_off;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, member_hook_stat )
+{
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::stat<> stat;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveLazyList, member_hook_wrapped_stat )
+{
+ struct traits: public ci::lazy_list::traits {
+ typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
+ };
+ typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ cds::intrusive::lazy_list::stat<> st;
+ list_type l( st );
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+// GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as
+// "No test named <test_name> can be found in this test case"
+REGISTER_TYPED_TEST_CASE_P( IntrusiveLazyList,
+ base_hook, base_hook_cmp, base_hook_item_counting, base_hook_backoff, base_hook_seqcst, base_hook_stat, base_hook_wrapped_stat, member_hook, member_hook_cmp, member_hook_item_counting, member_hook_seqcst, member_hook_back_off, member_hook_stat, member_hook_wrapped_stat
+);
+
+
+#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LAZY_LIST_RCU_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_LIST_TEST_INTRUSIVE_LIST_H
+#define CDSUNIT_LIST_TEST_INTRUSIVE_LIST_H
+
+#include <cds_test/check_size.h>
+#include <cds_test/fixture.h>
+
+namespace cds_test {
+
+ class intrusive_list_common : public fixture
+ {
+ public:
+ struct stat {
+ int nDisposeCount;
+ int nUpdateExistsCall;
+ int nUpdateNewCall;
+ int nFindCall;
+ int nEraseCall;
+ int nInsertCall;
+
+ stat()
+ : nDisposeCount( 0 )
+ , nUpdateExistsCall( 0 )
+ , nUpdateNewCall( 0 )
+ , nFindCall( 0 )
+ , nEraseCall( 0 )
+ , nInsertCall( 0 )
+ {}
+
+ stat( const stat& s )
+ {
+ *this = s;
+ }
+
+ stat& operator =( const stat& s )
+ {
+ memcpy( this, &s, sizeof( s ) );
+ return *this;
+ }
+ };
+
+ template <typename Node>
+ struct base_item : public Node
+ {
+ int nKey;
+ int nVal;
+
+ mutable stat s;
+
+ base_item()
+ {}
+
+ base_item( int key, int val )
+ : nKey( key )
+ , nVal( val )
+ , s()
+ {}
+
+ base_item( const base_item& v )
+ : nKey( v.nKey )
+ , nVal( v.nVal )
+ , s()
+ {}
+
+ const int& key() const
+ {
+ return nKey;
+ }
+
+ base_item& operator=( base_item const& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+
+ base_item& operator=( base_item&& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+ };
+
+ template <typename Node>
+ struct member_item
+ {
+ int nKey;
+ int nVal;
+ Node hMember;
+ mutable stat s;
+
+ member_item()
+ {}
+
+ member_item( int key, int val )
+ : nKey( key )
+ , nVal( val )
+ , s()
+ {}
+
+ member_item( const member_item& v )
+ : nKey( v.nKey )
+ , nVal( v.nVal )
+ , s()
+ {}
+
+ const int& key() const
+ {
+ return nKey;
+ }
+
+ member_item& operator =( member_item const& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+
+ member_item& operator=( member_item&& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+ };
+
+ 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 mock_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++;
+ }
+ };
+
+ protected:
+ template <typename List>
+ void test_common( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[ nSize ];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>( i );
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ // insert / find
+ for ( auto& i : arr ) {
+ EXPECT_FALSE( l.contains( i.nKey ));
+ EXPECT_FALSE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_FALSE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 0 );
+ EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 0 );
+
+ if ( i.nKey & 1 )
+ EXPECT_TRUE( l.insert( i ));
+ else {
+ EXPECT_EQ( i.s.nInsertCall, 0 );
+ EXPECT_TRUE( l.insert( i, []( value_type& i ) { ++i.s.nInsertCall; } ));
+ EXPECT_EQ( i.s.nInsertCall, 1 );
+ }
+
+ EXPECT_TRUE( l.contains( i.nKey ));
+ EXPECT_TRUE( l.contains( i ));
+ EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 1 );
+ EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 2 );
+ EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 3 );
+
+ EXPECT_FALSE( l.insert( i ) );
+ ASSERT_FALSE( l.empty() );
+ }
+ ASSERT_CONTAINER_SIZE( l, nSize );
+
+ // check all items
+ for ( auto const& i : arr ) {
+ EXPECT_TRUE( l.contains( i.nKey ));
+ EXPECT_TRUE( l.contains( i ));
+ EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 4 );
+ EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 5 );
+ EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 6 );
+ }
+ ASSERT_FALSE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, nSize );
+
+ // update existing test
+ for ( auto& i : arr ) {
+ EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
+ std::pair<bool, bool> ret = l.update( i, update_functor() );
+ EXPECT_TRUE( ret.first );
+ EXPECT_FALSE( ret.second );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
+
+ ret = l.update( i, []( bool bNew, value_type& i, value_type& arg ) {
+ EXPECT_FALSE( bNew );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
+ EXPECT_TRUE( &i == &arg );
+ ++i.s.nUpdateExistsCall;
+ });
+ EXPECT_TRUE( ret.first );
+ EXPECT_FALSE( ret.second );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 2 );
+ }
+
+ // erase test
+ for ( auto const& i : arr ) {
+ if ( i.nKey & 1 )
+ EXPECT_TRUE( l.erase( i.nKey ));
+ else
+ EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less() ));
+
+ EXPECT_FALSE( l.contains( i ));
+ }
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+
+ for ( auto const& i : arr )
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+
+ // erase with functor
+ for ( auto& i : arr ) {
+ std::pair<bool, bool> ret = l.update( i, update_functor(), false );
+ EXPECT_FALSE( ret.first );
+ EXPECT_FALSE( ret.second );
+
+ ret = l.update( i, update_functor(), true );
+ EXPECT_TRUE( ret.first );
+ EXPECT_TRUE( ret.second );
+ EXPECT_EQ( i.s.nUpdateNewCall, 1 );
+ }
+ EXPECT_FALSE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, nSize );
+
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nEraseCall, 0 );
+ if ( i.nKey & 1 ) {
+ EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less(), erase_functor()));
+ EXPECT_FALSE( l.erase_with( other_item( i.nKey ), other_less(), erase_functor()));
+ }
+ else {
+ EXPECT_TRUE( l.erase( i.nKey, []( value_type& item) { ++item.s.nEraseCall; } ));
+ EXPECT_FALSE( l.erase( i.nKey, []( value_type& item) { ++item.s.nEraseCall; } ));
+ }
+ EXPECT_EQ( i.s.nEraseCall, 1 );
+ EXPECT_FALSE( l.contains( i.nKey ));
+ }
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+
+ for ( auto const& i : arr )
+ EXPECT_EQ( i.s.nDisposeCount, 2 );
+
+ // clear test
+ for ( auto& i : arr )
+ EXPECT_TRUE( l.insert( i ));
+
+ EXPECT_FALSE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, nSize );
+
+ l.clear();
+
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 3 );
+ EXPECT_FALSE( l.contains( i ));
+ }
+
+ // unlink test
+ for ( auto& i : arr )
+ EXPECT_TRUE( l.insert( i ) );
+ for ( auto& i : arr ) {
+ value_type val( i );
+ EXPECT_TRUE( l.contains( val ));
+ EXPECT_FALSE( l.unlink( val ));
+ EXPECT_TRUE( l.contains( val ) );
+ EXPECT_TRUE( l.unlink( i ));
+ EXPECT_FALSE( l.unlink( i ));
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 4 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+
+ // Iterators on empty list
+ {
+ auto it = l.begin();
+ auto itEnd = l.end();
+ auto cit = l.cbegin();
+ auto citEnd = l.cend();
+
+ EXPECT_TRUE( it == itEnd );
+ EXPECT_TRUE( it == cit );
+ EXPECT_TRUE( cit == citEnd );
+
+ ++it;
+ ++cit;
+
+ EXPECT_TRUE( it == itEnd );
+ EXPECT_TRUE( it == cit );
+ EXPECT_TRUE( cit == citEnd );
+ }
+ }
+
+ template <typename List>
+ void test_ordered_iterator( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[nSize];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>(i);
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ for ( auto& i : arr )
+ EXPECT_TRUE( l.insert( i ) );
+
+ int key = 0;
+ for ( auto it = l.begin(); it != l.end(); ++it ) {
+ EXPECT_EQ( it->nKey, key );
+ EXPECT_EQ( (*it).nKey, key );
+ ++key;
+ }
+
+ key = 0;
+ for ( auto it = l.cbegin(); it != l.cend(); ++it ) {
+ EXPECT_EQ( it->nKey, key );
+ EXPECT_EQ( (*it).nKey, key );
+ ++key;
+ }
+
+ l.clear();
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ }
+ };
+
+} // namespace cds_test
+
+#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_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_LIST_TEST_INTRUSIVE_LIST_HP_H
+#define CDSUNIT_LIST_TEST_INTRUSIVE_LIST_HP_H
+
+#include "test_intrusive_list.h"
+
+namespace cds_test {
+
+ class intrusive_list_hp : public intrusive_list_common
+ {
+ protected:
+ template <typename List>
+ void test_hp( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[ nSize ];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>( i );
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ typedef typename List::guarded_ptr guarded_ptr;
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ guarded_ptr gp;
+
+ // get() test
+ for ( auto& i : arr ) {
+ gp = l.get( i.nKey );
+ EXPECT_TRUE( !gp );
+ gp = l.get_with( other_item( i.nKey ), other_less());
+ EXPECT_TRUE( !gp );
+
+ EXPECT_TRUE( l.insert( i ));
+
+ gp = l.get( i.nKey );
+ ASSERT_FALSE( !gp );
+ EXPECT_EQ( gp->nKey, i.nKey );
+ EXPECT_EQ( gp->nVal, i.nVal );
+ gp = l.get_with( other_item( i.nKey ), other_less() );
+ ASSERT_FALSE( !gp );
+ EXPECT_EQ( gp->nKey, i.nKey );
+ EXPECT_EQ( gp->nVal, i.nVal );
+ }
+
+ // extract() test
+ for ( int i = 0; i < static_cast<int>(nSize); ++i ) {
+ if ( i & 1 )
+ gp = l.extract( i );
+ else
+ gp = l.extract_with( other_item(i), other_less());
+ ASSERT_FALSE( !gp );
+ EXPECT_EQ( gp->nKey, i );
+
+ gp = l.extract( i );
+ EXPECT_TRUE( !gp );
+ gp = l.extract_with( other_item( i ), other_less() );
+ EXPECT_TRUE( !gp );
+ }
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ }
+ };
+
+} // namespace cds_test
+
+#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_HP_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_LIST_TEST_INTRUSIVE_LIST_NOGC_H
+#define CDSUNIT_LIST_TEST_INTRUSIVE_LIST_NOGC_H
+
+#include <cds_test/check_size.h>
+#include <cds_test/fixture.h>
+
+namespace cds_test {
+
+ class intrusive_list_nogc : public fixture
+ {
+ public:
+ struct stat {
+ int nDisposeCount;
+ int nUpdateExistsCall;
+ int nUpdateNewCall;
+ int nFindCall;
+
+ stat()
+ : nDisposeCount( 0 )
+ , nUpdateExistsCall( 0 )
+ , nUpdateNewCall( 0 )
+ , nFindCall( 0 )
+ {}
+
+ stat( const stat& s )
+ {
+ *this = s;
+ }
+
+ stat& operator =( const stat& s )
+ {
+ memcpy( this, &s, sizeof( s ) );
+ return *this;
+ }
+ };
+
+ template <typename Node>
+ struct base_item : public Node
+ {
+ int nKey;
+ int nVal;
+
+ mutable stat s;
+
+ base_item()
+ {}
+
+ base_item( int key, int val )
+ : nKey( key )
+ , nVal( val )
+ , s()
+ {}
+
+ base_item( const base_item& v )
+ : nKey( v.nKey )
+ , nVal( v.nVal )
+ , s()
+ {}
+
+ const int& key() const
+ {
+ return nKey;
+ }
+
+ base_item& operator=( base_item const& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+
+ base_item& operator=( base_item&& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+ };
+
+ template <typename Node>
+ struct member_item
+ {
+ int nKey;
+ int nVal;
+ Node hMember;
+ mutable stat s;
+
+ member_item()
+ {}
+
+ member_item( int key, int val )
+ : nKey( key )
+ , nVal( val )
+ , s()
+ {}
+
+ member_item( const member_item& v )
+ : nKey( v.nKey )
+ , nVal( v.nVal )
+ , s()
+ {}
+
+ const int& key() const
+ {
+ return nKey;
+ }
+
+ member_item& operator =( member_item const& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+
+ member_item& operator=( member_item&& src )
+ {
+ nKey = src.nKey;
+ nVal = src.nVal;
+ return *this;
+ }
+ };
+
+ 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 mock_disposer
+ {
+ template <typename T>
+ void operator ()( T * p )
+ {
+ ++p->s.nDisposeCount;
+ }
+ };
+
+ struct mock_disposer2
+ {
+ template <typename T>
+ void operator ()( T * p )
+ {
+ p->s.nDisposeCount += 10;
+ }
+ };
+
+ 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++;
+ }
+ };
+
+ protected:
+ template <typename List>
+ void test_common( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[ nSize ];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>( i );
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ // insert / find
+ for ( auto& i : arr ) {
+ EXPECT_FALSE( l.contains( i.nKey ));
+ EXPECT_FALSE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_FALSE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 0 );
+ EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 0 );
+
+ EXPECT_TRUE( l.insert( i ));
+
+ EXPECT_TRUE( l.contains( i.nKey ));
+ EXPECT_TRUE( l.contains( i ));
+ EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 1 );
+ EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 2 );
+ EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 3 );
+
+ EXPECT_FALSE( l.insert( i ) );
+ ASSERT_FALSE( l.empty() );
+ }
+ ASSERT_CONTAINER_SIZE( l, nSize );
+
+ // check all items
+ for ( auto const& i : arr ) {
+ EXPECT_TRUE( l.contains( i.nKey ));
+ EXPECT_TRUE( l.contains( i ));
+ EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
+ EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 4 );
+ EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 5 );
+ EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
+ EXPECT_EQ( i.s.nFindCall, 6 );
+ }
+ ASSERT_FALSE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, nSize );
+
+ // update existing test
+ for ( auto& i : arr ) {
+ EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
+ std::pair<bool, bool> ret = l.update( i, update_functor() );
+ EXPECT_TRUE( ret.first );
+ EXPECT_FALSE( ret.second );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
+
+ ret = l.update( i, []( bool bNew, value_type& i, value_type& arg ) {
+ EXPECT_FALSE( bNew );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
+ EXPECT_TRUE( &i == &arg );
+ ++i.s.nUpdateExistsCall;
+ });
+ EXPECT_TRUE( ret.first );
+ EXPECT_FALSE( ret.second );
+ EXPECT_EQ( i.s.nUpdateExistsCall, 2 );
+ }
+
+ // clear() test
+ l.clear();
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+
+
+ for ( auto& i : arr ) {
+ std::pair<bool, bool> ret = l.update( i, update_functor(), false );
+ EXPECT_FALSE( ret.first );
+ EXPECT_FALSE( ret.second );
+
+ ret = l.update( i, update_functor(), true );
+ EXPECT_TRUE( ret.first );
+ EXPECT_TRUE( ret.second );
+ EXPECT_EQ( i.s.nUpdateNewCall, 1 );
+ }
+
+ EXPECT_FALSE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, nSize );
+
+ l.clear( mock_disposer2());
+
+ EXPECT_TRUE( l.empty() );
+ EXPECT_CONTAINER_SIZE( l, 0 );
+
+ // Apply retired pointer to clean links
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 11 );
+ EXPECT_FALSE( l.contains( i ));
+ }
+
+ // Iterators on empty list
+ {
+ auto it = l.begin();
+ auto itEnd = l.end();
+ auto cit = l.cbegin();
+ auto citEnd = l.cend();
+
+ EXPECT_TRUE( it == itEnd );
+ EXPECT_TRUE( it == cit );
+ EXPECT_TRUE( cit == citEnd );
+
+ ++it;
+ ++cit;
+
+ EXPECT_TRUE( it == itEnd );
+ EXPECT_TRUE( it == cit );
+ EXPECT_TRUE( cit == citEnd );
+ }
+ }
+
+ template <typename List>
+ void test_ordered_iterator( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[nSize];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>(i);
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ for ( auto& i : arr )
+ EXPECT_TRUE( l.insert( i ) );
+
+ int key = 0;
+ for ( auto it = l.begin(); it != l.end(); ++it ) {
+ EXPECT_EQ( it->nKey, key );
+ EXPECT_EQ( (*it).nKey, key );
+ ++key;
+ }
+
+ key = 0;
+ for ( auto it = l.cbegin(); it != l.cend(); ++it ) {
+ EXPECT_EQ( it->nKey, key );
+ EXPECT_EQ( (*it).nKey, key );
+ ++key;
+ }
+
+ l.clear();
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ }
+
+ template <typename List>
+ void test_unordered_iterator( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[nSize];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>(i);
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ for ( auto& i : arr )
+ EXPECT_TRUE( l.insert( i ) );
+
+ size_t idx = 0;
+ for ( auto it = l.begin(); it != l.end(); ++it, ++idx ) {
+ ASSERT_LT( idx, nSize );
+ EXPECT_EQ( it->nKey, arr[idx].nKey );
+ EXPECT_EQ( (*it).nKey, arr[idx].nKey );
+ }
+
+ idx = 0;
+ for ( auto it = l.cbegin(); it != l.cend(); ++it, ++idx ) {
+ ASSERT_LT( idx, nSize );
+ EXPECT_EQ( it->nKey, arr[idx].nKey );
+ EXPECT_EQ( (*it).nKey, arr[idx].nKey );
+ }
+
+ l.clear();
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ }
+ };
+
+} // namespace cds_test
+
+#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_NOGC_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_LIST_TEST_INTRUSIVE_LIST_RCU_H
+#define CDSUNIT_LIST_TEST_INTRUSIVE_LIST_RCU_H
+
+#include "test_intrusive_list.h"
+
+namespace cds_test {
+
+ class intrusive_list_rcu : public intrusive_list_common
+ {
+ protected:
+ template <typename List>
+ void test_rcu( List& l )
+ {
+ // Precondition: list is empty
+ // Postcondition: list is empty
+
+ static const size_t nSize = 20;
+ typedef typename List::value_type value_type;
+ value_type arr[ nSize ];
+
+ for ( size_t i = 0; i < nSize; ++i ) {
+ arr[i].nKey = static_cast<int>( i );
+ arr[i].nVal = arr[i].nKey * 10;
+ }
+ shuffle( arr, arr + nSize );
+
+ typedef typename List::exempt_ptr exempt_ptr;
+ typedef typename List::raw_ptr raw_ptr;
+ typedef typename List::rcu_lock rcu_lock;
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ // get() test
+ for ( auto& i : arr ) {
+ {
+ rcu_lock lock;
+ raw_ptr rp = l.get( i.nKey );
+ EXPECT_TRUE( !rp );
+ rp = l.get_with( other_item( i.nKey ), other_less());
+ EXPECT_TRUE( !rp );
+ }
+
+ EXPECT_TRUE( l.insert( i ));
+
+ {
+ rcu_lock lock;
+ raw_ptr rp = l.get( i.nKey );
+ ASSERT_FALSE( !rp );
+ EXPECT_EQ( rp->nKey, i.nKey );
+ EXPECT_EQ( rp->nVal, i.nVal );
+ }
+ {
+ rcu_lock lock;
+ raw_ptr rp = l.get_with( other_item( i.nKey ), other_less() );
+ ASSERT_FALSE( !rp );
+ EXPECT_EQ( rp->nKey, i.nKey );
+ EXPECT_EQ( rp->nVal, i.nVal );
+ }
+ }
+
+ exempt_ptr gp;
+
+ // extract() test
+ if ( List::c_bExtractLockExternal ) {
+ for ( int i = 0; i < static_cast<int>(nSize); ++i ) {
+ {
+ rcu_lock lock;
+
+ if ( i & 1 )
+ gp = l.extract( i );
+ else
+ gp = l.extract_with( other_item(i), other_less());
+ ASSERT_FALSE( !gp );
+ EXPECT_EQ( gp->nKey, i );
+ }
+ gp.release();
+ {
+ rcu_lock lock;
+
+ gp = l.extract( i );
+ EXPECT_TRUE( !gp );
+ gp = l.extract_with( other_item( i ), other_less() );
+ EXPECT_TRUE( !gp );
+ }
+ }
+ }
+ else {
+ for ( int i = 0; i < static_cast<int>(nSize); ++i ) {
+ if ( i & 1 )
+ gp = l.extract( i );
+ else
+ gp = l.extract_with( other_item( i ), other_less() );
+ ASSERT_FALSE( !gp );
+ EXPECT_EQ( gp->nKey, i );
+
+ gp = l.extract( i );
+ EXPECT_TRUE( !gp );
+ gp = l.extract_with( other_item( i ), other_less() );
+ EXPECT_TRUE( !gp );
+ }
+ }
+
+ ASSERT_TRUE( l.empty() );
+ ASSERT_CONTAINER_SIZE( l, 0 );
+
+ List::gc::force_dispose();
+ for ( auto const& i : arr ) {
+ EXPECT_EQ( i.s.nDisposeCount, 1 );
+ EXPECT_FALSE( l.contains( i ) );
+ }
+ }
+ };
+
+} // namespace cds_test
+
+#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_RCU_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_LIST_TEST_INTRUSIVE_MICHAEL_LIST_RCU_H
+#define CDSUNIT_LIST_TEST_INTRUSIVE_MICHAEL_LIST_RCU_H
+
+#include "test_intrusive_list_rcu.h"
+#include <cds/intrusive/michael_list_rcu.h>
+
+namespace ci = cds::intrusive;
+
+template <class RCU>
+class IntrusiveMichaelList : public cds_test::intrusive_list_rcu
+{
+ typedef cds_test::intrusive_list_rcu base_class;
+public:
+ typedef cds::urcu::gc<RCU> rcu_type;
+ typedef typename base_class::base_item< ci::michael_list::node< rcu_type >> base_item;
+ typedef typename base_class::member_item< ci::michael_list::node< rcu_type >> member_item;
+
+protected:
+ void SetUp()
+ {
+ RCU::Construct();
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ RCU::Destruct();
+ }
+};
+
+TYPED_TEST_CASE_P( IntrusiveMichaelList );
+
+TYPED_TEST_P( IntrusiveMichaelList, base_hook )
+{
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >>>
+ , ci::opt::disposer< typename TestFixture::mock_disposer >
+ , cds::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, base_hook_cmp )
+{
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >>>
+ , ci::opt::disposer< typename TestFixture::mock_disposer >
+ , cds::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, base_hook_item_counting )
+{
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, base_hook_backoff )
+{
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::base_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::pause back_off;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, base_hook_seqcst )
+{
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, base_hook_stat )
+{
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef cds::intrusive::michael_list::stat<> stat;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, base_hook_wrapped_stat )
+{
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
+ typedef cds::intrusive::michael_list::wrapped_stat<> stat;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
+
+ cds::intrusive::michael_list::stat<> st;
+ list_type l( st );
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, member_hook )
+{
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >>>
+ ,ci::opt::disposer< typename TestFixture::mock_disposer >
+ ,cds::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, member_hook_cmp )
+{
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item,
+ typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >>>
+ ,ci::opt::disposer< typename TestFixture::mock_disposer >
+ ,cds::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>
+ >::type
+ > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, member_hook_item_counting )
+{
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, member_hook_seqcst )
+{
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template less< typename TestFixture::member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, member_hook_back_off )
+{
+ struct traits : public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
+ typedef typename TestFixture::template less< typename TestFixture::member_item > less;
+ typedef cds::atomicity::item_counter item_counter;
+ typedef cds::backoff::empty back_off;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, member_hook_stat )
+{
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
+ typedef cds::intrusive::michael_list::stat<> stat;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ list_type l;
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+TYPED_TEST_P( IntrusiveMichaelList, member_hook_wrapped_stat )
+{
+ struct traits: public ci::michael_list::traits {
+ typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
+ typedef typename TestFixture::mock_disposer disposer;
+ typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
+ typedef cds::intrusive::michael_list::wrapped_stat<> stat;
+ };
+ typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
+
+ cds::intrusive::michael_list::stat<> st;
+ list_type l( st );
+ this->test_common( l );
+ this->test_ordered_iterator( l );
+ this->test_rcu( l );
+}
+
+
+// GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as
+// "No test named <test_name> can be found in this test case"
+REGISTER_TYPED_TEST_CASE_P( IntrusiveMichaelList,
+ base_hook, base_hook_cmp, base_hook_item_counting, base_hook_backoff, base_hook_seqcst, base_hook_stat, base_hook_wrapped_stat, member_hook, member_hook_cmp, member_hook_item_counting, member_hook_seqcst, member_hook_back_off, member_hook_stat, member_hook_wrapped_stat
+);
+
+
+#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_RCU_H
+
set(CDSGTEST_LIST_SOURCES
../main.cpp
- intrusive_iterable_dhp.cpp
- intrusive_iterable_hp.cpp
- intrusive_lazy_hp.cpp
- intrusive_lazy_dhp.cpp
- intrusive_lazy_nogc.cpp
- intrusive_lazy_rcu_gpb.cpp
- intrusive_lazy_rcu_gpi.cpp
- intrusive_lazy_rcu_gpt.cpp
- intrusive_lazy_rcu_shb.cpp
- intrusive_lazy_rcu_sht.cpp
- intrusive_michael_hp.cpp
- intrusive_michael_dhp.cpp
- intrusive_michael_nogc.cpp
- intrusive_michael_rcu_gpb.cpp
- intrusive_michael_rcu_gpi.cpp
- intrusive_michael_rcu_gpt.cpp
- intrusive_michael_rcu_shb.cpp
- intrusive_michael_rcu_sht.cpp
iterable_hp.cpp
iterable_dhp.cpp
kv_iterable_hp.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.
-*/
-
-#include "test_intrusive_iterable_list_hp.h"
-#include <cds/intrusive/iterable_list_dhp.h>
-
-namespace {
- namespace ci = cds::intrusive;
- typedef cds::gc::DHP gc_type;
-
- class IntrusiveIterableList_DHP : public cds_test::intrusive_iterable_list_hp
- {
- protected:
- void SetUp()
- {
- typedef ci::IterableList< gc_type, item_type > list_type;
-
- // +1 - for guarded_ptr
- // +3 - for iterator test
- cds::gc::dhp::GarbageCollector::Construct( 16, list_type::c_nHazardPtrCount );
- cds::threading::Manager::attachThread();
- }
-
- void TearDown()
- {
- cds::threading::Manager::detachThread();
- cds::gc::dhp::GarbageCollector::Destruct();
- }
- };
-
- TEST_F( IntrusiveIterableList_DHP, less )
- {
- typedef ci::IterableList< gc_type, item_type,
- typename ci::iterable_list::make_traits<
- ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< item_type >>
- , cds::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_DHP, compare )
- {
- typedef ci::IterableList< gc_type, item_type,
- typename ci::iterable_list::make_traits<
- ci::opt::disposer< mock_disposer >
- , cds::opt::compare< cmp< item_type >>
- , cds::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_DHP, item_counting )
- {
- struct traits : public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef cmp< item_type > compare;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_DHP, backoff )
- {
- struct traits : public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef cmp< item_type > compare;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_DHP, seqcst )
- {
- struct traits : public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_DHP, stat )
- {
- struct traits: public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::iterable_list::stat<> stat;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_DHP, wrapped_stat )
- {
- struct traits: public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::iterable_list::wrapped_stat<> stat;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- traits::stat::stat_type st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
-} // namespace
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "test_intrusive_iterable_list_hp.h"
-#include <cds/intrusive/iterable_list_hp.h>
-
-namespace {
- namespace ci = cds::intrusive;
- typedef cds::gc::HP gc_type;
-
- class IntrusiveIterableList_HP : public cds_test::intrusive_iterable_list_hp
- {
- protected:
- void SetUp()
- {
- typedef ci::IterableList< gc_type, item_type > list_type;
-
- // +1 - for guarded_ptr
- // +3 - for iterator test
- cds::gc::hp::GarbageCollector::Construct( list_type::c_nHazardPtrCount + 3, 1, 16 );
- cds::threading::Manager::attachThread();
- }
-
- void TearDown()
- {
- cds::threading::Manager::detachThread();
- cds::gc::hp::GarbageCollector::Destruct( true );
- }
- };
-
- TEST_F( IntrusiveIterableList_HP, less )
- {
- typedef ci::IterableList< gc_type, item_type,
- typename ci::iterable_list::make_traits<
- ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< item_type >>
- ,cds::opt::item_counter< cds::atomicity::item_counter >
-
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_HP, compare )
- {
- typedef ci::IterableList< gc_type, item_type,
- typename ci::iterable_list::make_traits<
- ci::opt::disposer< mock_disposer >
- , cds::opt::compare< cmp< item_type >>
- , cds::opt::item_counter< cds::atomicity::item_counter >
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_HP, item_counting )
- {
- struct traits : public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef cmp< item_type > compare;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_HP, backoff )
- {
- struct traits : public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef cmp< item_type > compare;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_HP, seqcst )
- {
- struct traits : public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_HP, stat )
- {
- struct traits: public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::iterable_list::stat<> stat;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveIterableList_HP, wrapped_stat )
- {
- struct traits: public ci::iterable_list::traits {
- typedef mock_disposer disposer;
- typedef intrusive_iterable_list::less< item_type > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::iterable_list::wrapped_stat<> stat;
- };
- typedef ci::IterableList< gc_type, item_type, traits > list_type;
-
- traits::stat::stat_type st;
-
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
-} // namespace
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "test_intrusive_list_hp.h"
-#include <cds/intrusive/lazy_list_dhp.h>
-
-namespace {
- namespace ci = cds::intrusive;
- typedef cds::gc::DHP gc_type;
-
- class IntrusiveLazyList_DHP : public cds_test::intrusive_list_hp
- {
- public:
- typedef cds_test::intrusive_list_hp::base_item< ci::lazy_list::node< gc_type>> base_item;
- typedef cds_test::intrusive_list_hp::member_item< ci::lazy_list::node< gc_type>> member_item;
-
- typedef cds_test::intrusive_list_hp::base_item< ci::lazy_list::node< gc_type, std::mutex>> base_mutex_item;
- typedef cds_test::intrusive_list_hp::member_item< ci::lazy_list::node< gc_type, std::mutex>> member_mutex_item;
-
- protected:
- void SetUp()
- {
- struct traits: public ci::lazy_list::traits
- {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- cds::gc::dhp::GarbageCollector::Construct( 16, list_type::c_nHazardPtrCount );
- cds::threading::Manager::attachThread();
- }
-
- void TearDown()
- {
- cds::threading::Manager::detachThread();
- cds::gc::dhp::GarbageCollector::Destruct();
- }
- };
-
- TEST_F( IntrusiveLazyList_DHP, base_hook )
- {
- typedef ci::LazyList< gc_type, base_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, base_hook_cmp )
- {
- typedef ci::LazyList< gc_type, base_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
- , ci::opt::disposer< mock_disposer >
- , cds::opt::compare< cmp< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, base_hook_item_counting )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, base_hook_mutex )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex>> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_mutex_item > compare;
- typedef intrusive_list_common::less< base_mutex_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, base_mutex_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, base_hook_backoff )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, base_hook_seqcst )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, base_hook_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::stat<> stat;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, base_hook_wrapped_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- cds::intrusive::lazy_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, member_hook )
- {
- typedef ci::LazyList< gc_type, member_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, member_hook_cmp )
- {
- typedef ci::LazyList< gc_type, member_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::compare< cmp< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, member_hook_item_counting )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, member_hook_seqcst )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, member_hook_mutex )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_mutex_item, hMember ), cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_mutex_item > compare;
- typedef intrusive_list_common::less< member_mutex_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, member_mutex_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, member_hook_back_off )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::empty back_off;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, member_hook_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::stat<> stat;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_DHP, member_hook_wrapped_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- cds::intrusive::lazy_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
-} // namespace
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "test_intrusive_list_hp.h"
-#include <cds/intrusive/lazy_list_hp.h>
-
-namespace {
- namespace ci = cds::intrusive;
- typedef cds::gc::HP gc_type;
-
- class IntrusiveLazyList_HP : public cds_test::intrusive_list_hp
- {
- public:
- typedef cds_test::intrusive_list_hp::base_item< ci::lazy_list::node< gc_type>> base_item;
- typedef cds_test::intrusive_list_hp::member_item< ci::lazy_list::node< gc_type>> member_item;
-
- typedef cds_test::intrusive_list_hp::base_item< ci::lazy_list::node< gc_type, std::mutex>> base_mutex_item;
- typedef cds_test::intrusive_list_hp::member_item< ci::lazy_list::node< gc_type, std::mutex>> member_mutex_item;
-
- protected:
- void SetUp()
- {
- struct traits: public ci::lazy_list::traits
- {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- // +1 - for guarded_ptr
- cds::gc::hp::GarbageCollector::Construct( list_type::c_nHazardPtrCount + 1, 1, 16 );
- cds::threading::Manager::attachThread();
- }
-
- void TearDown()
- {
- cds::threading::Manager::detachThread();
- cds::gc::hp::GarbageCollector::Destruct( true );
- }
- };
-
- TEST_F( IntrusiveLazyList_HP, base_hook )
- {
- typedef ci::LazyList< gc_type, base_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, base_hook_cmp )
- {
- typedef ci::LazyList< gc_type, base_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
- , ci::opt::disposer< mock_disposer >
- , cds::opt::compare< cmp< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, base_hook_item_counting )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, base_hook_mutex )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex>> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_mutex_item > compare;
- typedef intrusive_list_common::less< base_mutex_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, base_mutex_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, base_hook_backoff )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, base_hook_seqcst )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, base_hook_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::stat<> stat;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, base_hook_wrapped_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- cds::intrusive::lazy_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, member_hook )
- {
- typedef ci::LazyList< gc_type, member_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, member_hook_cmp )
- {
- typedef ci::LazyList< gc_type, member_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::compare< cmp< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, member_hook_item_counting )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, member_hook_seqcst )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, member_hook_mutex )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_mutex_item, hMember ), cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_mutex_item > compare;
- typedef intrusive_list_common::less< member_mutex_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, member_mutex_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, member_hook_back_off )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::empty back_off;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, member_hook_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::stat<> stat;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveLazyList_HP, member_hook_wrapped_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- cds::intrusive::lazy_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
-} // namespace
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "test_intrusive_list_nogc.h"
-#include <cds/intrusive/lazy_list_nogc.h>
-
-namespace {
- namespace ci = cds::intrusive;
- typedef cds::gc::nogc gc_type;
-
- class IntrusiveLazyList_NOGC : public cds_test::intrusive_list_nogc
- {
- public:
- typedef cds_test::intrusive_list_nogc::base_item< ci::lazy_list::node< gc_type>> base_item;
- typedef cds_test::intrusive_list_nogc::member_item< ci::lazy_list::node< gc_type>> member_item;
-
- typedef cds_test::intrusive_list_nogc::base_item< ci::lazy_list::node< gc_type, std::mutex>> base_mutex_item;
- typedef cds_test::intrusive_list_nogc::member_item< ci::lazy_list::node< gc_type, std::mutex>> member_mutex_item;
- };
-
- TEST_F( IntrusiveLazyList_NOGC, base_hook )
- {
- typedef ci::LazyList< gc_type, base_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, base_hook_cmp )
- {
- typedef ci::LazyList< gc_type, base_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< gc_type >>>
- , ci::opt::disposer< mock_disposer >
- , cds::opt::compare< cmp< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, base_hook_item_counting )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_nogc::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, base_hook_mutex )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex>> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_mutex_item > compare;
- typedef intrusive_list_nogc::less< base_mutex_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, base_mutex_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, base_hook_backoff )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_nogc::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, base_hook_seqcst )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_nogc::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, base_hook_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_nogc::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::stat<> stat;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, base_hook_wrapped_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_nogc::less< base_item > less;
- typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
- };
- typedef ci::LazyList< gc_type, base_item, traits > list_type;
-
- cds::intrusive::lazy_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, member_hook )
- {
- typedef ci::LazyList< gc_type, member_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, member_hook_cmp )
- {
- typedef ci::LazyList< gc_type, member_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::compare< cmp< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, member_hook_item_counting )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_nogc::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, member_hook_seqcst )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_nogc::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, member_hook_mutex )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_mutex_item, hMember ), cds::opt::gc< gc_type >, cds::opt::lock_type< std::mutex >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_mutex_item > compare;
- typedef intrusive_list_nogc::less< member_mutex_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< gc_type, member_mutex_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, member_hook_back_off )
- {
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_nogc::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::empty back_off;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, member_hook_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_nogc::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::stat<> stat;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveLazyList_NOGC, member_hook_wrapped_stat )
- {
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_nogc::less< member_item > less;
- typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
- };
- typedef ci::LazyList< gc_type, member_item, traits > list_type;
-
- cds::intrusive::lazy_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- }
-
-} // namespace
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <cds/urcu/general_buffered.h>
-
-#include "test_intrusive_lazy_rcu.h"
-
-namespace {
-
- typedef cds::urcu::general_buffered<> rcu_implementation;
- typedef cds::urcu::general_buffered_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveLazyList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB_stripped, IntrusiveLazyList, rcu_implementation_stripped );
+++ /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 <cds/urcu/general_instant.h>
-
-#include "test_intrusive_lazy_rcu.h"
-
-namespace {
-
- typedef cds::urcu::general_instant<> rcu_implementation;
- typedef cds::urcu::general_instant_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveLazyList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI_stripped, IntrusiveLazyList, rcu_implementation_stripped );
+++ /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 <cds/urcu/general_threaded.h>
-
-#include "test_intrusive_lazy_rcu.h"
-
-namespace {
-
- typedef cds::urcu::general_threaded<> rcu_implementation;
- typedef cds::urcu::general_threaded_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveLazyList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT_stripped, IntrusiveLazyList, rcu_implementation_stripped );
+++ /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 <cds/urcu/signal_buffered.h>
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-
-#include "test_intrusive_lazy_rcu.h"
-
-namespace {
-
- typedef cds::urcu::signal_buffered<> rcu_implementation;
- typedef cds::urcu::signal_buffered_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveLazyList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB_stripped, IntrusiveLazyList, rcu_implementation_stripped );
-
-#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+++ /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 <cds/urcu/signal_threaded.h>
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-
-#include "test_intrusive_lazy_rcu.h"
-
-namespace {
-
- typedef cds::urcu::signal_threaded<> rcu_implementation;
- typedef cds::urcu::signal_threaded_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveLazyList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT_stripped, IntrusiveLazyList, rcu_implementation_stripped );
-
-#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+++ /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 "test_intrusive_list_hp.h"
-#include <cds/intrusive/michael_list_dhp.h>
-
-namespace {
- namespace ci = cds::intrusive;
- typedef cds::gc::DHP gc_type;
-
- class IntrusiveMichaelList_DHP : public cds_test::intrusive_list_hp
- {
- public:
- typedef cds_test::intrusive_list_hp::base_item< ci::michael_list::node< gc_type>> base_item;
- typedef cds_test::intrusive_list_hp::member_item< ci::michael_list::node< gc_type>> member_item;
-
- protected:
- void SetUp()
- {
- struct traits: public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- cds::gc::dhp::GarbageCollector::Construct( 16, list_type::c_nHazardPtrCount );
- cds::threading::Manager::attachThread();
- }
-
- void TearDown()
- {
- cds::threading::Manager::detachThread();
- cds::gc::dhp::GarbageCollector::Destruct();
- }
- };
-
- TEST_F( IntrusiveMichaelList_DHP, base_hook )
- {
- typedef ci::MichaelList< gc_type, base_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, base_hook_cmp )
- {
- typedef ci::MichaelList< gc_type, base_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
- , ci::opt::disposer< mock_disposer >
- , cds::opt::compare< cmp< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, base_hook_item_counting )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, base_hook_backoff )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, base_hook_seqcst )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
- TEST_F( IntrusiveMichaelList_DHP, base_hook_stat )
- {
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::intrusive::michael_list::stat<> stat;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, base_hook_wrapped_stat )
- {
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef cds::intrusive::michael_list::wrapped_stat<> stat;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- cds::intrusive::michael_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
-
- TEST_F( IntrusiveMichaelList_DHP, member_hook )
- {
- typedef ci::MichaelList< gc_type, member_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, member_hook_cmp )
- {
- typedef ci::MichaelList< gc_type, member_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::compare< cmp< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, member_hook_item_counting )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, member_hook_seqcst )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, member_hook_back_off )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::empty back_off;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, member_hook_stat )
- {
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::intrusive::michael_list::stat<> stat;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_DHP, member_hook_wrapped_stat )
- {
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef cds::intrusive::michael_list::wrapped_stat<> stat;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- cds::intrusive::michael_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
-} // namespace
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "test_intrusive_list_hp.h"
-#include <cds/intrusive/michael_list_hp.h>
-
-namespace {
- namespace ci = cds::intrusive;
- typedef cds::gc::HP gc_type;
-
- class IntrusiveMichaelList_HP : public cds_test::intrusive_list_hp
- {
- public:
- typedef cds_test::intrusive_list_hp::base_item< ci::michael_list::node< gc_type>> base_item;
- typedef cds_test::intrusive_list_hp::member_item< ci::michael_list::node< gc_type>> member_item;
-
- protected:
- void SetUp()
- {
- struct traits: public ci::michael_list::traits
- {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- // +1 - for guarded_ptr
- cds::gc::hp::GarbageCollector::Construct( list_type::c_nHazardPtrCount + 1, 1, 16 );
- cds::threading::Manager::attachThread();
- }
-
- void TearDown()
- {
- cds::threading::Manager::detachThread();
- cds::gc::hp::GarbageCollector::Destruct( true );
- }
- };
-
- TEST_F( IntrusiveMichaelList_HP, base_hook )
- {
- typedef ci::MichaelList< gc_type, base_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, base_hook_cmp )
- {
- typedef ci::MichaelList< gc_type, base_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
- , ci::opt::disposer< mock_disposer >
- , cds::opt::compare< cmp< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, base_hook_item_counting )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, base_hook_backoff )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, base_hook_seqcst )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, base_hook_stat )
- {
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_common::less< base_item > less;
- typedef cds::intrusive::michael_list::stat<> stat;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, base_hook_wrapped_stat )
- {
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef cds::intrusive::michael_list::wrapped_stat<> stat;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- cds::intrusive::michael_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, member_hook )
- {
- typedef ci::MichaelList< gc_type, member_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, member_hook_cmp )
- {
- typedef ci::MichaelList< gc_type, member_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::compare< cmp< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, member_hook_item_counting )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, member_hook_seqcst )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, member_hook_back_off )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::empty back_off;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, member_hook_stat )
- {
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_common::less< member_item > less;
- typedef cds::intrusive::michael_list::stat<> stat;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
- TEST_F( IntrusiveMichaelList_HP, member_hook_wrapped_stat )
- {
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef cds::intrusive::michael_list::wrapped_stat<> stat;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- cds::intrusive::michael_list::stat<> st;
- list_type l( st );
- test_common( l );
- test_ordered_iterator( l );
- test_hp( l );
- }
-
-} // namespace
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "test_intrusive_list_nogc.h"
-#include <cds/intrusive/michael_list_nogc.h>
-
-namespace {
- namespace ci = cds::intrusive;
- typedef cds::gc::nogc gc_type;
-
- class IntrusiveMichaelList_NOGC : public cds_test::intrusive_list_nogc
- {
- public:
- typedef cds_test::intrusive_list_nogc::base_item< ci::michael_list::node< gc_type>> base_item;
- typedef cds_test::intrusive_list_nogc::member_item< ci::michael_list::node< gc_type>> member_item;
- };
-
- TEST_F( IntrusiveMichaelList_NOGC, base_hook )
- {
- typedef ci::MichaelList< gc_type, base_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, base_hook_cmp )
- {
- typedef ci::MichaelList< gc_type, base_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< gc_type >>>
- , ci::opt::disposer< mock_disposer >
- , cds::opt::compare< cmp< base_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, base_hook_item_counting )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_nogc::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, base_hook_backoff )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_nogc::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, base_hook_seqcst )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< base_item > compare;
- typedef intrusive_list_nogc::less< base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::MichaelList< gc_type, base_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, member_hook )
- {
- typedef ci::MichaelList< gc_type, member_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::less< less< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, member_hook_cmp )
- {
- typedef ci::MichaelList< gc_type, member_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >>>
- ,ci::opt::disposer< mock_disposer >
- ,cds::opt::compare< cmp< member_item >>
- >::type
- > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, member_hook_item_counting )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_nogc::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, member_hook_seqcst )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_nogc::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
- TEST_F( IntrusiveMichaelList_NOGC, member_hook_back_off )
- {
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( member_item, hMember ), cds::opt::gc< gc_type >> hook;
- typedef mock_disposer disposer;
- typedef cmp< member_item > compare;
- typedef intrusive_list_nogc::less< member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::empty back_off;
- };
- typedef ci::MichaelList< gc_type, member_item, traits > list_type;
-
- list_type l;
- test_common( l );
- test_ordered_iterator( l );
- }
-
-} // namespace
+++ /dev/null
-/*
- This file is a part of libcds - Concurrent Data Structures library
-
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
-
- Source code repo: http://github.com/khizmax/libcds/
- Download: http://sourceforge.net/projects/libcds/files/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <cds/urcu/general_buffered.h>
-
-#include "test_intrusive_michael_rcu.h"
-
-namespace {
-
- typedef cds::urcu::general_buffered<> rcu_implementation;
- typedef cds::urcu::general_buffered_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveMichaelList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
+++ /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 <cds/urcu/general_instant.h>
-
-#include "test_intrusive_michael_rcu.h"
-
-namespace {
-
- typedef cds::urcu::general_instant<> rcu_implementation;
- typedef cds::urcu::general_instant_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveMichaelList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
+++ /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 <cds/urcu/general_threaded.h>
-
-#include "test_intrusive_michael_rcu.h"
-
-namespace {
-
- typedef cds::urcu::general_threaded<> rcu_implementation;
- typedef cds::urcu::general_threaded_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveMichaelList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
+++ /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 <cds/urcu/signal_buffered.h>
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-
-#include "test_intrusive_michael_rcu.h"
-
-namespace {
-
- typedef cds::urcu::signal_buffered<> rcu_implementation;
- typedef cds::urcu::signal_buffered_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveMichaelList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
-
-#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+++ /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 <cds/urcu/signal_threaded.h>
-
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-
-#include "test_intrusive_michael_rcu.h"
-
-namespace {
-
- typedef cds::urcu::signal_threaded<> rcu_implementation;
- typedef cds::urcu::signal_threaded_stripped rcu_implementation_stripped;
-
-} // namespace
-
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveMichaelList, rcu_implementation );
-INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT_stripped, IntrusiveMichaelList, rcu_implementation_stripped );
-
-#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+++ /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_LIST_TEST_INTRUSIVE_ITERABLE_LIST_H
-#define CDSUNIT_LIST_TEST_INTRUSIVE_ITERABLE_LIST_H
-
-#include <cds_test/check_size.h>
-#include <cds_test/fixture.h>
-
-namespace cds_test {
-
- class intrusive_iterable_list : public fixture
- {
- public:
- struct stat {
- int nDisposeCount;
- int nUpdateExistsCall;
- int nUpdateNewCall;
- int nFindCall;
- int nEraseCall;
- int nInsertCall;
-
- stat()
- : nDisposeCount( 0 )
- , nUpdateExistsCall( 0 )
- , nUpdateNewCall( 0 )
- , nFindCall( 0 )
- , nEraseCall( 0 )
- , nInsertCall( 0 )
- {}
-
- stat( const stat& s )
- {
- *this = s;
- }
-
- stat& operator =( const stat& s )
- {
- memcpy( this, &s, sizeof( s ) );
- return *this;
- }
- };
-
- struct item_type
- {
- int nKey;
- int nVal;
-
- mutable stat s;
-
- item_type()
- {}
-
- item_type( int key, int val )
- : nKey( key )
- , nVal( val )
- , s()
- {}
-
- item_type( const item_type& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
-
- item_type& operator=( item_type const& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
-
- item_type& operator=( item_type&& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
- };
-
- 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 mock_disposer
- {
- template <typename T>
- void operator ()( T * p )
- {
- ++p->s.nDisposeCount;
- }
- };
-
- struct update_functor
- {
- template <typename T>
- void operator()( T& item, T * old )
- {
- if ( !old )
- ++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++;
- }
- };
-
- protected:
- template <typename List>
- void test_common( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[ nSize ];
- value_type arr2[ nSize ];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>( i );
- arr[i].nVal = arr[i].nKey * 10;
-
- arr2[i] = arr[i];
- }
- shuffle( arr, arr + nSize );
- shuffle( arr2, arr2 + nSize );
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- typedef typename List::iterator iterator;
-
- // insert / find
- for ( auto& i : arr ) {
- EXPECT_FALSE( l.contains( i.nKey ));
- EXPECT_FALSE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_FALSE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 0 );
- EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 0 );
-
- switch ( i.nKey % 4 ) {
- case 0:
- EXPECT_TRUE( l.insert( i ));
- break;
- case 1:
- EXPECT_EQ( i.s.nInsertCall, 0 );
- EXPECT_TRUE( l.insert( i, []( value_type& i ) { ++i.s.nInsertCall; } ));
- EXPECT_EQ( i.s.nInsertCall, 1 );
- break;
- case 2:
- {
- std::pair<bool, bool> ret = l.update( i, []( value_type& i, value_type * old ) {
- EXPECT_TRUE( old == nullptr );
- EXPECT_EQ( i.s.nUpdateNewCall, 0 );
- ++i.s.nUpdateNewCall;
- }, false );
- EXPECT_EQ( i.s.nUpdateNewCall, 0 );
- EXPECT_EQ( ret.first, false );
- EXPECT_EQ( ret.second, false );
-
- ret = l.update( i, []( value_type& i, value_type * old ) {
- EXPECT_TRUE( old == nullptr );
- EXPECT_EQ( i.s.nUpdateNewCall, 0 );
- ++i.s.nUpdateNewCall;
- }, true );
- EXPECT_EQ( i.s.nUpdateNewCall, 1 );
- EXPECT_EQ( ret.first, true );
- EXPECT_EQ( ret.second, true );
- }
- break;
- case 3:
- {
- std::pair<bool, bool> ret = l.upsert( i, false );
- EXPECT_EQ( ret.first, false );
- EXPECT_EQ( ret.second, false );
-
- ret = l.upsert( i );
- EXPECT_EQ( ret.first, true );
- EXPECT_EQ( ret.second, true );
- }
- break;
- }
-
- EXPECT_TRUE( l.contains( i.nKey ));
- EXPECT_TRUE( l.contains( i ));
- EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 1 );
- EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 2 );
- EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 3 );
-
- EXPECT_FALSE( l.insert( i ) );
- ASSERT_FALSE( l.empty() );
-
- int const ckey = i.nKey;
- iterator it = l.find( ckey );
- ASSERT_FALSE( it == l.end() );
- EXPECT_EQ( it->nKey, i.nKey );
- EXPECT_EQ( (*it).nVal, i.nVal );
- check_ordered( it, l.end() );
-
- it = l.find( i.nKey );
- ASSERT_FALSE( it == l.end() );
- EXPECT_EQ( it->nKey, i.nKey );
- EXPECT_EQ( (*it).nVal, i.nVal );
- check_ordered( it, l.end() );
-
- it = l.find_with( other_item( i.nKey ), other_less() );
- ASSERT_FALSE( it == l.end() );
- EXPECT_EQ( it->nKey, i.nKey );
- EXPECT_EQ( it->nVal, i.nVal );
- check_ordered( it, l.end() );
-
- }
- ASSERT_CONTAINER_SIZE( l, nSize );
-
- // check all items
- for ( auto const& i : arr ) {
- EXPECT_TRUE( l.contains( i.nKey ));
- EXPECT_TRUE( l.contains( i ));
- EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 4 );
- EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 5 );
- EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 6 );
- }
- ASSERT_FALSE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, nSize );
-
- // update existing test
- for ( auto& i : arr2 ) {
- EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
- std::pair<bool, bool> ret = l.update( i, update_functor() );
- EXPECT_TRUE( ret.first );
- EXPECT_FALSE( ret.second );
- EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
- }
-
- // update with the same value must be empty - no functor is called
- for ( auto& i : arr2 ) {
- EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
- std::pair<bool, bool> ret = l.update( i, update_functor() );
- EXPECT_TRUE( ret.first );
- EXPECT_FALSE( ret.second );
- EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
- }
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
-
- for ( auto& i : arr ) {
- EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
- std::pair<bool, bool> ret = l.update( i, []( value_type& i, value_type * old ) {
- EXPECT_FALSE( old == nullptr );
- EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
- ++i.s.nUpdateExistsCall;
- });
- EXPECT_TRUE( ret.first );
- EXPECT_FALSE( ret.second );
- EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
- }
-
- // erase test
- for ( auto const& i : arr ) {
- if ( i.nKey & 1 )
- EXPECT_TRUE( l.erase( i.nKey ));
- else
- EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less() ));
-
- EXPECT_FALSE( l.contains( i ));
- }
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
-
- for ( auto const& i : arr )
- EXPECT_EQ( i.s.nDisposeCount, 2 );
- for ( auto const& i : arr2 )
- EXPECT_EQ( i.s.nDisposeCount, 1 );
-
- // erase with functor
- for ( auto& i : arr ) {
- int const updateNewCall = i.s.nUpdateNewCall;
- std::pair<bool, bool> ret = l.update( i, update_functor(), false );
- EXPECT_FALSE( ret.first );
- EXPECT_FALSE( ret.second );
- EXPECT_EQ( i.s.nUpdateNewCall, updateNewCall );
-
- ret = l.update( i, update_functor(), true );
- EXPECT_TRUE( ret.first );
- EXPECT_TRUE( ret.second );
- EXPECT_EQ( i.s.nUpdateNewCall, updateNewCall + 1 );
- }
- EXPECT_FALSE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, nSize );
-
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nEraseCall, 0 );
- if ( i.nKey & 1 ) {
- EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less(), erase_functor()));
- EXPECT_FALSE( l.erase_with( other_item( i.nKey ), other_less(), erase_functor()));
- }
- else {
- EXPECT_TRUE( l.erase( i.nKey, []( value_type& item) { ++item.s.nEraseCall; } ));
- EXPECT_FALSE( l.erase( i.nKey, []( value_type& item) { ++item.s.nEraseCall; } ));
- }
- EXPECT_EQ( i.s.nEraseCall, 1 );
- EXPECT_FALSE( l.contains( i.nKey ));
- }
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
-
- for ( auto const& i : arr )
- EXPECT_EQ( i.s.nDisposeCount, 3 );
-
- // clear test
- for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ));
-
- EXPECT_FALSE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, nSize );
-
- l.clear();
-
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 4 );
- EXPECT_FALSE( l.contains( i ));
- }
-
- // unlink test
- for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ) );
- for ( auto& i : arr ) {
- value_type val( i );
- EXPECT_TRUE( l.contains( val ));
- EXPECT_FALSE( l.unlink( val ));
- EXPECT_TRUE( l.contains( val ) );
- EXPECT_TRUE( l.unlink( i ));
- EXPECT_FALSE( l.unlink( i ));
- EXPECT_FALSE( l.contains( i ) );
- }
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 5 );
- EXPECT_FALSE( l.contains( i ) );
- }
-
- // Iterators on empty list
- {
- auto it = l.begin();
- auto itEnd = l.end();
- auto cit = l.cbegin();
- auto citEnd = l.cend();
-
- EXPECT_TRUE( it == itEnd );
- EXPECT_TRUE( it == cit );
- EXPECT_TRUE( cit == citEnd );
-
- ++it;
- ++cit;
-
- EXPECT_TRUE( it == itEnd );
- EXPECT_TRUE( it == cit );
- EXPECT_TRUE( cit == citEnd );
- }
- }
-
- template <typename List>
- void test_ordered_iterator( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[nSize];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>(i);
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ) );
-
- int key = 0;
- for ( auto it = l.begin(); it != l.end(); ++it ) {
- EXPECT_EQ( it->nKey, key );
- EXPECT_EQ( (*it).nKey, key );
- ++key;
- }
-
- key = 0;
- for ( auto it = l.cbegin(); it != l.cend(); ++it ) {
- EXPECT_EQ( it->nKey, key );
- EXPECT_EQ( (*it).nKey, key );
- ++key;
- }
-
- l.clear();
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
- }
- }
-
- template <typename Iterator>
- void check_ordered( Iterator first, Iterator last )
- {
- while ( first != last ) {
- Iterator it = first;
- if ( ++it != last ) {
- EXPECT_LT( first->nKey, it->nKey );
- }
- first = it;
- }
- }
-
- };
-
-} // namespace cds_test
-
-#endif // CDSUNIT_LIST_TEST_INTRUSIVE_ITERABLE_LIST_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_LIST_TEST_INTRUSIVE_ITERABLE_LIST_HP_H
-#define CDSUNIT_LIST_TEST_INTRUSIVE_ITERABLE_LIST_HP_H
-
-#include "test_intrusive_iterable_list.h"
-
-namespace cds_test {
-
- class intrusive_iterable_list_hp : public intrusive_iterable_list
- {
- protected:
- template <typename List>
- void test_hp( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[nSize];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>(i);
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- typedef typename List::guarded_ptr guarded_ptr;
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- guarded_ptr gp;
-
- // get() test
- for ( auto& i : arr ) {
- gp = l.get( i.nKey );
- EXPECT_TRUE( !gp );
- gp = l.get_with( other_item( i.nKey ), other_less() );
- EXPECT_TRUE( !gp );
-
- EXPECT_TRUE( l.insert( i ) );
-
- gp = l.get( i.nKey );
- ASSERT_FALSE( !gp );
- EXPECT_EQ( gp->nKey, i.nKey );
- EXPECT_EQ( gp->nVal, i.nVal );
- gp = l.get_with( other_item( i.nKey ), other_less() );
- ASSERT_FALSE( !gp );
- EXPECT_EQ( gp->nKey, i.nKey );
- EXPECT_EQ( gp->nVal, i.nVal );
- }
-
- // extract() test
- for ( int i = 0; i < static_cast<int>(nSize); ++i ) {
- if ( i & 1 )
- gp = l.extract( i );
- else
- gp = l.extract_with( other_item( i ), other_less() );
- ASSERT_FALSE( !gp );
- EXPECT_EQ( gp->nKey, i );
-
- gp = l.extract( i );
- EXPECT_TRUE( !gp );
- gp = l.extract_with( other_item( i ), other_less() );
- EXPECT_TRUE( !gp );
- }
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
- }
- }
- };
-
-} // namespace cds_test
-
-#endif // CDSUNIT_LIST_TEST_INTRUSIVE_ITERABLE_LIST_HP_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_LIST_TEST_INTRUSIVE_LAZY_LIST_RCU_H
-#define CDSUNIT_LIST_TEST_INTRUSIVE_LAZY_LIST_RCU_H
-
-#include "test_intrusive_list_rcu.h"
-#include <cds/intrusive/lazy_list_rcu.h>
-
-namespace ci = cds::intrusive;
-
-template <class RCU>
-class IntrusiveLazyList : public cds_test::intrusive_list_rcu
-{
- typedef cds_test::intrusive_list_rcu base_class;
-public:
- typedef cds::urcu::gc<RCU> rcu_type;
- typedef typename base_class::base_item< ci::lazy_list::node< rcu_type >> base_item;
- typedef typename base_class::member_item< ci::lazy_list::node< rcu_type >> member_item;
-
-protected:
- void SetUp()
- {
- RCU::Construct();
- cds::threading::Manager::attachThread();
- }
-
- void TearDown()
- {
- cds::threading::Manager::detachThread();
- RCU::Destruct();
- }
-};
-
-TYPED_TEST_CASE_P( IntrusiveLazyList );
-
-TYPED_TEST_P( IntrusiveLazyList, base_hook )
-{
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >>>
- , ci::opt::disposer< typename TestFixture::mock_disposer >
- , cds::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>
- >::type
- > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, base_hook_cmp )
-{
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >>>
- , ci::opt::disposer< typename TestFixture::mock_disposer >
- , cds::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>
- >::type
- > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, base_hook_item_counting )
-{
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, base_hook_backoff )
-{
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, base_hook_seqcst )
-{
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, base_hook_stat )
-{
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::stat<> stat;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, base_hook_wrapped_stat )
-{
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- cds::intrusive::lazy_list::stat<> st;
- list_type l( st );
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, member_hook )
-{
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >>>
- ,ci::opt::disposer< typename TestFixture::mock_disposer >
- ,cds::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>
- >::type
- > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, member_hook_cmp )
-{
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item,
- typename ci::lazy_list::make_traits<
- ci::opt::hook< ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >>>
- ,ci::opt::disposer< typename TestFixture::mock_disposer >
- ,cds::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>
- >::type
- > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, member_hook_item_counting )
-{
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, member_hook_seqcst )
-{
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template less< typename TestFixture::member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, member_hook_back_off )
-{
- struct traits : public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::empty back_off;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, member_hook_stat )
-{
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::stat<> stat;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveLazyList, member_hook_wrapped_stat )
-{
- struct traits: public ci::lazy_list::traits {
- typedef ci::lazy_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::intrusive::lazy_list::wrapped_stat<> stat;
- };
- typedef ci::LazyList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- cds::intrusive::lazy_list::stat<> st;
- list_type l( st );
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-// GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as
-// "No test named <test_name> can be found in this test case"
-REGISTER_TYPED_TEST_CASE_P( IntrusiveLazyList,
- base_hook, base_hook_cmp, base_hook_item_counting, base_hook_backoff, base_hook_seqcst, base_hook_stat, base_hook_wrapped_stat, member_hook, member_hook_cmp, member_hook_item_counting, member_hook_seqcst, member_hook_back_off, member_hook_stat, member_hook_wrapped_stat
-);
-
-
-#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LAZY_LIST_RCU_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_LIST_TEST_INTRUSIVE_LIST_H
-#define CDSUNIT_LIST_TEST_INTRUSIVE_LIST_H
-
-#include <cds_test/check_size.h>
-#include <cds_test/fixture.h>
-
-namespace cds_test {
-
- class intrusive_list_common : public fixture
- {
- public:
- struct stat {
- int nDisposeCount;
- int nUpdateExistsCall;
- int nUpdateNewCall;
- int nFindCall;
- int nEraseCall;
- int nInsertCall;
-
- stat()
- : nDisposeCount( 0 )
- , nUpdateExistsCall( 0 )
- , nUpdateNewCall( 0 )
- , nFindCall( 0 )
- , nEraseCall( 0 )
- , nInsertCall( 0 )
- {}
-
- stat( const stat& s )
- {
- *this = s;
- }
-
- stat& operator =( const stat& s )
- {
- memcpy( this, &s, sizeof( s ) );
- return *this;
- }
- };
-
- template <typename Node>
- struct base_item : public Node
- {
- int nKey;
- int nVal;
-
- mutable stat s;
-
- base_item()
- {}
-
- base_item( int key, int val )
- : nKey( key )
- , nVal( val )
- , s()
- {}
-
- base_item( const base_item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
-
- base_item& operator=( base_item const& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
-
- base_item& operator=( base_item&& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
- };
-
- template <typename Node>
- struct member_item
- {
- int nKey;
- int nVal;
- Node hMember;
- mutable stat s;
-
- member_item()
- {}
-
- member_item( int key, int val )
- : nKey( key )
- , nVal( val )
- , s()
- {}
-
- member_item( const member_item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
-
- member_item& operator =( member_item const& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
-
- member_item& operator=( member_item&& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
- };
-
- 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 mock_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++;
- }
- };
-
- protected:
- template <typename List>
- void test_common( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[ nSize ];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>( i );
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- // insert / find
- for ( auto& i : arr ) {
- EXPECT_FALSE( l.contains( i.nKey ));
- EXPECT_FALSE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_FALSE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 0 );
- EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 0 );
-
- if ( i.nKey & 1 )
- EXPECT_TRUE( l.insert( i ));
- else {
- EXPECT_EQ( i.s.nInsertCall, 0 );
- EXPECT_TRUE( l.insert( i, []( value_type& i ) { ++i.s.nInsertCall; } ));
- EXPECT_EQ( i.s.nInsertCall, 1 );
- }
-
- EXPECT_TRUE( l.contains( i.nKey ));
- EXPECT_TRUE( l.contains( i ));
- EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 1 );
- EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 2 );
- EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 3 );
-
- EXPECT_FALSE( l.insert( i ) );
- ASSERT_FALSE( l.empty() );
- }
- ASSERT_CONTAINER_SIZE( l, nSize );
-
- // check all items
- for ( auto const& i : arr ) {
- EXPECT_TRUE( l.contains( i.nKey ));
- EXPECT_TRUE( l.contains( i ));
- EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 4 );
- EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 5 );
- EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 6 );
- }
- ASSERT_FALSE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, nSize );
-
- // update existing test
- for ( auto& i : arr ) {
- EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
- std::pair<bool, bool> ret = l.update( i, update_functor() );
- EXPECT_TRUE( ret.first );
- EXPECT_FALSE( ret.second );
- EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
-
- ret = l.update( i, []( bool bNew, value_type& i, value_type& arg ) {
- EXPECT_FALSE( bNew );
- EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
- EXPECT_TRUE( &i == &arg );
- ++i.s.nUpdateExistsCall;
- });
- EXPECT_TRUE( ret.first );
- EXPECT_FALSE( ret.second );
- EXPECT_EQ( i.s.nUpdateExistsCall, 2 );
- }
-
- // erase test
- for ( auto const& i : arr ) {
- if ( i.nKey & 1 )
- EXPECT_TRUE( l.erase( i.nKey ));
- else
- EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less() ));
-
- EXPECT_FALSE( l.contains( i ));
- }
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
-
- for ( auto const& i : arr )
- EXPECT_EQ( i.s.nDisposeCount, 1 );
-
- // erase with functor
- for ( auto& i : arr ) {
- std::pair<bool, bool> ret = l.update( i, update_functor(), false );
- EXPECT_FALSE( ret.first );
- EXPECT_FALSE( ret.second );
-
- ret = l.update( i, update_functor(), true );
- EXPECT_TRUE( ret.first );
- EXPECT_TRUE( ret.second );
- EXPECT_EQ( i.s.nUpdateNewCall, 1 );
- }
- EXPECT_FALSE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, nSize );
-
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nEraseCall, 0 );
- if ( i.nKey & 1 ) {
- EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less(), erase_functor()));
- EXPECT_FALSE( l.erase_with( other_item( i.nKey ), other_less(), erase_functor()));
- }
- else {
- EXPECT_TRUE( l.erase( i.nKey, []( value_type& item) { ++item.s.nEraseCall; } ));
- EXPECT_FALSE( l.erase( i.nKey, []( value_type& item) { ++item.s.nEraseCall; } ));
- }
- EXPECT_EQ( i.s.nEraseCall, 1 );
- EXPECT_FALSE( l.contains( i.nKey ));
- }
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
-
- for ( auto const& i : arr )
- EXPECT_EQ( i.s.nDisposeCount, 2 );
-
- // clear test
- for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ));
-
- EXPECT_FALSE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, nSize );
-
- l.clear();
-
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 3 );
- EXPECT_FALSE( l.contains( i ));
- }
-
- // unlink test
- for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ) );
- for ( auto& i : arr ) {
- value_type val( i );
- EXPECT_TRUE( l.contains( val ));
- EXPECT_FALSE( l.unlink( val ));
- EXPECT_TRUE( l.contains( val ) );
- EXPECT_TRUE( l.unlink( i ));
- EXPECT_FALSE( l.unlink( i ));
- EXPECT_FALSE( l.contains( i ) );
- }
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 4 );
- EXPECT_FALSE( l.contains( i ) );
- }
-
- // Iterators on empty list
- {
- auto it = l.begin();
- auto itEnd = l.end();
- auto cit = l.cbegin();
- auto citEnd = l.cend();
-
- EXPECT_TRUE( it == itEnd );
- EXPECT_TRUE( it == cit );
- EXPECT_TRUE( cit == citEnd );
-
- ++it;
- ++cit;
-
- EXPECT_TRUE( it == itEnd );
- EXPECT_TRUE( it == cit );
- EXPECT_TRUE( cit == citEnd );
- }
- }
-
- template <typename List>
- void test_ordered_iterator( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[nSize];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>(i);
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ) );
-
- int key = 0;
- for ( auto it = l.begin(); it != l.end(); ++it ) {
- EXPECT_EQ( it->nKey, key );
- EXPECT_EQ( (*it).nKey, key );
- ++key;
- }
-
- key = 0;
- for ( auto it = l.cbegin(); it != l.cend(); ++it ) {
- EXPECT_EQ( it->nKey, key );
- EXPECT_EQ( (*it).nKey, key );
- ++key;
- }
-
- l.clear();
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
- }
- }
- };
-
-} // namespace cds_test
-
-#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_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_LIST_TEST_INTRUSIVE_LIST_HP_H
-#define CDSUNIT_LIST_TEST_INTRUSIVE_LIST_HP_H
-
-#include "test_intrusive_list.h"
-
-namespace cds_test {
-
- class intrusive_list_hp : public intrusive_list_common
- {
- protected:
- template <typename List>
- void test_hp( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[ nSize ];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>( i );
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- typedef typename List::guarded_ptr guarded_ptr;
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- guarded_ptr gp;
-
- // get() test
- for ( auto& i : arr ) {
- gp = l.get( i.nKey );
- EXPECT_TRUE( !gp );
- gp = l.get_with( other_item( i.nKey ), other_less());
- EXPECT_TRUE( !gp );
-
- EXPECT_TRUE( l.insert( i ));
-
- gp = l.get( i.nKey );
- ASSERT_FALSE( !gp );
- EXPECT_EQ( gp->nKey, i.nKey );
- EXPECT_EQ( gp->nVal, i.nVal );
- gp = l.get_with( other_item( i.nKey ), other_less() );
- ASSERT_FALSE( !gp );
- EXPECT_EQ( gp->nKey, i.nKey );
- EXPECT_EQ( gp->nVal, i.nVal );
- }
-
- // extract() test
- for ( int i = 0; i < static_cast<int>(nSize); ++i ) {
- if ( i & 1 )
- gp = l.extract( i );
- else
- gp = l.extract_with( other_item(i), other_less());
- ASSERT_FALSE( !gp );
- EXPECT_EQ( gp->nKey, i );
-
- gp = l.extract( i );
- EXPECT_TRUE( !gp );
- gp = l.extract_with( other_item( i ), other_less() );
- EXPECT_TRUE( !gp );
- }
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
- }
- }
- };
-
-} // namespace cds_test
-
-#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_HP_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_LIST_TEST_INTRUSIVE_LIST_NOGC_H
-#define CDSUNIT_LIST_TEST_INTRUSIVE_LIST_NOGC_H
-
-#include <cds_test/check_size.h>
-#include <cds_test/fixture.h>
-
-namespace cds_test {
-
- class intrusive_list_nogc : public fixture
- {
- public:
- struct stat {
- int nDisposeCount;
- int nUpdateExistsCall;
- int nUpdateNewCall;
- int nFindCall;
-
- stat()
- : nDisposeCount( 0 )
- , nUpdateExistsCall( 0 )
- , nUpdateNewCall( 0 )
- , nFindCall( 0 )
- {}
-
- stat( const stat& s )
- {
- *this = s;
- }
-
- stat& operator =( const stat& s )
- {
- memcpy( this, &s, sizeof( s ) );
- return *this;
- }
- };
-
- template <typename Node>
- struct base_item : public Node
- {
- int nKey;
- int nVal;
-
- mutable stat s;
-
- base_item()
- {}
-
- base_item( int key, int val )
- : nKey( key )
- , nVal( val )
- , s()
- {}
-
- base_item( const base_item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
-
- base_item& operator=( base_item const& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
-
- base_item& operator=( base_item&& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
- };
-
- template <typename Node>
- struct member_item
- {
- int nKey;
- int nVal;
- Node hMember;
- mutable stat s;
-
- member_item()
- {}
-
- member_item( int key, int val )
- : nKey( key )
- , nVal( val )
- , s()
- {}
-
- member_item( const member_item& v )
- : nKey( v.nKey )
- , nVal( v.nVal )
- , s()
- {}
-
- const int& key() const
- {
- return nKey;
- }
-
- member_item& operator =( member_item const& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
-
- member_item& operator=( member_item&& src )
- {
- nKey = src.nKey;
- nVal = src.nVal;
- return *this;
- }
- };
-
- 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 mock_disposer
- {
- template <typename T>
- void operator ()( T * p )
- {
- ++p->s.nDisposeCount;
- }
- };
-
- struct mock_disposer2
- {
- template <typename T>
- void operator ()( T * p )
- {
- p->s.nDisposeCount += 10;
- }
- };
-
- 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++;
- }
- };
-
- protected:
- template <typename List>
- void test_common( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[ nSize ];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>( i );
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- // insert / find
- for ( auto& i : arr ) {
- EXPECT_FALSE( l.contains( i.nKey ));
- EXPECT_FALSE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_FALSE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 0 );
- EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 0 );
-
- EXPECT_TRUE( l.insert( i ));
-
- EXPECT_TRUE( l.contains( i.nKey ));
- EXPECT_TRUE( l.contains( i ));
- EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 1 );
- EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 2 );
- EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 3 );
-
- EXPECT_FALSE( l.insert( i ) );
- ASSERT_FALSE( l.empty() );
- }
- ASSERT_CONTAINER_SIZE( l, nSize );
-
- // check all items
- for ( auto const& i : arr ) {
- EXPECT_TRUE( l.contains( i.nKey ));
- EXPECT_TRUE( l.contains( i ));
- EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 4 );
- EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 5 );
- EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
- EXPECT_EQ( i.s.nFindCall, 6 );
- }
- ASSERT_FALSE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, nSize );
-
- // update existing test
- for ( auto& i : arr ) {
- EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
- std::pair<bool, bool> ret = l.update( i, update_functor() );
- EXPECT_TRUE( ret.first );
- EXPECT_FALSE( ret.second );
- EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
-
- ret = l.update( i, []( bool bNew, value_type& i, value_type& arg ) {
- EXPECT_FALSE( bNew );
- EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
- EXPECT_TRUE( &i == &arg );
- ++i.s.nUpdateExistsCall;
- });
- EXPECT_TRUE( ret.first );
- EXPECT_FALSE( ret.second );
- EXPECT_EQ( i.s.nUpdateExistsCall, 2 );
- }
-
- // clear() test
- l.clear();
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
- }
-
-
- for ( auto& i : arr ) {
- std::pair<bool, bool> ret = l.update( i, update_functor(), false );
- EXPECT_FALSE( ret.first );
- EXPECT_FALSE( ret.second );
-
- ret = l.update( i, update_functor(), true );
- EXPECT_TRUE( ret.first );
- EXPECT_TRUE( ret.second );
- EXPECT_EQ( i.s.nUpdateNewCall, 1 );
- }
-
- EXPECT_FALSE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, nSize );
-
- l.clear( mock_disposer2());
-
- EXPECT_TRUE( l.empty() );
- EXPECT_CONTAINER_SIZE( l, 0 );
-
- // Apply retired pointer to clean links
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 11 );
- EXPECT_FALSE( l.contains( i ));
- }
-
- // Iterators on empty list
- {
- auto it = l.begin();
- auto itEnd = l.end();
- auto cit = l.cbegin();
- auto citEnd = l.cend();
-
- EXPECT_TRUE( it == itEnd );
- EXPECT_TRUE( it == cit );
- EXPECT_TRUE( cit == citEnd );
-
- ++it;
- ++cit;
-
- EXPECT_TRUE( it == itEnd );
- EXPECT_TRUE( it == cit );
- EXPECT_TRUE( cit == citEnd );
- }
- }
-
- template <typename List>
- void test_ordered_iterator( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[nSize];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>(i);
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ) );
-
- int key = 0;
- for ( auto it = l.begin(); it != l.end(); ++it ) {
- EXPECT_EQ( it->nKey, key );
- EXPECT_EQ( (*it).nKey, key );
- ++key;
- }
-
- key = 0;
- for ( auto it = l.cbegin(); it != l.cend(); ++it ) {
- EXPECT_EQ( it->nKey, key );
- EXPECT_EQ( (*it).nKey, key );
- ++key;
- }
-
- l.clear();
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
- }
- }
-
- template <typename List>
- void test_unordered_iterator( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[nSize];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>(i);
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ) );
-
- size_t idx = 0;
- for ( auto it = l.begin(); it != l.end(); ++it, ++idx ) {
- ASSERT_LT( idx, nSize );
- EXPECT_EQ( it->nKey, arr[idx].nKey );
- EXPECT_EQ( (*it).nKey, arr[idx].nKey );
- }
-
- idx = 0;
- for ( auto it = l.cbegin(); it != l.cend(); ++it, ++idx ) {
- ASSERT_LT( idx, nSize );
- EXPECT_EQ( it->nKey, arr[idx].nKey );
- EXPECT_EQ( (*it).nKey, arr[idx].nKey );
- }
-
- l.clear();
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
- }
- }
- };
-
-} // namespace cds_test
-
-#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_NOGC_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_LIST_TEST_INTRUSIVE_LIST_RCU_H
-#define CDSUNIT_LIST_TEST_INTRUSIVE_LIST_RCU_H
-
-#include "test_intrusive_list.h"
-
-namespace cds_test {
-
- class intrusive_list_rcu : public intrusive_list_common
- {
- protected:
- template <typename List>
- void test_rcu( List& l )
- {
- // Precondition: list is empty
- // Postcondition: list is empty
-
- static const size_t nSize = 20;
- typedef typename List::value_type value_type;
- value_type arr[ nSize ];
-
- for ( size_t i = 0; i < nSize; ++i ) {
- arr[i].nKey = static_cast<int>( i );
- arr[i].nVal = arr[i].nKey * 10;
- }
- shuffle( arr, arr + nSize );
-
- typedef typename List::exempt_ptr exempt_ptr;
- typedef typename List::raw_ptr raw_ptr;
- typedef typename List::rcu_lock rcu_lock;
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- // get() test
- for ( auto& i : arr ) {
- {
- rcu_lock lock;
- raw_ptr rp = l.get( i.nKey );
- EXPECT_TRUE( !rp );
- rp = l.get_with( other_item( i.nKey ), other_less());
- EXPECT_TRUE( !rp );
- }
-
- EXPECT_TRUE( l.insert( i ));
-
- {
- rcu_lock lock;
- raw_ptr rp = l.get( i.nKey );
- ASSERT_FALSE( !rp );
- EXPECT_EQ( rp->nKey, i.nKey );
- EXPECT_EQ( rp->nVal, i.nVal );
- }
- {
- rcu_lock lock;
- raw_ptr rp = l.get_with( other_item( i.nKey ), other_less() );
- ASSERT_FALSE( !rp );
- EXPECT_EQ( rp->nKey, i.nKey );
- EXPECT_EQ( rp->nVal, i.nVal );
- }
- }
-
- exempt_ptr gp;
-
- // extract() test
- if ( List::c_bExtractLockExternal ) {
- for ( int i = 0; i < static_cast<int>(nSize); ++i ) {
- {
- rcu_lock lock;
-
- if ( i & 1 )
- gp = l.extract( i );
- else
- gp = l.extract_with( other_item(i), other_less());
- ASSERT_FALSE( !gp );
- EXPECT_EQ( gp->nKey, i );
- }
- gp.release();
- {
- rcu_lock lock;
-
- gp = l.extract( i );
- EXPECT_TRUE( !gp );
- gp = l.extract_with( other_item( i ), other_less() );
- EXPECT_TRUE( !gp );
- }
- }
- }
- else {
- for ( int i = 0; i < static_cast<int>(nSize); ++i ) {
- if ( i & 1 )
- gp = l.extract( i );
- else
- gp = l.extract_with( other_item( i ), other_less() );
- ASSERT_FALSE( !gp );
- EXPECT_EQ( gp->nKey, i );
-
- gp = l.extract( i );
- EXPECT_TRUE( !gp );
- gp = l.extract_with( other_item( i ), other_less() );
- EXPECT_TRUE( !gp );
- }
- }
-
- ASSERT_TRUE( l.empty() );
- ASSERT_CONTAINER_SIZE( l, 0 );
-
- List::gc::force_dispose();
- for ( auto const& i : arr ) {
- EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
- }
- }
- };
-
-} // namespace cds_test
-
-#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_RCU_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_LIST_TEST_INTRUSIVE_MICHAEL_LIST_RCU_H
-#define CDSUNIT_LIST_TEST_INTRUSIVE_MICHAEL_LIST_RCU_H
-
-#include "test_intrusive_list_rcu.h"
-#include <cds/intrusive/michael_list_rcu.h>
-
-namespace ci = cds::intrusive;
-
-template <class RCU>
-class IntrusiveMichaelList : public cds_test::intrusive_list_rcu
-{
- typedef cds_test::intrusive_list_rcu base_class;
-public:
- typedef cds::urcu::gc<RCU> rcu_type;
- typedef typename base_class::base_item< ci::michael_list::node< rcu_type >> base_item;
- typedef typename base_class::member_item< ci::michael_list::node< rcu_type >> member_item;
-
-protected:
- void SetUp()
- {
- RCU::Construct();
- cds::threading::Manager::attachThread();
- }
-
- void TearDown()
- {
- cds::threading::Manager::detachThread();
- RCU::Destruct();
- }
-};
-
-TYPED_TEST_CASE_P( IntrusiveMichaelList );
-
-TYPED_TEST_P( IntrusiveMichaelList, base_hook )
-{
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >>>
- , ci::opt::disposer< typename TestFixture::mock_disposer >
- , cds::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>
- >::type
- > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, base_hook_cmp )
-{
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >>>
- , ci::opt::disposer< typename TestFixture::mock_disposer >
- , cds::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>
- >::type
- > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, base_hook_item_counting )
-{
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, base_hook_backoff )
-{
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::base_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::pause back_off;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, base_hook_seqcst )
-{
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, base_hook_stat )
-{
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef cds::intrusive::michael_list::stat<> stat;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, base_hook_wrapped_stat )
-{
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::base_hook< cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::base_item > compare;
- typedef cds::intrusive::michael_list::wrapped_stat<> stat;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::base_item, traits > list_type;
-
- cds::intrusive::michael_list::stat<> st;
- list_type l( st );
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, member_hook )
-{
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >>>
- ,ci::opt::disposer< typename TestFixture::mock_disposer >
- ,cds::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>
- >::type
- > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, member_hook_cmp )
-{
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item,
- typename ci::michael_list::make_traits<
- ci::opt::hook< ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >>>
- ,ci::opt::disposer< typename TestFixture::mock_disposer >
- ,cds::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>
- >::type
- > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, member_hook_item_counting )
-{
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, member_hook_seqcst )
-{
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template less< typename TestFixture::member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::opt::v::sequential_consistent memory_model;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, member_hook_back_off )
-{
- struct traits : public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
- typedef typename TestFixture::template less< typename TestFixture::member_item > less;
- typedef cds::atomicity::item_counter item_counter;
- typedef cds::backoff::empty back_off;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, member_hook_stat )
-{
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
- typedef cds::intrusive::michael_list::stat<> stat;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- list_type l;
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-TYPED_TEST_P( IntrusiveMichaelList, member_hook_wrapped_stat )
-{
- struct traits: public ci::michael_list::traits {
- typedef ci::michael_list::member_hook< offsetof( typename TestFixture::member_item, hMember ), cds::opt::gc< typename TestFixture::rcu_type >> hook;
- typedef typename TestFixture::mock_disposer disposer;
- typedef typename TestFixture::template cmp< typename TestFixture::member_item > compare;
- typedef cds::intrusive::michael_list::wrapped_stat<> stat;
- };
- typedef ci::MichaelList< typename TestFixture::rcu_type, typename TestFixture::member_item, traits > list_type;
-
- cds::intrusive::michael_list::stat<> st;
- list_type l( st );
- this->test_common( l );
- this->test_ordered_iterator( l );
- this->test_rcu( l );
-}
-
-
-// GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as
-// "No test named <test_name> can be found in this test case"
-REGISTER_TYPED_TEST_CASE_P( IntrusiveMichaelList,
- base_hook, base_hook_cmp, base_hook_item_counting, base_hook_backoff, base_hook_seqcst, base_hook_stat, base_hook_wrapped_stat, member_hook, member_hook_cmp, member_hook_item_counting, member_hook_seqcst, member_hook_back_off, member_hook_stat, member_hook_wrapped_stat
-);
-
-
-#endif // CDSUNIT_LIST_TEST_INTRUSIVE_LIST_RCU_H
-