X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=cds%2Fdetails%2Fdefs.h;h=0cfdd147e78cebc6fb9fc019a1e17c6b2b3e20bb;hb=f9a3482c25de1eb0db20e2835488096ac23b2098;hp=a7769cb3f559bb6e0033cdf36467e25754ac71a9;hpb=9e2654f9e05fa1ed4cbb78387363d735d385b74c;p=libcds.git diff --git a/cds/details/defs.h b/cds/details/defs.h index a7769cb3..0cfdd147 100644 --- a/cds/details/defs.h +++ b/cds/details/defs.h @@ -1,4 +1,32 @@ -//$$CDS-header$$ +/* + 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 CDSLIB_DEFS_H #define CDSLIB_DEFS_H @@ -21,7 +49,7 @@ The main namespace for the library is \ref cds. To see the full list of container's class go to modules tab. - + Supported processor architectures and operating systems (OS) are: - x86 [32bit] Linux, Windows, FreeBSD, MinGW - amd64 (x86-64) [64bit] Linux, Windows, FreeBSD, MinGW @@ -32,7 +60,7 @@ Supported compilers: - GCC 4.8+ - - Clang 3.3+ + - Clang 3.3+ - MS Visual C++ 2013 Update 4 and above - Intel C++ Compiler 15 @@ -41,11 +69,11 @@ schema used. However, any implementation supports common interface for the type of data structure. To use any lock-free data structure, the following are needed: - - atomic operation library conforming with C++11 memory model. - The libcds can be built with \p std::atomic, \p boost::atomic or its own + - atomic operation library conforming with C++11 memory model. + The libcds can be built with \p std::atomic, \p boost::atomic or its own @ref cds_cxx11_atomic "atomic implementation" - - safe memory reclamation (SMR) or garbage collecting (GC) algorithm. - + - safe memory reclamation (SMR) or garbage collecting (GC) algorithm. + SMR is the main part of lock-free data structs. The SMR solves the problem of safe memory reclamation that is one of the main problem for lock-free programming. The library contains the implementations of several light-weight \ref cds_garbage_collector "memory reclamation schemes": @@ -122,7 +150,7 @@ int plugin_entry_point() { // Attach the thread if it is not attached yet - if ( !cds::threading::Manager::isThreadAttached() ) + if ( !cds::threading::Manager::isThreadAttached()) cds::threading::Manager::attachThread(); // Do some work with HP-related containers @@ -130,15 +158,15 @@ } \endcode - + \par How to build The cds is mostly header-only library. Only small part of library related to GC core functionality - should be compiled. - - The test projects depends on the following static library from \p boost: - - \p boost.thread - - \p boost.date_time + should be compiled. + + External dependenies: the tests depends on: + - \p boost.thread (thread-loal storage support), boost.system + - \p google-test \par Windows build @@ -148,39 +176,26 @@ - boost library 1.51 and above. You should create environment variable \p BOOST_PATH containing full path to \p boost root directory (for example, C:\\libs\\boost_1_57_0). - Open solution file cds\projects\vcX\cds.sln where \p vcX is the version of - Microsoft Visual C++ you use: vc12 for MS VC 2013 Update 4, vc14 for MS VC 2015. The solution - contains \p cds project and a lot of test projects. Just build the library using solution. + Open solution file cds\projects\vc14\cds.sln with Microsoft VisualStudio 2015. + The solution contains \p cds project and a lot of test projects. Just build the library using solution. Warning: the solution depends on \p BOOST_PATH environment variable that specifies full path to \p boost library root directory. The test projects search \p boost libraries in: - for 32bit: \$(BOOST_PATH)/stage/lib, \$(BOOST_PATH)/stage32/lib, and \$(BOOST_PATH)/bin. - for 64bit: \$(BOOST_PATH)/stage64/lib and \$(BOOST_PATH)/bin. + + All tests are based on googletest framework. The following environment variables specify + where to find gtest include and library directories: + - \p GTEST_ROOT - gtest root directory. \$(GTEST_ROOT)/include specifies full path to + gtest include files; + - \p GTEST_LIB64 - the path to 64bit gtest library dir; + - \p GTEST_LIB32 - the path to 32bit gtest library dir. \par *NIX build For Unix-like systems GCC and Clang compilers are supported. - Use GCC 4.8+ compiler or Clang 3.3+ to build cds library. The distributive contains - makefile and build.sh script in build directory. - The build/sample directory contains sample scripts for different operating systems and - processor architectures. - The build.sh script supports the following options: - - -c toolset - Toolset name, possible values: gcc (default), clang, icc - - -x compiler - C++ compiler name (e.g. g++, g++-4.5 and so on) - - -p arch - processor architecture; possible values for arch are: x86, amd64 (x86_64), sparc, ia64, ppc64 - - -o OStype - OS family; possible values for OStype are: linux, sunos (solaris), hpux, mingw - - -D define additional defines - - -b bits - bits to build, accepts 64, 32 - - -l "options" - extra linker options (in quotes) - - -z "options" - extra compiler options (in quotes) - - --with-boost path - path to boost include - - --debug-cxx-options "options" - extra compiler options for debug target - - --debug-ld-options "options" - extra linker options for debug target - - --release-cxx-options "options" - extra compiler options for release target - - --release-ld-options "optons" - extra linker options for release target - - --clean - clean all before building - - --debug-test - make unit test in debug mode; by defalt release unit test generated - - --amd64-use-128bit - compile with supporting 128bit (16byte) CAS on amd64 (for am64 only) + Use GCC 4.8+ compiler or Clang 3.3+ to build cds library with CMake. + See accompanying file /build/cmake/readme.md for more info. @note Important for GCC compiler: all your projects that use \p libcds must be compiled with -fno-strict-aliasing compiler flag. @@ -302,6 +317,8 @@ namespace cds {} #if defined(_MSC_VER) # if defined(__ICL) || defined(__INTEL_COMPILER) # define CDS_COMPILER CDS_COMPILER_INTEL +# elif defined(__clang__) +# define CDS_COMPILER CDS_COMPILER_CLANG # else # define CDS_COMPILER CDS_COMPILER_MSVC # endif @@ -346,29 +363,6 @@ namespace cds {} # define CDS_CXX11_INLINE_NAMESPACE #endif -//@cond -// typedefs for back compatibility -namespace cds { - /// 64bit unaligned int - typedef int64_t atomic64_unaligned; - - /// 64bit unaligned unsigned int - typedef uint64_t atomic64u_unaligned; - - /// 64bit aligned int - typedef atomic64_unaligned CDS_TYPE_ALIGNMENT(8) atomic64_aligned; - - /// 64bit aligned unsigned int - typedef atomic64u_unaligned CDS_TYPE_ALIGNMENT(8) atomic64u_aligned; - - /// 64bit atomic int (aligned) - typedef atomic64_aligned atomic64_t; - - /// 64bit atomic unsigned int (aligned) - typedef atomic64u_aligned atomic64u_t; -} // namespace cds -//@endcond - /************************************************************************* Common things **************************************************************************/