mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[12772] Removed TBB
added some definitions for clang compiler
This commit is contained in:
parent
c4faf3a816
commit
0df5d7fccb
264 changed files with 5 additions and 57306 deletions
|
|
@ -28,8 +28,6 @@ set(CMAKE_MODULE_PATH
|
|||
|
||||
# define all options here
|
||||
option(DEBUG "Debug mode" OFF)
|
||||
option(TBB_USE_EXTERNAL "Use external TBB" OFF)
|
||||
option(USE_STD_MALLOC "Use standard malloc instead of TBB" OFF)
|
||||
option(ACE_USE_EXTERNAL "Use external ACE" OFF)
|
||||
if(PCHSupport_FOUND AND WIN32) # TODO: why only enable it on windows by default?
|
||||
option(PCH "Use precompiled headers" ON)
|
||||
|
|
@ -54,8 +52,6 @@ message(
|
|||
defined name. the name must corespond to the name of
|
||||
the folder and the folder must contain a valid
|
||||
CMakeLists.txt
|
||||
TBB_USE_EXTERNAL Use external TBB
|
||||
USE_STD_MALLOC Use standard malloc instead of TBB
|
||||
ACE_USE_EXTERNAL Use external ACE
|
||||
To set an option simply type -D<OPTION>=<VALUE> after 'cmake <srcs>'.
|
||||
Also, you can specify the generator with -G. see 'cmake --help' for more details
|
||||
|
|
@ -150,25 +146,6 @@ else()
|
|||
include(cmake/ImportACE.cmake)
|
||||
endif()
|
||||
|
||||
if(NOT USE_STD_MALLOC)
|
||||
unset(TBB_INCLUDE_DIR CACHE)
|
||||
unset(TBB_LIBRARIES CACHE)
|
||||
unset(TBB_LIBRARIES_DIR CACHE)
|
||||
unset(TBB_INCLUDE_DIR)
|
||||
unset(TBB_LIBRARIES)
|
||||
unset(TBB_LIBRARIES_DIR)
|
||||
if(TBB_USE_EXTERNAL)
|
||||
find_package(TBB)
|
||||
if(NOT TBB_FOUND)
|
||||
message(FATAL_ERROR
|
||||
"This project requires TBB installed when TBB_USE_EXTERNAL is set. Please download the TBB Stable Release from http://www.threadingbuildingblocks.org/ and install it. If this script didn't find TBB and it was correctly installed please set TBB_ROOT to the correct path."
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
include(cmake/ImportTBB.cmake)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Win32 delivered packages
|
||||
if(WIN32)
|
||||
set(MYSQL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dep/include/mysql)
|
||||
|
|
@ -387,9 +364,6 @@ if(WIN32)
|
|||
set(DEFINITIONS ${DEFINITIONS} WIN32 _WIN32)
|
||||
set(DEFINITIONS_RELEASE ${DEFINITIONS_RELEASE} _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
if(USE_STD_MALLOC)
|
||||
set(DEFINITIONS ${DEFINITIONS} USE_STANDARD_MALLOC)
|
||||
endif()
|
||||
|
||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}")
|
||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_RELEASE "${DEFINITIONS_RELEASE}")
|
||||
|
|
|
|||
|
|
@ -1,98 +0,0 @@
|
|||
# This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# Specify tbb lib that was build externally
|
||||
# add_library(tbb SHARED IMPORTED)
|
||||
# add_library(tbbmalloc SHARED IMPORTED)
|
||||
if(WIN32)
|
||||
set(LIB_SUFFIX dll)
|
||||
if(VS100_FOUND)
|
||||
set(VSDIR vs100project)
|
||||
else()
|
||||
set(VSDIR vsproject)
|
||||
endif()
|
||||
if(PLATFORM MATCHES X86)
|
||||
set(ARCHDIR ia32)
|
||||
else()
|
||||
set(ARCHDIR intel64)
|
||||
endif()
|
||||
# set_target_properties(tbb PROPERTIES
|
||||
# IMPORTED_LOCATION_RELEASE ${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Release/tbb.dll
|
||||
# IMPORTED_LOCATION_DEBUG ${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Debug/tbb_debug.dll
|
||||
# IMPORTED_IMPLIB_RELEASE ${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Release/tbb.lib
|
||||
# IMPORTED_IMPLIB_DEBUG ${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Debug/tbb_debug.lib
|
||||
# )
|
||||
# set_target_properties(tbbmalloc PROPERTIES
|
||||
# IMPORTED_LOCATION_RELEASE ${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Release/tbbmalloc.dll
|
||||
# IMPORTED_LOCATION_DEBUG ${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Debug/tbbmalloc_debug.dll
|
||||
# IMPORTED_IMPLIB_RELEASE ${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Release/tbbmalloc.lib
|
||||
# IMPORTED_IMPLIB_DEBUG ${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Debug/tbbmalloc_debug.lib
|
||||
# )
|
||||
set(TBB_LIBRARIES_DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Release
|
||||
${CMAKE_SOURCE_DIR}/dep/tbb/build/${VSDIR}/${ARCHDIR}/Debug
|
||||
)
|
||||
else()
|
||||
if(APPLE)
|
||||
set(LIB_SUFFIX dylib)
|
||||
else()
|
||||
set(LIB_SUFFIX so)
|
||||
endif()
|
||||
# set_target_properties(tbb PROPERTIES
|
||||
# IMPORTED_LOCATION_RELEASE ${CMAKE_SOURCE_DIR}/dep/tbb/build/libs_release/libtbb.${LIB_SUFFIX}
|
||||
# IMPORTED_LOCATION_DEBUG ${CMAKE_SOURCE_DIR}/dep/tbb/build/libs_debug/libtbb_debug.${LIB_SUFFIX}
|
||||
# )
|
||||
# set_target_properties(tbbmalloc PROPERTIES
|
||||
# IMPORTED_LOCATION_RELEASE ${CMAKE_SOURCE_DIR}/dep/tbb/build/libs_release/libtbbmalloc.${LIB_SUFFIX}
|
||||
# IMPORTED_LOCATION_DEBUG ${CMAKE_SOURCE_DIR}/dep/tbb/build/libs_debug/libtbbmalloc_debug.${LIB_SUFFIX}
|
||||
# )
|
||||
set(TBB_LIBRARIES_DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/tbb/build/libs_release
|
||||
${CMAKE_SOURCE_DIR}/dep/tbb/build/libs_debug
|
||||
)
|
||||
endif()
|
||||
# Sadly doesn't work in current version
|
||||
# add_dependencies(tbb TBB_Project)
|
||||
# add_dependencies(tbbmalloc TBB_Project)
|
||||
# set_target_properties(tbb PROPERTIES DEPENDS TBB_Project)
|
||||
# set_target_properties(tbbmalloc PROPERTIES DEPENDS TBB_Project)
|
||||
|
||||
set(TBB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dep/tbb/include)
|
||||
set(TBB_LIBRARIES optimized tbb optimized tbbmalloc debug tbb_debug debug tbbmalloc_debug)
|
||||
|
||||
# Little Hack to remove the link warnings because of not found directories
|
||||
if(XCODE)
|
||||
foreach(DIR ${TBB_LIBRARIES_DIR})
|
||||
foreach(CONF ${CMAKE_CONFIGURATION_TYPES})
|
||||
file(MAKE_DIRECTORY ${DIR}/${CONF})
|
||||
endforeach(CONF)
|
||||
endforeach(DIR)
|
||||
foreach(CONF ${CMAKE_CONFIGURATION_TYPES})
|
||||
set(CONFSTR ${CONFSTR} PATTERN "${CONF}" EXCLUDE)
|
||||
endforeach(CONF)
|
||||
endif()
|
||||
|
||||
link_directories(
|
||||
${TBB_LIBRARIES_DIR}
|
||||
)
|
||||
|
||||
foreach(DIR ${TBB_LIBRARIES_DIR})
|
||||
install(
|
||||
DIRECTORY ${DIR}/ DESTINATION ${LIBS_DIR}
|
||||
FILES_MATCHING PATTERN "*.${LIB_SUFFIX}*"
|
||||
${CONFSTR}
|
||||
)
|
||||
endforeach(DIR)
|
||||
|
|
@ -14,10 +14,6 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
if(NOT (TBB_USE_EXTERNAL OR USE_STD_MALLOC))
|
||||
add_subdirectory(tbb)
|
||||
endif()
|
||||
|
||||
if(NOT ACE_USE_EXTERNAL)
|
||||
add_subdirectory(ACE_wrappers)
|
||||
endif()
|
||||
|
|
|
|||
678
dep/tbb/CHANGES
678
dep/tbb/CHANGES
|
|
@ -1,678 +0,0 @@
|
|||
TBB 2.2 Update 1 commercial-aligned release
|
||||
|
||||
Changes (w.r.t. TBB 2.2 commercial-aligned release):
|
||||
|
||||
- Incorporates all changes from open-source releases below.
|
||||
- Documentation was updated.
|
||||
- TBB scheduler auto-initialization now covers all possible use cases.
|
||||
- concurrent_queue: made argument types of sizeof used in paddings
|
||||
consistent with those actually used.
|
||||
- Memory allocator was improved: supported corner case of user's malloc
|
||||
calling scalable_malloc (non-Windows), corrected processing of
|
||||
memory allocation requests during tbb memory allocator startup
|
||||
(Linux).
|
||||
- Windows malloc replacement has got better support for static objects.
|
||||
- In pipeline setups that do not allow actual parallelism, execution
|
||||
by a single thread is guaranteed, idle spinning eliminated, and
|
||||
performance improved.
|
||||
- RML refactoring and clean-up.
|
||||
- New constructor for concurrent_hash_map allows reserving space for
|
||||
a number of items.
|
||||
- Operator delete() added to the TBB exception classes.
|
||||
- Lambda support was improved in parallel_reduce.
|
||||
- gcc 4.3 warnings were fixed for concurrent_queue.
|
||||
- Fixed possible initialization deadlock in modules using TBB entities
|
||||
during construction of global static objects.
|
||||
- Copy constructor in concurrent_hash_map was fixed.
|
||||
- Fixed a couple of rare crashes in the scheduler possible before
|
||||
in very specific use cases.
|
||||
- Fixed a rare crash in the TBB allocator running out of memory.
|
||||
- New tests were implemented, including test_lambda.cpp that checks
|
||||
support for lambda expressions.
|
||||
- A few other small changes in code, tests, and documentation.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20090809 open-source release
|
||||
|
||||
Changes (w.r.t. TBB 2.2 commercial-aligned release):
|
||||
|
||||
- Fixed known exception safety issues in concurrent_vector.
|
||||
- Better concurrency of simultaneous grow requests in concurrent_vector.
|
||||
- TBB allocator further improves performance of large object allocation.
|
||||
- Problem with source of text relocations was fixed on Linux
|
||||
- Fixed bugs related to malloc replacement under Windows
|
||||
- A few other small changes in code and documentation.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.2 commercial-aligned release
|
||||
|
||||
Changes (w.r.t. TBB 2.1 U4 commercial-aligned release):
|
||||
|
||||
- Incorporates all changes from open-source releases below.
|
||||
- Architecture folders renamed from em64t to intel64 and from itanium
|
||||
to ia64.
|
||||
- Major Interface version changed from 3 to 4. Deprecated interfaces
|
||||
might be removed in future releases.
|
||||
- Parallel algorithms that use partitioners have switched to use
|
||||
the auto_partitioner by default.
|
||||
- Improved memory allocator performance for allocations bigger than 8K.
|
||||
- Added new thread-bound filters functionality for pipeline.
|
||||
- New implementation of concurrent_hash_map that improves performance
|
||||
significantly.
|
||||
- A few other small changes in code and documentation.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20090511 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Basic support for MinGW32 development kit.
|
||||
- Added tbb::zero_allocator class that initializes memory with zeros.
|
||||
It can be used as an adaptor to any STL-compatible allocator class.
|
||||
- Added tbb::parallel_for_each template function as alias to parallel_do.
|
||||
- Added more overloads for tbb::parallel_for.
|
||||
- Added support for exact exception propagation (can only be used with
|
||||
compilers that support C++0x std::exception_ptr).
|
||||
- tbb::atomic template class can be used with enumerations.
|
||||
- mutex, recursive_mutex, spin_mutex, spin_rw_mutex classes extended
|
||||
with explicit lock/unlock methods.
|
||||
- Fixed size() and grow_to_at_least() methods of tbb::concurrent_vector
|
||||
to provide space allocation guarantees. More methods added for
|
||||
compatibility with std::vector, including some from C++0x.
|
||||
- Preview of a lambda-friendly interface for low-level use of tasks.
|
||||
- scalable_msize function added to the scalable allocator (Windows only).
|
||||
- Rationalized internal auxiliary functions for spin-waiting and backoff.
|
||||
- Several tests undergo decent refactoring.
|
||||
|
||||
Changes affecting backward compatibility:
|
||||
|
||||
- Improvements in concurrent_queue, including limited API changes.
|
||||
The previous version is deprecated; its functionality is accessible
|
||||
via methods of the new tbb::concurrent_bounded_queue class.
|
||||
- grow* and push_back methods of concurrent_vector changed to return
|
||||
iterators; old semantics is deprecated.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.1 Update 4 commercial-aligned release
|
||||
|
||||
Changes (w.r.t. TBB 2.1 U3 commercial-aligned release):
|
||||
|
||||
- Added tests for aligned memory allocations and malloc replacement.
|
||||
- Several improvements for better bundling with Intel(R) C++ Compiler.
|
||||
- A few other small changes in code and documentaion.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 150 - request to build TBB examples with debug info in release mode.
|
||||
- backward compatibility issue with concurrent_queue on Windows.
|
||||
- dependency on VS 2005 SP1 runtime libraries removed.
|
||||
- compilation of GUI examples under XCode* 3.1 (1577).
|
||||
- On Windows, TBB allocator classes can be instantiated with const types
|
||||
for compatibility with MS implementation of STL containers (1566).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20090313 open-source release
|
||||
|
||||
Changes (w.r.t. 20081109 open-source release):
|
||||
|
||||
- Includes all changes introduced in TBB 2.1 Update 2 & Update 3
|
||||
commercial-aligned releases (see below for details).
|
||||
- Added tbb::parallel_invoke template function. It runs up to 10
|
||||
user-defined functions in parallel and waits for them to complete.
|
||||
- Added a special library providing ability to replace the standard
|
||||
memory allocation routines in Microsoft* C/C++ RTL (malloc/free,
|
||||
global new/delete, etc.) with the TBB memory allocator.
|
||||
Usage details are described in include/tbb/tbbmalloc_proxy.h file.
|
||||
- Task scheduler switched to use new implementation of its core
|
||||
functionality (deque based task pool, new structure of arena slots).
|
||||
- Preview of Microsoft* Visual Studio* 2005 project files for
|
||||
building the library is available in build/vsproject folder.
|
||||
- Added tests for aligned memory allocations and malloc replacement.
|
||||
- Added parallel_for/game_of_life.net example (for Windows only)
|
||||
showing TBB usage in a .NET application.
|
||||
- A number of other fixes and improvements to code, tests, makefiles,
|
||||
examples and documents.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- The same list as in TBB 2.1 Update 4 right above.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.1 Update 3 commercial-aligned release
|
||||
|
||||
Changes (w.r.t. TBB 2.1 U2 commercial-aligned release):
|
||||
|
||||
- Added support for aligned allocations to the TBB memory allocator.
|
||||
- Added a special library to use with LD_PRELOAD on Linux* in order to
|
||||
replace the standard memory allocation routines in C/C++ with the
|
||||
TBB memory allocator.
|
||||
- Added null_mutex and null_rw_mutex: no-op classes interface-compliant
|
||||
to other TBB mutexes.
|
||||
- Improved performance of parallel_sort, to close most of the serial gap
|
||||
with std::sort, and beat it on 2 and more cores.
|
||||
- A few other small changes.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- the problem where parallel_for hanged after exception throw
|
||||
if affinity_partitioner was used (1556).
|
||||
- get rid of VS warnings about mbstowcs deprecation (1560),
|
||||
as well as some other warnings.
|
||||
- operator== for concurrent_vector::iterator fixed to work correctly
|
||||
with different vector instances.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.1 Update 2 commercial-aligned release
|
||||
|
||||
Changes (w.r.t. TBB 2.1 U1 commercial-aligned release):
|
||||
|
||||
- Incorporates all open-source-release changes down to TBB 2.1 U1,
|
||||
except for:
|
||||
- 20081019 addition of enumerable_thread_specific;
|
||||
- Warning level for Microsoft* Visual C++* compiler raised to /W4 /Wp64;
|
||||
warnings found on this level were cleaned or suppressed.
|
||||
- Added TBB_runtime_interface_version API function.
|
||||
- Added new example: pipeline/square.
|
||||
- Added exception handling and cancellation support
|
||||
for parallel_do and pipeline.
|
||||
- Added copy constructor and [begin,end) constructor to concurrent_queue.
|
||||
- Added some support for beta version of Intel(R) Parallel Amplifier.
|
||||
- Added scripts to set environment for cross-compilation of 32-bit
|
||||
applications on 64-bit Linux with Intel(R) C++ Compiler.
|
||||
- Fixed semantics of concurrent_vector::clear() to not deallocate
|
||||
internal arrays. Fixed compact() to perform such deallocation later.
|
||||
- Fixed the issue with atomic<T*> when T is incomplete type.
|
||||
- Improved support for PowerPC* Macintosh*, including the fix
|
||||
for a bug in masked compare-and-swap reported by a customer.
|
||||
- As usual, a number of other improvements everywhere.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20081109 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Added new serial out of order filter for tbb::pipeline.
|
||||
- Fixed the issue with atomic<T*>::operator= reported at the forum.
|
||||
- Fixed the issue with using tbb::task::self() in task destructor
|
||||
reported at the forum.
|
||||
- A number of other improvements to code, tests, makefiles, examples
|
||||
and documents.
|
||||
|
||||
Open-source contributions integrated:
|
||||
- Changes in the memory allocator were partially integrated.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20081019 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Introduced enumerable_thread_specific<T>. This new class provides a
|
||||
wrapper around native thread local storage as well as iterators and
|
||||
ranges for accessing the thread local copies (1533).
|
||||
- Improved support for Intel(R) Threading Analysis Tools
|
||||
on Intel(R) 64 architecture.
|
||||
- Dependency from Microsoft* CRT was integrated to the libraries using
|
||||
manifests, to avoid issues if called from code that uses different
|
||||
version of Visual C++* runtime than the library.
|
||||
- Introduced new defines TBB_USE_ASSERT, TBB_USE_DEBUG,
|
||||
TBB_USE_PERFORMANCE_WARNINGS, TBB_USE_THREADING_TOOLS.
|
||||
- A number of other improvements to code, tests, makefiles, examples
|
||||
and documents.
|
||||
|
||||
Open-source contributions integrated:
|
||||
|
||||
- linker optimization: /incremental:no .
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080925 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Same fix for a memory leak in the memory allocator as in TBB 2.1 U1.
|
||||
- Improved support for lambda functions.
|
||||
- Fixed more concurrent_queue issues reported at the forum.
|
||||
- A number of other improvements to code, tests, makefiles, examples
|
||||
and documents.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.1 Update 1 commercial-aligned release
|
||||
|
||||
Changes (w.r.t. TBB 2.1 Gold commercial-aligned release):
|
||||
|
||||
- Fixed small memory leak in the memory allocator.
|
||||
- Incorporates all open-source-release changes down to TBB 2.1 GOLD,
|
||||
except for:
|
||||
- 20080825 changes for parallel_do;
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080825 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Added exception handling and cancellation support for parallel_do.
|
||||
- Added default HashCompare template argument for concurrent_hash_map.
|
||||
- Fixed concurrent_queue.clear() issues due to incorrect assumption
|
||||
about clear() being private method.
|
||||
- Added the possibility to use TBB in applications that change
|
||||
default calling conventions (Windows* only).
|
||||
- Many improvements to code, tests, examples, makefiles and documents.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 120, 130 - memset declaration missed in concurrent_hash_map.h
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080724 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Inline assembly for atomic operations improved for gcc 4.3
|
||||
- A few more improvements to the code.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080709 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- operator=() was added to the tbb_thread class according to
|
||||
the current working draft for std::thread.
|
||||
- Recognizing SPARC* in makefiles for Linux* and Sun Solaris*.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 127 - concurrent_hash_map::range fixed to split correctly.
|
||||
|
||||
Open-source contributions integrated:
|
||||
|
||||
- fix_set_midpoint.diff by jyasskin
|
||||
- SPARC* support in makefiles by Raf Schietekat
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080622 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Fixed a hang that rarely happened on Linux
|
||||
during deinitialization of the TBB scheduler.
|
||||
- Improved support for Intel(R) Thread Checker.
|
||||
- A few more improvements to the code.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.1 GOLD commercial-aligned release
|
||||
|
||||
Changes (w.r.t. TBB 2.0 U3 commercial-aligned release):
|
||||
|
||||
- All open-source-release changes down to, and including, TBB 2.0 GOLD
|
||||
below, were incorporated into this release.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080605 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Explicit control of exported symbols by version scripts added on Linux.
|
||||
- Interfaces polished for exception handling & algorithm cancellation.
|
||||
- Cache behavior improvements in the scalable allocator.
|
||||
- Improvements in text_filter, polygon_overlay, and other examples.
|
||||
- A lot of other stability improvements in code, tests, and makefiles.
|
||||
- First release where binary packages include headers/docs/examples, so
|
||||
binary packages are now self-sufficient for using TBB.
|
||||
|
||||
Open-source contributions integrated:
|
||||
|
||||
- atomics patch (partially).
|
||||
- tick_count warning patch.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 118 - fix for boost compatibility.
|
||||
- 123 - fix for tbb_machine.h.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080512 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Fixed a problem with backward binary compatibility
|
||||
of debug Linux builds.
|
||||
- Sun* Studio* support added.
|
||||
- soname support added on Linux via linker script. To restore backward
|
||||
binary compatibility, *.so -> *.so.2 softlinks should be created.
|
||||
- concurrent_hash_map improvements - added few new forms of insert()
|
||||
method and fixed precondition and guarantees of erase() methods.
|
||||
Added runtime warning reporting about bad hash function used for
|
||||
the container. Various improvements for performance and concurrency.
|
||||
- Cancellation mechanism reworked so that it does not hurt scalability.
|
||||
- Algorithm parallel_do reworked. Requirement for Body::argument_type
|
||||
definition removed, and work item argument type can be arbitrarily
|
||||
cv-qualified.
|
||||
- polygon_overlay example added.
|
||||
- A few more improvements to code, tests, examples and Makefiles.
|
||||
|
||||
Open-source contributions integrated:
|
||||
|
||||
- Soname support patch for Bugzilla #112.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 112 - fix for soname support.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.0 U3 commercial-aligned release (package 017, April 20, 2008)
|
||||
|
||||
Corresponds to commercial 019 (for Linux*, 020; for Mac OS* X, 018)
|
||||
packages.
|
||||
|
||||
Changes (w.r.t. TBB 2.0 U2 commercial-aligned release):
|
||||
|
||||
- Does not contain open-source-release changes below; this release is
|
||||
only a minor update of TBB 2.0 U2.
|
||||
- Removed spin-waiting in pipeline and concurrent_queue.
|
||||
- A few more small bug fixes from open-source releases below.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080408 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- count_strings example reworked: new word generator implemented, hash
|
||||
function replaced, and tbb_allocator is used with std::string class.
|
||||
- Static methods of spin_rw_mutex were replaced by normal member
|
||||
functions, and the class name was versioned.
|
||||
- tacheon example was renamed to tachyon.
|
||||
- Improved support for Intel(R) Thread Checker.
|
||||
- A few more minor improvements.
|
||||
|
||||
Open-source contributions integrated:
|
||||
|
||||
- Two sets of Sun patches for IA Solaris support.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080402 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Exception handling and cancellation support for tasks and algorithms
|
||||
fully enabled.
|
||||
- Exception safety guaranties defined and fixed for all concurrent
|
||||
containers.
|
||||
- User-defined memory allocator support added to all concurrent
|
||||
containers.
|
||||
- Performance improvement of concurrent_hash_map, spin_rw_mutex.
|
||||
- Critical fix for a rare race condition during scheduler
|
||||
initialization/de-initialization.
|
||||
- New methods added for concurrent containers to be closer to STL,
|
||||
as well as automatic filters removal from pipeline
|
||||
and __TBB_AtomicAND function.
|
||||
- The volatile keyword dropped from where it is not really needed.
|
||||
- A few more minor improvements.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080319 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Support for gcc version 4.3 was added.
|
||||
- tbb_thread class, near compatible with std::thread expected in C++0x,
|
||||
was added.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 116 - fix for compilation issues with gcc version 4.2.1.
|
||||
- 120 - fix for compilation issues with gcc version 4.3.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080311 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- An enumerator added for pipeline filter types (serial vs. parallel).
|
||||
- New task_scheduler_observer class introduced, to observe when
|
||||
threads start and finish interacting with the TBB task scheduler.
|
||||
- task_scheduler_init reverted to not use internal versioned class;
|
||||
binary compatibility guaranteed with stable releases only.
|
||||
- Various improvements to code, tests, examples and Makefiles.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080304 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Task-to-thread affinity support, previously kept under a macro,
|
||||
now fully legalized.
|
||||
- Work-in-progress on cache_aligned_allocator improvements.
|
||||
- Pipeline really supports parallel input stage; it's no more serialized.
|
||||
- Various improvements to code, tests, examples and Makefiles.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 119 - fix for scalable_malloc sometimes failing to return a big block.
|
||||
- TR575 - fixed a deadlock occurring on Windows in startup/shutdown
|
||||
under some conditions.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080226 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Introduced tbb_allocator to select between standard allocator and
|
||||
tbb::scalable_allocator when available.
|
||||
- Removed spin-waiting in pipeline and concurrent_queue.
|
||||
- Improved performance of concurrent_hash_map by using tbb_allocator.
|
||||
- Improved support for Intel(R) Thread Checker.
|
||||
- Various improvements to code, tests, examples and Makefiles.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.0 U2 commercial-aligned release (package 017, February 14, 2008)
|
||||
|
||||
Corresponds to commercial 017 (for Linux*, 018; for Mac OS* X, 016)
|
||||
packages.
|
||||
|
||||
Changes (w.r.t. TBB 2.0 U1 commercial-aligned release):
|
||||
|
||||
- Does not contain open-source-release changes below; this release is
|
||||
only a minor update of TBB 2.0 U1.
|
||||
- Add support for Microsoft* Visual Studio* 2008, including binary
|
||||
libraries and VS2008 projects for examples.
|
||||
- Use SwitchToThread() not Sleep() to yield threads on Windows*.
|
||||
- Enhancements to Doxygen-readable comments in source code.
|
||||
- A few more small bug fixes from open-source releases below.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- TR569 - Memory leak in concurrent_queue.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080207 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Improvements and minor fixes in VS2008 projects for examples.
|
||||
- Improvements in code for gating worker threads that wait for work,
|
||||
previously consolidated under #if IMPROVED_GATING, now legalized.
|
||||
- Cosmetic changes in code, examples, tests.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 113 - Iterators and ranges should be convertible to their const
|
||||
counterparts.
|
||||
- TR569 - Memory leak in concurrent_queue.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080122 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Updated examples/parallel_for/seismic to improve the visuals and to
|
||||
use the affinity_partitioner (20071127 and forward) for better
|
||||
performance.
|
||||
- Minor improvements to unittests and performance tests.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20080115 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Cleanup, simplifications and enhancements to the Makefiles for
|
||||
building the libraries (see build/index.html for high-level
|
||||
changes) and the examples.
|
||||
- Use SwitchToThread() not Sleep() to yield threads on Windows*.
|
||||
- Engineering work-in-progress on exception safety/support.
|
||||
- Engineering work-in-progress on affinity_partitioner for
|
||||
parallel_reduce.
|
||||
- Engineering work-in-progress on improved gating for worker threads
|
||||
(idle workers now block in the OS instead of spinning).
|
||||
- Enhancements to Doxygen-readable comments in source code.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 102 - Support for parallel build with gmake -j
|
||||
- 114 - /Wp64 build warning on Windows*.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20071218 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Full support for Microsoft* Visual Studio* 2008 in open-source.
|
||||
Binaries for vc9/ will be available in future stable releases.
|
||||
- New recursive_mutex class.
|
||||
- Full support for 32-bit PowerMac including export files for builds.
|
||||
- Improvements to parallel_do.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20071206 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Support for Microsoft* Visual Studio* 2008 in building libraries
|
||||
from source as well as in vc9/ projects for examples.
|
||||
- Small fixes to the affinity_partitioner first introduced in 20071127.
|
||||
- Small fixes to the thread-stack size hook first introduced in 20071127.
|
||||
- Engineering work in progress on concurrent_vector.
|
||||
- Engineering work in progress on exception behavior.
|
||||
- Unittest improvements.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20071127 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- Task-to-thread affinity support (affinity partitioner) first appears.
|
||||
- More work on concurrent_vector.
|
||||
- New parallel_do algorithm (function-style version of parallel while)
|
||||
and parallel_do/parallel_preorder example.
|
||||
- New task_scheduler_init() hooks for getting default_num_threads() and
|
||||
for setting thread stack size.
|
||||
- Support for weak memory consistency models in the code base.
|
||||
- Futex usage in the task scheduler (Linux).
|
||||
- Started adding 32-bit PowerMac support.
|
||||
- Intel(R) 9.1 compilers are now the base supported Intel(R) compiler
|
||||
version.
|
||||
- TBB libraries added to link line automatically on Microsoft Windows*
|
||||
systems via #pragma comment linker directives.
|
||||
|
||||
Open-source contributions integrated:
|
||||
|
||||
- FreeBSD platform support patches.
|
||||
- AIX weak memory model patch.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 108 - Removed broken affinity.h reference.
|
||||
- 101 - Does not build on Debian Lenny (replaced arch with uname -m).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20071030 open-source release
|
||||
|
||||
Changes (w.r.t. previous open-source release):
|
||||
|
||||
- More work on concurrent_vector.
|
||||
- Better support for building with -Wall -Werror (or not) as desired.
|
||||
- A few fixes to eliminate extraneous warnings.
|
||||
- Begin introduction of versioning hooks so that the internal/API
|
||||
version is tracked via TBB_INTERFACE_VERSION. The newest binary
|
||||
libraries should always work with previously-compiled code when-
|
||||
ever possible.
|
||||
- Engineering work in progress on using futex inside the mutexes (Linux).
|
||||
- Engineering work in progress on exception behavior.
|
||||
- Engineering work in progress on a new parallel_do algorithm.
|
||||
- Unittest improvements.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20070927 open-source release
|
||||
|
||||
Changes:
|
||||
|
||||
- Minor update to TBB 2.0 U1 below.
|
||||
- Begin introduction of new concurrent_vector interfaces not released
|
||||
with TBB 2.0 U1.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.0 U1 commercial-aligned release (package 014, October 1, 2007)
|
||||
|
||||
Corresponds to commercial 014 (for Linux*, 016) packages.
|
||||
|
||||
Changes (w.r.t. previous commercial-aligned release):
|
||||
|
||||
- All open-source-release changes down to, and including, TBB 2.0 GOLD
|
||||
below, were incorporated into this release.
|
||||
- Made a number of changes to the officially supported OS list:
|
||||
Added Linux* OSs:
|
||||
Asianux* 3, Debian* 4.0, Fedora Core* 6, Fedora* 7,
|
||||
Turbo Linux* 11, Ubuntu* 7.04;
|
||||
Dropped Linux* OSs:
|
||||
Asianux* 2, Fedora Core* 4, Haansoft* Linux 2006 Server,
|
||||
Mandriva/Mandrake* 10.1, Miracle Linux* 4.0,
|
||||
Red Flag* DC Server 5.0;
|
||||
Only Mac OS* X 10.4.9 (and forward) and Xcode* tool suite 2.4.1 (and
|
||||
forward) are now supported.
|
||||
- Commercial installers on Linux* fixed to recommend the correct
|
||||
binaries to use in more cases, with less unnecessary warnings.
|
||||
- Changes to eliminate spurious build warnings.
|
||||
|
||||
Open-source contributions integrated:
|
||||
|
||||
- Two small header guard macro patches; it also fixed bug #94.
|
||||
- New blocked_range3d class.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 93 - Removed misleading comments in task.h.
|
||||
- 94 - See above.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20070815 open-source release
|
||||
|
||||
Changes:
|
||||
|
||||
- Changes to eliminate spurious build warnings.
|
||||
- Engineering work in progress on concurrent_vector allocator behavior.
|
||||
- Added hooks to use the Intel(R) compiler code coverage tools.
|
||||
|
||||
Open-source contributions integrated:
|
||||
|
||||
- Mac OS* X build warning patch.
|
||||
|
||||
Bugs fixed:
|
||||
|
||||
- 88 - Fixed TBB compilation errors if both VS2005 and Windows SDK are
|
||||
installed.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
20070719 open-source release
|
||||
|
||||
Changes:
|
||||
|
||||
- Minor update to TBB 2.0 GOLD below.
|
||||
- Changes to eliminate spurious build warnings.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
TBB 2.0 GOLD commercial-aligned release (package 010, July 19, 2007)
|
||||
|
||||
Corresponds to commercial 010 (for Linux*, 012) packages.
|
||||
|
||||
- TBB open-source debut release.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
* Other names and brands may be claimed as the property of others.
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
# This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
if(WIN32 AND MSVC)
|
||||
# VS100 uses MSBuild.exe instead of devenv.com, so force it to use devenv.com
|
||||
if(VS100_FOUND)
|
||||
set(TBB_BUILD_TOOL ${VS100_DIR}/devenv.com)
|
||||
set(TBB_SOURCE <SOURCE_DIR>\\build\\vs100project)
|
||||
else()
|
||||
set(TBB_BUILD_TOOL ${CMAKE_BUILD_TOOL})
|
||||
set(TBB_SOURCE <SOURCE_DIR>\\build\\vsproject)
|
||||
endif()
|
||||
|
||||
if(PLATFORM MATCHES X86)
|
||||
set(TBB_CONFIGURATION Win32)
|
||||
else()
|
||||
set(TBB_CONFIGURATION x64)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(TBB_Project
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DOWNLOAD_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
ExternalProject_Add_Step(TBB_Project TBB_Upgrade
|
||||
COMMAND ${TBB_BUILD_TOOL} ${TBB_SOURCE}\\makefile.sln /upgrade
|
||||
ALWAYS 0
|
||||
)
|
||||
ExternalProject_Add_Step(TBB_Project TBB_Build
|
||||
DEPENDEES TBB_Upgrade
|
||||
COMMAND ${TBB_BUILD_TOOL} ${TBB_SOURCE}\\makefile.sln /project tbb /build ${CMAKE_BUILD_TYPE}|${TBB_CONFIGURATION}
|
||||
COMMAND ${TBB_BUILD_TOOL} ${TBB_SOURCE}\\makefile.sln /project tbbmalloc /build ${CMAKE_BUILD_TYPE}|${TBB_CONFIGURATION}
|
||||
ALWAYS 0
|
||||
)
|
||||
elseif(UNIX)
|
||||
if(APPLE)
|
||||
set(APPLE_BUILD cd <SOURCE_DIR>/build/libs_release && install_name_tool -id "<INSTALL_DIR>/lib/libtbb.dylib" libtbb.dylib && install_name_tool -id "<INSTALL_DIR>/lib/libtbbmalloc.dylib" libtbbmalloc.dylib && cd <SOURCE_DIR>/build/libs_debug && install_name_tool -id "<INSTALL_DIR>/lib/libtbb_debug.dylib" libtbb_debug.dylib && install_name_tool -id "<INSTALL_DIR>/lib/libtbbmalloc_debug.dylib" libtbbmalloc_debug.dylib)
|
||||
else()
|
||||
# Do nothing, but really 'nothing' makes infinite loops on Debian
|
||||
set(APPLE_BUILD cd .)
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TOOL MATCHES "/gmake")
|
||||
set(TBB_BUILD_TOOL gmake)
|
||||
else()
|
||||
set(TBB_BUILD_TOOL make)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(TBB_Project
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
|
||||
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
|
||||
DOWNLOAD_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ${TBB_BUILD_TOOL} -j2 -C <SOURCE_DIR> # export arch="ia32" &&
|
||||
INSTALL_COMMAND ${APPLE_BUILD}
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"This script doesn't support your system configuration to compile/install TBB."
|
||||
)
|
||||
endif()
|
||||
353
dep/tbb/COPYING
353
dep/tbb/COPYING
|
|
@ -1,353 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
---------------- END OF Gnu General Public License ----------------
|
||||
|
||||
The source code of Threading Building Blocks is distributed under version 2
|
||||
of the GNU General Public License, with the so-called "runtime exception,"
|
||||
as follows (or see any header or implementation file):
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
tbb_root?=.
|
||||
include $(tbb_root)/build/common.inc
|
||||
.PHONY: default all tbb tbbmalloc test examples
|
||||
|
||||
#workaround for non-depend targets tbb and tbbmalloc which both depend on version_string.tmp
|
||||
#According to documentation submakes should run in parallel
|
||||
.NOTPARALLEL: tbb tbbmalloc
|
||||
|
||||
default: tbb tbbmalloc
|
||||
|
||||
all: tbb tbbmalloc test examples
|
||||
|
||||
tbb: mkdir
|
||||
$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbb cfg=debug tbb_root=$(tbb_root)
|
||||
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbb cfg=release tbb_root=$(tbb_root)
|
||||
|
||||
tbbmalloc: mkdir
|
||||
$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc tbb_root=$(tbb_root)
|
||||
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc tbb_root=$(tbb_root)
|
||||
|
||||
test: tbb tbbmalloc
|
||||
-$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc_test tbb_root=$(tbb_root)
|
||||
-$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root)
|
||||
-$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_test tbb_root=$(tbb_root)
|
||||
-$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.test cfg=release tbb_root=$(tbb_root)
|
||||
|
||||
rml: mkdir
|
||||
$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.rml cfg=debug tbb_root=$(tbb_root)
|
||||
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.rml cfg=release tbb_root=$(tbb_root)
|
||||
|
||||
|
||||
examples: tbb tbbmalloc
|
||||
$(MAKE) -C examples -r -f Makefile tbb_root=.. release test
|
||||
|
||||
.PHONY: clean clean_examples mkdir info
|
||||
|
||||
clean: clean_examples
|
||||
$(shell $(RM) $(work_dir)_release$(SLASH)*.* >$(NUL) 2>$(NUL))
|
||||
$(shell $(RD) $(work_dir)_release >$(NUL) 2>$(NUL))
|
||||
$(shell $(RM) $(work_dir)_debug$(SLASH)*.* >$(NUL) 2>$(NUL))
|
||||
$(shell $(RD) $(work_dir)_debug >$(NUL) 2>$(NUL))
|
||||
@echo clean done
|
||||
|
||||
clean_examples:
|
||||
$(shell $(MAKE) -s -i -r -C examples -f Makefile tbb_root=.. clean >$(NUL) 2>$(NUL))
|
||||
|
||||
mkdir:
|
||||
$(shell $(MD) "$(work_dir)_release" >$(NUL) 2>$(NUL))
|
||||
$(if $(subst undefined,,$(origin_build_dir)),,cd "$(work_dir)_release" && $(MAKE_TBBVARS) $(tbb_build_prefix)_release)
|
||||
$(shell $(MD) "$(work_dir)_debug" >$(NUL) 2>$(NUL))
|
||||
$(if $(subst undefined,,$(origin_build_dir)),,cd "$(work_dir)_debug" && $(MAKE_TBBVARS) $(tbb_build_prefix)_debug)
|
||||
|
||||
info:
|
||||
@echo OS: $(tbb_os)
|
||||
@echo arch=$(arch)
|
||||
@echo compiler=$(compiler)
|
||||
@echo runtime=$(runtime)
|
||||
@echo tbb_build_prefix=$(tbb_build_prefix)
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
Threading Building Blocks - README
|
||||
|
||||
See index.html for directions and documentation.
|
||||
|
||||
If source is present (./Makefile and src/ directories),
|
||||
type 'gmake' in this directory to build and test.
|
||||
|
||||
See examples/index.html for runnable examples and directions.
|
||||
|
||||
See http://threadingbuildingblocks.org for full documentation
|
||||
and software information.
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
COMPILE_ONLY = -c -MMD
|
||||
PREPROC_ONLY = -E -x c
|
||||
INCLUDE_KEY = -I
|
||||
DEFINE_KEY = -D
|
||||
OUTPUT_KEY = -o #
|
||||
OUTPUTOBJ_KEY = -o #
|
||||
PIC_KEY = -fPIC
|
||||
WARNING_AS_ERROR_KEY = -Werror
|
||||
WARNING_KEY = -Wall
|
||||
DYLIB_KEY = -shared
|
||||
|
||||
TBB_NOSTRICT = 1
|
||||
|
||||
CPLUS = g++
|
||||
CONLY = gcc
|
||||
LIB_LINK_FLAGS = -shared
|
||||
LIBS = -lpthread
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = -O2 -DUSE_PTHREAD
|
||||
endif
|
||||
ifeq ($(cfg), debug)
|
||||
CPLUS_FLAGS = -DTBB_USE_DEBUG -g -O0 -DUSE_PTHREAD
|
||||
endif
|
||||
|
||||
ASM=
|
||||
ASM_FLAGS=
|
||||
|
||||
TBB_ASM.OBJ=
|
||||
|
||||
ifeq (ia64,$(arch))
|
||||
# Position-independent code (PIC) is a must on IA-64, even for regular (not shared) executables
|
||||
CPLUS_FLAGS += $(PIC_KEY)
|
||||
endif
|
||||
|
||||
ifeq (intel64,$(arch))
|
||||
CPLUS_FLAGS += -m64
|
||||
LIB_LINK_FLAGS += -m64
|
||||
endif
|
||||
|
||||
ifeq (ia32,$(arch))
|
||||
CPLUS_FLAGS += -m32
|
||||
LIB_LINK_FLAGS += -m32
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
ASSEMBLY_SOURCE=$(arch)-gas
|
||||
ifeq (ia64,$(arch))
|
||||
ASM=as
|
||||
TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o
|
||||
endif
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
ifndef arch
|
||||
ifeq ($(shell uname -m),i386)
|
||||
export arch:=ia32
|
||||
endif
|
||||
ifeq ($(shell uname -m),ia64)
|
||||
export arch:=ia64
|
||||
endif
|
||||
ifeq ($(shell uname -m),amd64)
|
||||
export arch:=intel64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef runtime
|
||||
gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//')
|
||||
os_version:=$(shell uname -r)
|
||||
os_kernel_version:=$(shell uname -r | sed -e 's/-.*$$//')
|
||||
export runtime:=cc$(gcc_version)_kernel$(os_kernel_version)
|
||||
endif
|
||||
|
||||
native_compiler := gcc
|
||||
export compiler ?= gcc
|
||||
debugger ?= gdb
|
||||
|
||||
CMD=$(SHELL) -c
|
||||
CWD=$(shell pwd)
|
||||
RM?=rm -f
|
||||
RD?=rmdir
|
||||
MD?=mkdir -p
|
||||
NUL= /dev/null
|
||||
SLASH=/
|
||||
MAKE_VERSIONS=sh $(tbb_root)/build/version_info_linux.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp
|
||||
MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh
|
||||
|
||||
ifdef LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH := .:$(LD_LIBRARY_PATH)
|
||||
else
|
||||
export LD_LIBRARY_PATH := .
|
||||
endif
|
||||
|
||||
####### Build settings ########################################################
|
||||
|
||||
OBJ = o
|
||||
DLL = so
|
||||
|
||||
TBB.DEF =
|
||||
TBB.DLL = libtbb$(DEBUG_SUFFIX).$(DLL)
|
||||
TBB.LIB = $(TBB.DLL)
|
||||
LINK_TBB.LIB = $(TBB.LIB)
|
||||
|
||||
MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL)
|
||||
MALLOC.LIB = $(MALLOC.DLL)
|
||||
|
||||
TBB_NOSTRICT=1
|
||||
|
||||
TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
tbb_root ?= $(TBB22_INSTALL_DIR)
|
||||
BUILDING_PHASE=1
|
||||
include $(tbb_root)/build/common.inc
|
||||
DEBUG_SUFFIX=$(findstring _debug,_$(cfg))
|
||||
|
||||
# default target
|
||||
default_rml: rml rml_test
|
||||
|
||||
RML_ROOT ?= $(tbb_root)/src/rml
|
||||
RML_SERVER_ROOT = $(RML_ROOT)/server
|
||||
|
||||
VPATH = $(tbb_root)/src/tbb $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE)
|
||||
VPATH += $(RML_ROOT)/server $(RML_ROOT)/client $(RML_ROOT)/test
|
||||
|
||||
include $(tbb_root)/build/common_rules.inc
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Define rules for making the RML server shared library and client objects.
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
# Object files that make up RML server
|
||||
RML_SERVER.OBJ = rml_server.$(OBJ)
|
||||
|
||||
# Object files that RML clients need
|
||||
RML_TBB_CLIENT.OBJ = rml_tbb.$(OBJ) dynamic_link.$(OBJ)
|
||||
RML_OMP_CLIENT.OBJ = rml_omp.$(OBJ) omp_dynamic_link.$(OBJ)
|
||||
|
||||
RML.OBJ = $(RML_SERVER.OBJ) $(RML_TBB_CLIENT.OBJ) $(RML_OMP_CLIENT.OBJ)
|
||||
ifeq (windows,$(tbb_os))
|
||||
RML_ASM.OBJ = $(if $(findstring intel64,$(arch)),$(TBB_ASM.OBJ))
|
||||
endif
|
||||
ifeq (linux,$(tbb_os))
|
||||
RML_ASM.OBJ = $(if $(findstring ia64,$(arch)),$(TBB_ASM.OBJ))
|
||||
endif
|
||||
|
||||
RML_TBB_DEP= cache_aligned_allocator_rml.$(OBJ) dynamic_link_rml.$(OBJ) concurrent_vector_rml.$(OBJ) tbb_misc_rml.$(OBJ)
|
||||
TBB_DEP_NON_RML_TEST= cache_aligned_allocator_rml.$(OBJ) dynamic_link_rml.$(OBJ) $(RML_ASM.OBJ)
|
||||
TBB_DEP_RML_TEST= $(RML_ASM.OBJ)
|
||||
ifeq ($(cfg),debug)
|
||||
RML_TBB_DEP+= spin_mutex_rml.$(OBJ)
|
||||
TBB_DEP_NON_RML_TEST+= tbb_misc_rml.$(OBJ)
|
||||
TBB_DEP_RML_TEST+= tbb_misc_rml.$(OBJ)
|
||||
endif
|
||||
LIBS += $(LIBDL)
|
||||
|
||||
INCLUDES += $(INCLUDE_KEY)$(RML_ROOT)/include $(INCLUDE_KEY).
|
||||
T_INCLUDES = $(INCLUDES) $(INCLUDE_KEY)$(tbb_root)/src/test $(INCLUDE_KEY)$(RML_SERVER_ROOT)
|
||||
WARNING_SUPPRESS += $(RML_WARNING_SUPPRESS)
|
||||
|
||||
# Suppress superfluous warnings for RML compilation
|
||||
R_CPLUS_FLAGS = $(subst DO_ITT_NOTIFY,DO_ITT_NOTIFY=0,$(CPLUS_FLAGS_NOSTRICT)) $(WARNING_SUPPRESS) \
|
||||
$(DEFINE_KEY)TBB_USE_THREADING_TOOLS=0 $(DEFINE_KEY)__TBB_RML_STATIC=1 $(DEFINE_KEY)__TBB_NO_IMPLICIT_LINKAGE=1
|
||||
|
||||
%.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(R_CPLUS_FLAGS) $(PIC_KEY) $(INCLUDES) $<
|
||||
|
||||
tbb_misc_rml.$(OBJ): version_string.tmp
|
||||
|
||||
RML_TEST.OBJ = test_job_automaton.$(OBJ) test_thread_monitor.$(OBJ) test_rml_tbb.$(OBJ) test_rml_omp.$(OBJ) test_rml_mixed.$(OBJ)
|
||||
|
||||
$(RML_TBB_DEP): %_rml.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(OUTPUTOBJ_KEY)$@ $(R_CPLUS_FLAGS) $(PIC_KEY) $(INCLUDES) $<
|
||||
|
||||
$(RML_TEST.OBJ): %.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(R_CPLUS_FLAGS) $(PIC_KEY) $(T_INCLUDES) $<
|
||||
|
||||
ifneq (,$(RML.DEF))
|
||||
rml.def: $(RML.DEF)
|
||||
$(CMD) "$(CPLUS) $(PREPROC_ONLY) $(RML.DEF) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >rml.def 2>$(NUL) || exit 0"
|
||||
|
||||
LIB_LINK_FLAGS += $(EXPORT_KEY)rml.def
|
||||
$(RML.DLL): rml.def
|
||||
endif
|
||||
|
||||
$(RML.DLL): BUILDING_LIBRARY = $(RML.DLL)
|
||||
$(RML.DLL): $(RML_TBB_DEP) $(RML_SERVER.OBJ) $(RML.RES) $(RML_NO_VERSION.DLL) $(RML_ASM.OBJ)
|
||||
$(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(RML.DLL) $(RML_SERVER.OBJ) $(RML_TBB_DEP) $(RML_ASM.OBJ) $(RML.RES) $(LIB_LINK_LIBS) $(LIB_LINK_FLAGS)
|
||||
|
||||
ifneq (,$(RML_NO_VERSION.DLL))
|
||||
$(RML_NO_VERSION.DLL):
|
||||
echo "INPUT ($(RML.DLL))" > $(RML_NO_VERSION.DLL)
|
||||
endif
|
||||
|
||||
rml: $(RML.DLL) $(RML_TBB_CLIENT.OBJ) $(RML_OMP_CLIENT.OBJ)
|
||||
|
||||
#------------------------------------------------------
|
||||
# End of rules for making the RML server shared library
|
||||
#------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------
|
||||
# Define rules for making the RML unit tests
|
||||
#------------------------------------------------------
|
||||
|
||||
add_debug=$(basename $(1))_debug$(suffix $(1))
|
||||
cross_suffix=$(if $(crosstest),$(if $(DEBUG_SUFFIX),$(subst _debug,,$(1)),$(call add_debug,$(1))),$(1))
|
||||
|
||||
RML_TESTS = test_job_automaton.exe test_thread_monitor.exe test_rml_tbb.exe test_rml_omp.exe test_rml_mixed.exe test_rml_omp_c_linkage.exe
|
||||
|
||||
test_rml_tbb.exe: test_rml_tbb.$(OBJ) $(RML_TBB_CLIENT.OBJ) $(TBB_DEP_RML_TEST)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) test_rml_tbb.$(OBJ) $(RML_TBB_CLIENT.OBJ) $(TBB_DEP_RML_TEST) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
test_rml_omp.exe: test_rml_omp.$(OBJ) $(RML_OMP_CLIENT.OBJ) $(TBB_DEP_NON_RML_TEST)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) test_rml_omp.$(OBJ) $(RML_OMP_CLIENT.OBJ) $(TBB_DEP_NON_RML_TEST) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
test_rml_mixed.exe: test_rml_mixed.$(OBJ) $(RML_TBB_CLIENT.OBJ) $(RML_OMP_CLIENT.OBJ) $(TBB_DEP_RML_TEST)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) test_rml_mixed.$(OBJ) $(RML_TBB_CLIENT.OBJ) $(RML_OMP_CLIENT.OBJ) $(TBB_DEP_RML_TEST) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
rml_omp_stub.$(OBJ): rml_omp_stub.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(M_CPLUS_FLAGS) $(WARNING_SUPPRESS) $(T_INCLUDES) $(PIC_KEY) $<
|
||||
|
||||
test_rml_omp_c_linkage.exe: test_rml_omp_c_linkage.$(OBJ) rml_omp_stub.$(OBJ)
|
||||
$(CONLY) $(C_FLAGS) $(OUTPUT_KEY)$@ test_rml_omp_c_linkage.$(OBJ) rml_omp_stub.$(OBJ)
|
||||
|
||||
test_%.exe: test_%.$(OBJ) $(TBB_DEP_NON_RML_TEST)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(TBB_DEP_NON_RML_TEST) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
### run_cmd is usually empty
|
||||
rml_test: $(call cross_suffix,$(RML.DLL)) $(RML_TESTS)
|
||||
$(run_cmd) ./test_job_automaton.exe
|
||||
$(run_cmd) ./test_thread_monitor.exe
|
||||
$(run_cmd) ./test_rml_tbb.exe
|
||||
$(run_cmd) ./test_rml_omp.exe
|
||||
$(run_cmd) ./test_rml_mixed.exe
|
||||
$(run_cmd) ./test_rml_omp_c_linkage.exe
|
||||
|
||||
#------------------------------------------------------
|
||||
# End of rules for making the TBBMalloc unit tests
|
||||
#------------------------------------------------------
|
||||
|
||||
# Include automatically generated dependences
|
||||
-include *.d
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Define rules for making the TBB shared library.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tbb_root ?= "$(TBB22_INSTALL_DIR)"
|
||||
BUILDING_PHASE=1
|
||||
include $(tbb_root)/build/common.inc
|
||||
DEBUG_SUFFIX=$(findstring _debug,_$(cfg))
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Define static pattern rules dealing with .cpp source files
|
||||
#------------------------------------------------------------
|
||||
# MaNGOS changes
|
||||
# $(warning CONFIG: cfg=$(cfg) arch=$(arch) compiler=$(compiler) os=$(tbb_os) runtime=$(runtime))
|
||||
# MaNGOS changes end
|
||||
|
||||
default_tbb: $(TBB.DLL)
|
||||
.PHONY: default_tbb tbbvars clean
|
||||
.PRECIOUS: %.$(OBJ)
|
||||
|
||||
VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb $(tbb_root)/src/old $(tbb_root)/src/rml/client
|
||||
|
||||
CPLUS_FLAGS += $(PIC_KEY) $(DEFINE_KEY)__TBB_BUILD=1
|
||||
|
||||
ifeq (1,$(TBB_NOSTRICT))
|
||||
# GNU 3.2.3 headers have a ISO syntax that is rejected by Intel compiler in -strict_ansi mode.
|
||||
# The Mac uses gcc, so the list is empty for that platform.
|
||||
# The files below need the -strict_ansi flag downgraded to -ansi to compile
|
||||
|
||||
KNOWN_NOSTRICT = concurrent_hash_map.o \
|
||||
concurrent_queue.o \
|
||||
concurrent_vector_v2.o \
|
||||
concurrent_vector.o
|
||||
|
||||
endif
|
||||
|
||||
# Object files (that were compiled from C++ code) that gmake up TBB
|
||||
TBB_CPLUS.OBJ = concurrent_hash_map.$(OBJ) \
|
||||
concurrent_queue.$(OBJ) \
|
||||
concurrent_vector.$(OBJ) \
|
||||
dynamic_link.$(OBJ) \
|
||||
itt_notify.$(OBJ) \
|
||||
cache_aligned_allocator.$(OBJ) \
|
||||
pipeline.$(OBJ) \
|
||||
queuing_mutex.$(OBJ) \
|
||||
queuing_rw_mutex.$(OBJ) \
|
||||
spin_rw_mutex.$(OBJ) \
|
||||
spin_mutex.$(OBJ) \
|
||||
task.$(OBJ) \
|
||||
tbb_misc.$(OBJ) \
|
||||
mutex.$(OBJ) \
|
||||
recursive_mutex.$(OBJ) \
|
||||
tbb_thread.$(OBJ) \
|
||||
itt_notify_proxy.$(OBJ) \
|
||||
private_server.$(OBJ) \
|
||||
rml_tbb.$(OBJ)
|
||||
|
||||
# OLD/Legacy object files for backward binary compatibility
|
||||
ifeq (,$(findstring $(DEFINE_KEY)TBB_NO_LEGACY,$(CPLUS_FLAGS)))
|
||||
TBB_CPLUS_OLD.OBJ = \
|
||||
concurrent_vector_v2.$(OBJ) \
|
||||
concurrent_queue_v2.$(OBJ) \
|
||||
spin_rw_mutex_v2.$(OBJ)
|
||||
endif
|
||||
|
||||
# Object files that gmake up TBB (TBB_ASM.OBJ is platform-specific)
|
||||
TBB.OBJ = $(TBB_CPLUS.OBJ) $(TBB_CPLUS_OLD.OBJ) $(TBB_ASM.OBJ)
|
||||
|
||||
# Suppress superfluous warnings for TBB compilation
|
||||
WARNING_KEY += $(WARNING_SUPPRESS)
|
||||
|
||||
CXX_WARN_SUPPRESS = $(RML_WARNING_SUPPRESS)
|
||||
|
||||
include $(tbb_root)/build/common_rules.inc
|
||||
|
||||
ifneq (,$(TBB.DEF))
|
||||
tbb.def: $(TBB.DEF)
|
||||
$(CMD) "$(CPLUS) $(PREPROC_ONLY) $(TBB.DEF) $(INCLUDES) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >tbb.def 2>$(NUL) || exit 0"
|
||||
|
||||
LIB_LINK_FLAGS += $(EXPORT_KEY)tbb.def
|
||||
$(TBB.DLL): tbb.def
|
||||
endif
|
||||
|
||||
$(TBB.DLL): BUILDING_LIBRARY = $(TBB.DLL)
|
||||
$(TBB.DLL): $(TBB.OBJ) $(TBB.RES) tbbvars $(TBB_NO_VERSION.DLL)
|
||||
$(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(TBB.DLL) $(TBB.OBJ) $(TBB.RES) $(LIB_LINK_LIBS) $(LIB_LINK_FLAGS)
|
||||
|
||||
ifneq (,$(TBB_NO_VERSION.DLL))
|
||||
$(TBB_NO_VERSION.DLL):
|
||||
echo "INPUT ($(TBB.DLL))" > $(TBB_NO_VERSION.DLL)
|
||||
endif
|
||||
|
||||
#clean:
|
||||
# $(RM) *.$(OBJ) *.$(DLL) *.res *.map *.ilk *.pdb *.exp *.manifest *.tmp *.d core core.*[0-9][0-9]
|
||||
|
||||
# Include automatically generated dependences
|
||||
-include *.d
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
# default target
|
||||
default_malloc: malloc malloc_test
|
||||
|
||||
tbb_root ?= $(TBB22_INSTALL_DIR)
|
||||
BUILDING_PHASE=1
|
||||
TEST_RESOURCE = $(TBB.RES)
|
||||
include $(tbb_root)/build/common.inc
|
||||
DEBUG_SUFFIX=$(findstring _debug,_$(cfg))
|
||||
|
||||
MALLOC_ROOT ?= $(tbb_root)/src/tbbmalloc
|
||||
MALLOC_SOURCE_ROOT ?= $(MALLOC_ROOT)
|
||||
|
||||
VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb $(tbb_root)/src/test
|
||||
VPATH += $(MALLOC_ROOT) $(MALLOC_SOURCE_ROOT)
|
||||
|
||||
KNOWN_NOSTRICT = test_ScalableAllocator_STL.$(OBJ) test_malloc_compliance.$(OBJ) test_malloc_overload.$(OBJ)
|
||||
|
||||
CPLUS_FLAGS += $(if $(crosstest),$(DEFINE_KEY)__TBBMALLOC_NO_IMPLICIT_LINKAGE=1)
|
||||
|
||||
include $(tbb_root)/build/common_rules.inc
|
||||
|
||||
#------------------------------------------------------
|
||||
# Define rules for making the TBBMalloc shared library.
|
||||
#------------------------------------------------------
|
||||
|
||||
# Object files that make up TBBMalloc
|
||||
MALLOC_CPLUS.OBJ = tbbmalloc.$(OBJ) dynamic_link.$(OBJ)
|
||||
MALLOC_CUSTOM.OBJ += tbb_misc_malloc.$(OBJ)
|
||||
MALLOC_ASM.OBJ = $(TBB_ASM.OBJ)
|
||||
|
||||
# MALLOC_CPLUS.OBJ is built in two steps due to Intel Compiler Tracker # C69574
|
||||
MALLOC.OBJ := $(MALLOC_CPLUS.OBJ) $(MALLOC_ASM.OBJ) $(MALLOC_CUSTOM.OBJ) MemoryAllocator.$(OBJ) itt_notify_proxy.$(OBJ)
|
||||
MALLOC_CPLUS.OBJ += MemoryAllocator.$(OBJ)
|
||||
PROXY.OBJ := proxy.$(OBJ) tbb_function_replacement.$(OBJ)
|
||||
M_CPLUS_FLAGS := $(subst $(WARNING_KEY),,$(M_CPLUS_FLAGS)) $(DEFINE_KEY)__TBB_BUILD=1
|
||||
M_INCLUDES = $(INCLUDES) $(INCLUDE_KEY)$(MALLOC_ROOT) $(INCLUDE_KEY)$(MALLOC_SOURCE_ROOT)
|
||||
|
||||
# Suppress superfluous warnings for TBBmalloc compilation
|
||||
$(MALLOC.OBJ): M_CPLUS_FLAGS += $(WARNING_SUPPRESS)
|
||||
|
||||
itt_notify_proxy.$(OBJ): C_FLAGS += $(PIC_KEY)
|
||||
|
||||
$(PROXY.OBJ): %.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS) $(PIC_KEY) $(M_INCLUDES) $<
|
||||
|
||||
$(MALLOC_CPLUS.OBJ): %.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(M_CPLUS_FLAGS) $(PIC_KEY) $(M_INCLUDES) $<
|
||||
|
||||
tbb_misc_malloc.$(OBJ): tbb_misc.cpp version_string.tmp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(subst -strict_ansi,-ansi,$(M_CPLUS_FLAGS)) $(PIC_KEY) $(OUTPUTOBJ_KEY)$@ $(INCLUDE_KEY). $(INCLUDES) $<
|
||||
|
||||
MALLOC_LINK_FLAGS = $(LIB_LINK_FLAGS)
|
||||
PROXY_LINK_FLAGS = $(LIB_LINK_FLAGS)
|
||||
|
||||
ifneq (,$(MALLOC.DEF))
|
||||
tbbmalloc.def: $(MALLOC.DEF)
|
||||
$(CMD) "$(CPLUS) $(PREPROC_ONLY) $(MALLOC.DEF) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >tbbmalloc.def 2>$(NUL) || exit 0"
|
||||
|
||||
MALLOC_LINK_FLAGS += $(EXPORT_KEY)tbbmalloc.def
|
||||
$(MALLOC.DLL): tbbmalloc.def
|
||||
endif
|
||||
|
||||
$(MALLOC.DLL): BUILDING_LIBRARY = $(MALLOC.DLL)
|
||||
$(MALLOC.DLL): $(MALLOC.OBJ) $(MALLOC.RES) $(MALLOC_NO_VERSION.DLL)
|
||||
$(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(MALLOC.DLL) $(MALLOC.OBJ) $(MALLOC.RES) $(LIB_LINK_LIBS) $(MALLOC_LINK_FLAGS)
|
||||
|
||||
ifneq (,$(MALLOCPROXY.DEF))
|
||||
tbbmallocproxy.def: $(MALLOCPROXY.DEF)
|
||||
$(CMD) "$(CPLUS) $(PREPROC_ONLY) $(MALLOCPROXY.DEF) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >tbbmallocproxy.def 2>$(NUL) || exit 0"
|
||||
|
||||
PROXY_LINK_FLAGS += $(EXPORT_KEY)tbbmallocproxy.def
|
||||
$(MALLOCPROXY.DLL): tbbmallocproxy.def
|
||||
endif
|
||||
|
||||
ifneq (,$(MALLOCPROXY.DLL))
|
||||
$(MALLOCPROXY.DLL): BUILDING_LIBRARY = $(MALLOCPROXY.DLL)
|
||||
$(MALLOCPROXY.DLL): $(PROXY.OBJ) $(MALLOCPROXY_NO_VERSION.DLL) $(MALLOC.DLL) $(MALLOC.RES)
|
||||
$(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(MALLOCPROXY.DLL) $(PROXY.OBJ) $(MALLOC.RES) $(LIB_LINK_LIBS) $(LINK_MALLOC.LIB) $(PROXY_LINK_FLAGS)
|
||||
|
||||
malloc: $(MALLOCPROXY.DLL)
|
||||
endif
|
||||
|
||||
ifneq (,$(MALLOC_NO_VERSION.DLL))
|
||||
$(MALLOC_NO_VERSION.DLL):
|
||||
echo "INPUT ($(MALLOC.DLL))" > $(MALLOC_NO_VERSION.DLL)
|
||||
endif
|
||||
|
||||
ifneq (,$(MALLOCPROXY_NO_VERSION.DLL))
|
||||
$(MALLOCPROXY_NO_VERSION.DLL):
|
||||
echo "INPUT ($(MALLOCPROXY.DLL))" > $(MALLOCPROXY_NO_VERSION.DLL)
|
||||
endif
|
||||
|
||||
malloc: $(MALLOC.DLL) $(MALLOCPROXY.DLL)
|
||||
|
||||
malloc_dll: $(MALLOC.DLL)
|
||||
|
||||
malloc_proxy_dll: $(MALLOCPROXY.DLL)
|
||||
|
||||
.PHONY: malloc malloc_dll malloc_proxy_dll
|
||||
|
||||
#------------------------------------------------------
|
||||
# End of rules for making the TBBMalloc shared library
|
||||
#------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------
|
||||
# Define rules for making the TBBMalloc unit tests
|
||||
#------------------------------------------------------
|
||||
|
||||
add_debug=$(basename $(1))_debug$(suffix $(1))
|
||||
cross_suffix=$(if $(crosstest),$(if $(DEBUG_SUFFIX),$(subst _debug,,$(1)),$(call add_debug,$(1))),$(1))
|
||||
|
||||
MALLOC_MAIN_TESTS = test_ScalableAllocator.$(TEST_EXT) test_ScalableAllocator_STL.$(TEST_EXT) test_malloc_compliance.$(TEST_EXT) test_malloc_regression.$(TEST_EXT)
|
||||
MALLOC_OVERLOAD_TESTS = test_malloc_overload.$(TEST_EXT) test_malloc_overload_proxy.$(TEST_EXT)
|
||||
|
||||
MALLOC_LIB = $(call cross_suffix,$(MALLOC.LIB))
|
||||
MALLOC_PROXY_LIB = $(call cross_suffix,$(MALLOCPROXY.LIB))
|
||||
|
||||
ifeq (windows.gcc,$(tbb_os).$(compiler))
|
||||
test_malloc_overload.$(TEST_EXT): LIBS += $(MALLOC_PROXY_LIB)
|
||||
endif
|
||||
|
||||
test_malloc_overload.$(TEST_EXT): test_malloc_overload.$(OBJ)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LIBDL) $(LIBS) $(LINK_FLAGS)
|
||||
test_malloc_overload_proxy.$(TEST_EXT): test_malloc_overload.$(OBJ) $(MALLOC_PROXY_LIB)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LIBDL) $(MALLOC_PROXY_LIB) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
test_malloc_whitebox.$(TEST_EXT): test_malloc_whitebox.cpp $(MALLOC_ASM.OBJ) tbb_misc_malloc.$(OBJ)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(M_CPLUS_FLAGS) $(M_INCLUDES) $^ $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
$(MALLOC_MAIN_TESTS): %.$(TEST_EXT): %.$(OBJ) $(MALLOC_LIB)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(MALLOC_LIB) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
ifeq (,$(NO_C_TESTS))
|
||||
MALLOC_C_TESTS = test_malloc_pure_c.$(TEST_EXT)
|
||||
|
||||
$(MALLOC_C_TESTS): %.$(TEST_EXT): %.$(OBJ) $(MALLOC_LIB)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LIBS) $(LINK_FLAGS)
|
||||
endif
|
||||
|
||||
# run_cmd is usually empty
|
||||
malloc_test: $(call cross_suffix,$(MALLOC.DLL)) $(MALLOC_MAIN_TESTS) $(MALLOC_C_TESTS) $(MALLOC_OVERLOAD_TESTS) test_malloc_whitebox.$(TEST_EXT) $(AUX_TEST_DEPENDENCIES)
|
||||
$(run_cmd) ./test_malloc_whitebox.$(TEST_EXT) 1:4
|
||||
$(run_cmd) $(TEST_LAUNCHER) -l $(call cross_suffix,$(MALLOCPROXY.DLL)) test_malloc_overload.$(TEST_EXT)
|
||||
$(run_cmd) $(TEST_LAUNCHER) test_malloc_overload_proxy.$(TEST_EXT)
|
||||
$(run_cmd) $(TEST_LAUNCHER) test_malloc_compliance.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_ScalableAllocator.$(TEST_EXT)
|
||||
$(run_cmd) ./test_ScalableAllocator_STL.$(TEST_EXT)
|
||||
$(run_cmd) ./test_malloc_regression.$(TEST_EXT)
|
||||
ifeq (,$(NO_C_TESTS))
|
||||
$(run_cmd) ./test_malloc_pure_c.$(TEST_EXT)
|
||||
endif
|
||||
|
||||
#------------------------------------------------------
|
||||
# End of rules for making the TBBMalloc unit tests
|
||||
#------------------------------------------------------
|
||||
|
||||
# Include automatically generated dependences
|
||||
-include *.d
|
||||
|
|
@ -1,310 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Define rules for making the TBB tests.
|
||||
#------------------------------------------------------------------------------
|
||||
.PHONY: default test_tbb_plain test_tbb_old clean
|
||||
|
||||
default: test_tbb_plain test_tbb_old
|
||||
|
||||
tbb_root ?= $(TBB22_INSTALL_DIR)
|
||||
BUILDING_PHASE=1
|
||||
TEST_RESOURCE = $(TBB.RES)
|
||||
include $(tbb_root)/build/common.inc
|
||||
DEBUG_SUFFIX=$(findstring _debug,$(call cross_cfg,_$(cfg)))
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Define static pattern rules dealing with .cpp source files
|
||||
#------------------------------------------------------------
|
||||
|
||||
VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb $(tbb_root)/src/rml/client $(tbb_root)/src/old $(tbb_root)/src/test $(tbb_root)/src/perf
|
||||
|
||||
CPLUS_FLAGS += $(if $(crosstest),$(DEFINE_KEY)__TBB_NO_IMPLICIT_LINKAGE=1)
|
||||
|
||||
ifeq (1,$(TBB_NOSTRICT))
|
||||
# GNU 3.2.3 headers have a ISO syntax that is rejected by Intel compiler in -strict_ansi mode.
|
||||
# The Mac uses gcc 4.0, so the list is empty for that platform.
|
||||
# The files below need the -strict_ansi flag downgraded to -ansi to compile
|
||||
|
||||
KNOWN_NOSTRICT += \
|
||||
test_concurrent_hash_map.o \
|
||||
test_concurrent_vector.o \
|
||||
test_concurrent_queue.o \
|
||||
test_enumerable_thread_specific.o \
|
||||
test_handle_perror.o \
|
||||
test_cache_aligned_allocator_STL.o \
|
||||
test_task_scheduler_init.o \
|
||||
test_model_plugin.o \
|
||||
test_parallel_do.o \
|
||||
test_lambda.o \
|
||||
test_eh_algorithms.o \
|
||||
test_parallel_sort.o \
|
||||
test_parallel_for_each.o \
|
||||
test_task_group.o \
|
||||
test_tbb_header.o \
|
||||
test_combinable.o \
|
||||
test_tbb_version.o
|
||||
|
||||
endif
|
||||
|
||||
include $(tbb_root)/build/common_rules.inc
|
||||
|
||||
# Rule for generating executable test
|
||||
%.$(TEST_EXT): %.$(OBJ) $(TBB.LIB)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LINK_TBB.LIB) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
# Rules for generating a test DLL
|
||||
%.$(DLL).$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(OUTPUTOBJ_KEY)$@ $(CPLUS_FLAGS_NOSTRICT) $(PIC_KEY) $(DEFINE_KEY)_USRDLL $(INCLUDES) $<
|
||||
%.$(DLL): %.$(DLL).$(OBJ) $(TBB.LIB)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $(PIC_KEY) $< $(LINK_TBB.LIB) $(LIBS) $(LINK_FLAGS) $(DYLIB_KEY)
|
||||
|
||||
# Rules for the tests, which use TBB in a dynamically loadable library
|
||||
test_model_plugin.$(TEST_EXT): test_model_plugin.$(OBJ) test_model_plugin.$(DLL)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LIBDL) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
TASK_CPP_DEPENDENCIES = $(TBB_ASM.OBJ) \
|
||||
cache_aligned_allocator.$(OBJ) \
|
||||
dynamic_link.$(OBJ) \
|
||||
tbb_misc.$(OBJ) \
|
||||
tbb_thread.$(OBJ) \
|
||||
itt_notify.$(OBJ) \
|
||||
mutex.$(OBJ) \
|
||||
spin_rw_mutex.$(OBJ) \
|
||||
spin_mutex.$(OBJ) \
|
||||
private_server.$(OBJ) \
|
||||
rml_tbb.$(OBJ)
|
||||
|
||||
ifeq (,$(codecov))
|
||||
TASK_CPP_DEPENDENCIES += itt_notify_proxy.$(OBJ)
|
||||
endif
|
||||
|
||||
# These executables don't depend on the TBB library, but include task.cpp directly
|
||||
TASK_CPP_DIRECTLY_INCLUDED = test_eh_tasks.$(TEST_EXT) \
|
||||
test_task_leaks.$(TEST_EXT) \
|
||||
test_task_assertions.$(TEST_EXT) \
|
||||
test_assembly.$(TEST_EXT)
|
||||
|
||||
$(TASK_CPP_DIRECTLY_INCLUDED): WARNING_KEY += $(WARNING_SUPPRESS)
|
||||
|
||||
$(TASK_CPP_DIRECTLY_INCLUDED): %.$(TEST_EXT) : %.$(OBJ) $(TASK_CPP_DEPENDENCIES)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LIBDL) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
test_handle_perror.$(TEST_EXT): test_handle_perror.$(OBJ) tbb_misc.$(OBJ) $(TBB_ASM.OBJ)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LINK_TBB.LIB) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
test_tbb_header2.$(OBJ): test_tbb_header.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS_NOSTRICT) $(CXX_ONLY_FLAGS) $(CXX_WARN_SUPPRESS) $(INCLUDES) $(DEFINE_KEY)__TBB_TEST_SECONDARY=1 $< $(OUTPUTOBJ_KEY)$@
|
||||
|
||||
# Detecting "multiple definition" linker error using the test that covers the whole library
|
||||
test_tbb_header.$(TEST_EXT): test_tbb_header.$(OBJ) test_tbb_header2.$(OBJ) $(TBB.LIB)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LINK_TBB.LIB) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
# Rules for the tests, which depend on tbbmalloc
|
||||
test_concurrent_hash_map_string.$(TEST_EXT): test_concurrent_hash_map_string.$(OBJ)
|
||||
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(LINK_TBB.LIB) $(MALLOC.LIB) $(LIBS) $(LINK_FLAGS)
|
||||
|
||||
# These are in alphabetical order
|
||||
TEST_TBB_PLAIN.EXE = test_assembly.$(TEST_EXT) \
|
||||
test_aligned_space.$(TEST_EXT) \
|
||||
test_task_assertions.$(TEST_EXT) \
|
||||
test_atomic.$(TEST_EXT) \
|
||||
test_blocked_range.$(TEST_EXT) \
|
||||
test_blocked_range2d.$(TEST_EXT) \
|
||||
test_blocked_range3d.$(TEST_EXT) \
|
||||
test_compiler.$(TEST_EXT) \
|
||||
test_concurrent_queue.$(TEST_EXT) \
|
||||
test_concurrent_vector.$(TEST_EXT) \
|
||||
test_concurrent_hash_map.$(TEST_EXT) \
|
||||
test_enumerable_thread_specific.$(TEST_EXT) \
|
||||
test_handle_perror.$(TEST_EXT) \
|
||||
test_halt.$(TEST_EXT) \
|
||||
test_lambda.$(TEST_EXT) \
|
||||
test_model_plugin.$(TEST_EXT) \
|
||||
test_mutex.$(TEST_EXT) \
|
||||
test_mutex_native_threads.$(TEST_EXT) \
|
||||
test_rwm_upgrade_downgrade.$(TEST_EXT) \
|
||||
test_cache_aligned_allocator_STL.$(TEST_EXT) \
|
||||
test_cache_aligned_allocator.$(TEST_EXT) \
|
||||
test_parallel_for.$(TEST_EXT) \
|
||||
test_parallel_reduce.$(TEST_EXT) \
|
||||
test_parallel_sort.$(TEST_EXT) \
|
||||
test_parallel_scan.$(TEST_EXT) \
|
||||
test_parallel_while.$(TEST_EXT) \
|
||||
test_parallel_do.$(TEST_EXT) \
|
||||
test_pipeline.$(TEST_EXT) \
|
||||
test_pipeline_with_tbf.$(TEST_EXT) \
|
||||
test_task_scheduler_init.$(TEST_EXT) \
|
||||
test_task_scheduler_observer.$(TEST_EXT) \
|
||||
test_task.$(TEST_EXT) \
|
||||
test_task_leaks.$(TEST_EXT) \
|
||||
test_tbb_thread.$(TEST_EXT) \
|
||||
test_tick_count.$(TEST_EXT) \
|
||||
test_inits_loop.$(TEST_EXT) \
|
||||
test_yield.$(TEST_EXT) \
|
||||
test_eh_tasks.$(TEST_EXT) \
|
||||
test_eh_algorithms.$(TEST_EXT) \
|
||||
test_parallel_invoke.$(TEST_EXT) \
|
||||
test_task_group.$(TEST_EXT) \
|
||||
test_ittnotify.$(TEST_EXT) \
|
||||
test_parallel_for_each.$(TEST_EXT) \
|
||||
test_tbb_header.$(TEST_EXT) \
|
||||
test_combinable.$(TEST_EXT) \
|
||||
test_task_auto_init.$(TEST_EXT) \
|
||||
test_tbb_version.$(TEST_EXT) # insert new files right above
|
||||
|
||||
ifdef OPENMP_FLAG
|
||||
TEST_TBB_PLAIN.EXE += test_tbb_openmp
|
||||
test_openmp.$(TEST_EXT): test_openmp.cpp
|
||||
$(CPLUS) $(OPENMP_FLAG) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $(INCLUDES) $< $(LIBS) $(LINK_TBB.LIB) $(LINK_FLAGS)
|
||||
.PHONY: test_tbb_openmp
|
||||
test_tbb_openmp: test_openmp.$(TEST_EXT)
|
||||
./test_openmp.$(TEST_EXT) 1:4
|
||||
|
||||
endif
|
||||
|
||||
# Run tests that are in TEST_TBB_PLAIN.EXE
|
||||
# The test are ordered so that simpler components are tested first.
|
||||
# If a component Y uses component X, then tests for Y should come after tests for X.
|
||||
# Note that usually run_cmd is empty, and tests run directly
|
||||
test_tbb_plain: $(TEST_TBB_PLAIN.EXE)
|
||||
$(run_cmd) ./test_assembly.$(TEST_EXT)
|
||||
$(run_cmd) ./test_compiler.$(TEST_EXT)
|
||||
# Yes, 4:8 is intended on the next line.
|
||||
$(run_cmd) ./test_yield.$(TEST_EXT) 4:8
|
||||
$(run_cmd) ./test_handle_perror.$(TEST_EXT)
|
||||
$(run_cmd) ./test_task_auto_init.$(TEST_EXT)
|
||||
$(run_cmd) ./test_task_scheduler_init.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_task_scheduler_observer.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_task_assertions.$(TEST_EXT)
|
||||
$(run_cmd) ./test_task.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_task_leaks.$(TEST_EXT)
|
||||
$(run_cmd) ./test_atomic.$(TEST_EXT)
|
||||
$(run_cmd) ./test_cache_aligned_allocator.$(TEST_EXT)
|
||||
$(run_cmd) ./test_cache_aligned_allocator_STL.$(TEST_EXT)
|
||||
$(run_cmd) ./test_blocked_range.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_blocked_range2d.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_blocked_range3d.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_parallel_for.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_parallel_sort.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_aligned_space.$(TEST_EXT)
|
||||
$(run_cmd) ./test_parallel_reduce.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_parallel_scan.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_parallel_while.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_parallel_do.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_inits_loop.$(TEST_EXT)
|
||||
$(run_cmd) ./test_lambda.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_mutex.$(TEST_EXT) 1
|
||||
$(run_cmd) ./test_mutex.$(TEST_EXT) 2
|
||||
$(run_cmd) ./test_mutex.$(TEST_EXT) 4
|
||||
$(run_cmd) ./test_mutex_native_threads.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_rwm_upgrade_downgrade.$(TEST_EXT) 4
|
||||
# Yes, 4:8 is intended on the next line.
|
||||
$(run_cmd) ./test_halt.$(TEST_EXT) 4:8
|
||||
$(run_cmd) ./test_pipeline.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_pipeline_with_tbf.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_tick_count.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_concurrent_queue.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_concurrent_vector.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_concurrent_hash_map.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_enumerable_thread_specific.$(TEST_EXT) 0:4
|
||||
$(run_cmd) ./test_combinable.$(TEST_EXT) 0:4
|
||||
$(run_cmd) ./test_model_plugin.$(TEST_EXT) 4
|
||||
$(run_cmd) ./test_eh_tasks.$(TEST_EXT) 2:4
|
||||
$(run_cmd) ./test_eh_algorithms.$(TEST_EXT) 2:4
|
||||
$(run_cmd) ./test_tbb_thread.$(TEST_EXT)
|
||||
$(run_cmd) ./test_parallel_invoke.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_task_group.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_ittnotify.$(TEST_EXT) 2:2
|
||||
$(run_cmd) ./test_parallel_for_each.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_tbb_header.$(TEST_EXT)
|
||||
$(run_cmd) ./test_tbb_version.$(TEST_EXT)
|
||||
|
||||
CPLUS_FLAGS_DEPRECATED = $(DEFINE_KEY)TBB_DEPRECATED=1 $(subst $(WARNING_KEY),,$(CPLUS_FLAGS_NOSTRICT)) $(WARNING_SUPPRESS)
|
||||
|
||||
TEST_TBB_OLD.OBJ = test_concurrent_vector_v2.$(OBJ) test_concurrent_queue_v2.$(OBJ) test_mutex_v2.$(OBJ)
|
||||
|
||||
TEST_TBB_DEPRECATED.OBJ = test_concurrent_queue_deprecated.$(OBJ) \
|
||||
test_concurrent_vector_deprecated.$(OBJ) \
|
||||
|
||||
|
||||
# For deprecated files, we don't mind warnings etc., thus compilation rules are most relaxed
|
||||
$(TEST_TBB_OLD.OBJ): %.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS_DEPRECATED) $(INCLUDES) $<
|
||||
|
||||
%_deprecated.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(OUTPUTOBJ_KEY)$@ $(CPLUS_FLAGS_DEPRECATED) $(INCLUDES) $<
|
||||
|
||||
TEST_TBB_OLD.EXE = $(subst .$(OBJ),.$(TEST_EXT),$(TEST_TBB_OLD.OBJ) $(TEST_TBB_DEPRECATED.OBJ))
|
||||
|
||||
ifeq (,$(NO_LEGACY_TESTS))
|
||||
test_tbb_old: $(TEST_TBB_OLD.EXE)
|
||||
$(run_cmd) ./test_concurrent_vector_v2.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_concurrent_vector_deprecated.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_concurrent_queue_v2.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_concurrent_queue_deprecated.$(TEST_EXT) 1:4
|
||||
$(run_cmd) ./test_mutex_v2.$(TEST_EXT) 1
|
||||
$(run_cmd) ./test_mutex_v2.$(TEST_EXT) 2
|
||||
$(run_cmd) ./test_mutex_v2.$(TEST_EXT) 4
|
||||
else
|
||||
test_tbb_old:
|
||||
@echo Legacy tests skipped
|
||||
endif
|
||||
|
||||
ifneq (,$(codecov))
|
||||
codecov_gen:
|
||||
profmerge
|
||||
codecov $(if $(findstring -,$(codecov)),$(codecov),) -demang -comp $(tbb_root)/build/codecov.txt
|
||||
endif
|
||||
|
||||
test_% debug_%: test_%.$(TEST_EXT) $(AUX_TEST_DEPENDENCIES)
|
||||
ifeq (,$(repeat))
|
||||
$(run_cmd) ./$< $(args)
|
||||
else
|
||||
ifeq (windows,$(tbb_os))
|
||||
for /L %%i in (1,1,$(repeat)) do echo %%i of $(repeat): && $(run_cmd) $< $(args)
|
||||
else
|
||||
for ((i=1;i<=$(repeat);++i)); do echo $$i of $(repeat): && $(run_cmd) ./$< $(args); done
|
||||
endif
|
||||
endif # repeat
|
||||
ifneq (,$(codecov))
|
||||
profmerge
|
||||
codecov $(if $(findstring -,$(codecov)),$(codecov),) -demang -comp $(tbb_root)/build/codecov.txt
|
||||
endif
|
||||
|
||||
time_%: time_%.$(TEST_EXT) $(AUX_TEST_DEPENDENCIES)
|
||||
$(run_cmd) ./$< $(args)
|
||||
|
||||
|
||||
clean_%:
|
||||
$(RM) $*.$(OBJ) $*.exe $*.$(DLL) $*.$(LIBEXT) $*.res $*.map $*.ilk $*.pdb $*.exp $*.*manifest $*.tmp $*.d
|
||||
|
||||
clean:
|
||||
$(RM) *.$(OBJ) *.exe *.$(DLL) *.$(LIBEXT) *.res *.map *.ilk *.pdb *.exp *.manifest *.tmp *.d pgopti.* *.dyn core core.*[0-9][0-9]
|
||||
|
||||
# Include automatically generated dependences
|
||||
-include *.d
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
COMPILE_ONLY = -c -MMD
|
||||
PREPROC_ONLY = -E -x c
|
||||
INCLUDE_KEY = -I
|
||||
DEFINE_KEY = -D
|
||||
OUTPUT_KEY = -o #
|
||||
OUTPUTOBJ_KEY = -o #
|
||||
PIC_KEY = -fPIC
|
||||
WARNING_AS_ERROR_KEY = -Werror
|
||||
WARNING_KEY = -Wall
|
||||
DYLIB_KEY = -shared
|
||||
LIBDL = -ldl
|
||||
|
||||
TBB_NOSTRICT = 1
|
||||
|
||||
CPLUS = g++
|
||||
LIB_LINK_FLAGS = -shared
|
||||
LIBS = -lpthread -lrt -ldl
|
||||
C_FLAGS = $(CPLUS_FLAGS) -x c
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = -O2 -DUSE_PTHREAD
|
||||
endif
|
||||
ifeq ($(cfg), debug)
|
||||
CPLUS_FLAGS = -DTBB_USE_DEBUG -g -O0 -DUSE_PTHREAD
|
||||
endif
|
||||
|
||||
ASM=
|
||||
ASM_FLAGS=
|
||||
|
||||
TBB_ASM.OBJ=
|
||||
|
||||
ifeq (ia64,$(arch))
|
||||
# Position-independent code (PIC) is a must for IA-64
|
||||
CPLUS_FLAGS += $(PIC_KEY)
|
||||
endif
|
||||
|
||||
ifeq (intel64,$(arch))
|
||||
CPLUS_FLAGS += -m64
|
||||
LIB_LINK_FLAGS += -m64
|
||||
endif
|
||||
|
||||
ifeq (ia32,$(arch))
|
||||
CPLUS_FLAGS += -m32
|
||||
LIB_LINK_FLAGS += -m32
|
||||
endif
|
||||
|
||||
# for some gcc versions on Solaris, -m64 may imply V9, but perhaps not everywhere (TODO: verify)
|
||||
ifeq (sparc,$(arch))
|
||||
CPLUS_FLAGS += -mcpu=v9 -m64
|
||||
LIB_LINK_FLAGS += -mcpu=v9 -m64
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
ASSEMBLY_SOURCE=$(arch)-gas
|
||||
ifeq (ia64,$(arch))
|
||||
ASM=ias
|
||||
TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o
|
||||
endif
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
ifndef arch
|
||||
arch:=$(shell uname -p)
|
||||
ifeq ($(arch),i386)
|
||||
ifeq ($(shell isainfo -b),64)
|
||||
arch:=intel64
|
||||
else
|
||||
arch:=ia32
|
||||
endif
|
||||
endif
|
||||
export arch
|
||||
# For non-IA systems running Sun OS, 'arch' will contain whatever is printed by uname -p.
|
||||
# In particular, for SPARC architecture it will contain "sparc".
|
||||
endif
|
||||
|
||||
ifndef runtime
|
||||
gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//')
|
||||
os_version:=$(shell uname -r)
|
||||
os_kernel_version:=$(shell uname -r | sed -e 's/-.*$$//')
|
||||
export runtime:=cc$(gcc_version)_kernel$(os_kernel_version)
|
||||
endif
|
||||
|
||||
native_compiler := suncc
|
||||
export compiler ?= suncc
|
||||
# debugger ?= gdb
|
||||
|
||||
CMD=$(SHELL) -c
|
||||
CWD=$(shell pwd)
|
||||
RM?=rm -f
|
||||
RD?=rmdir
|
||||
MD?=mkdir -p
|
||||
NUL= /dev/null
|
||||
SLASH=/
|
||||
MAKE_VERSIONS=bash $(tbb_root)/build/version_info_sunos.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp
|
||||
MAKE_TBBVARS=bash $(tbb_root)/build/generate_tbbvars.sh
|
||||
|
||||
ifeq ($(compiler),suncc)
|
||||
export TBB_CUSTOM_VARS_SH=CXXFLAGS="-I$(CWD)/../include -library=stlport4 $(CXXFLAGS) -M$(CWD)/../build/suncc.map.pause"
|
||||
export TBB_CUSTOM_VARS_CSH=CXXFLAGS "-I$(CWD)/../include -library=stlport4 $(CXXFLAGS) -M$(CWD)/../build/suncc.map.pause"
|
||||
endif
|
||||
|
||||
ifdef LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH := .:$(LD_LIBRARY_PATH)
|
||||
else
|
||||
export LD_LIBRARY_PATH := .
|
||||
endif
|
||||
|
||||
####### Build settings ########################################################
|
||||
|
||||
OBJ = o
|
||||
DLL = so
|
||||
|
||||
TBB.DEF =
|
||||
TBB.DLL = libtbb$(DEBUG_SUFFIX).$(DLL)
|
||||
TBB.LIB = $(TBB.DLL)
|
||||
LINK_TBB.LIB = $(TBB.LIB)
|
||||
|
||||
MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL)
|
||||
MALLOC.LIB = $(MALLOC.DLL)
|
||||
|
||||
MALLOCPROXY.DLL = libtbbmalloc_proxy$(DEBUG_SUFFIX).$(DLL)
|
||||
|
||||
TBB_NOSTRICT=1
|
||||
|
||||
TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
COMPILE_ONLY = -c -xMMD -errtags
|
||||
PREPROC_ONLY = -E -xMMD
|
||||
INCLUDE_KEY = -I
|
||||
DEFINE_KEY = -D
|
||||
OUTPUT_KEY = -o #
|
||||
OUTPUTOBJ_KEY = -o #
|
||||
PIC_KEY = -KPIC
|
||||
DYLIB_KEY = -G
|
||||
LIBDL = -ldl
|
||||
# WARNING_AS_ERROR_KEY = -errwarn=%all
|
||||
WARNING_AS_ERROR_KEY = Warning as error
|
||||
WARNING_SUPPRESS = -erroff=unassigned,attrskipunsup,badargtype2w,badbinaryopw,wbadasg,wvarhidemem
|
||||
tbb_strict=0
|
||||
|
||||
TBB_NOSTRICT = 1
|
||||
|
||||
CPLUS = CC
|
||||
CONLY = cc
|
||||
LIB_LINK_FLAGS = -G -R . -M$(tbb_root)/build/suncc.map.pause
|
||||
LINK_FLAGS += -M$(tbb_root)/build/suncc.map.pause
|
||||
LIBS = -lpthread -lrt -R .
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = -mt -xO2 -library=stlport4 -DUSE_PTHREAD $(WARNING_SUPPRESS)
|
||||
endif
|
||||
ifeq ($(cfg), debug)
|
||||
CPLUS_FLAGS = -mt -DTBB_USE_DEBUG -g -library=stlport4 -DUSE_PTHREAD $(WARNING_SUPPRESS)
|
||||
endif
|
||||
|
||||
ASM=
|
||||
ASM_FLAGS=
|
||||
|
||||
TBB_ASM.OBJ=
|
||||
|
||||
ifeq (intel64,$(arch))
|
||||
CPLUS_FLAGS += -m64
|
||||
ASM_FLAGS += -m64
|
||||
LIB_LINK_FLAGS += -m64
|
||||
endif
|
||||
|
||||
ifeq (ia32,$(arch))
|
||||
CPLUS_FLAGS += -m32
|
||||
LIB_LINK_FLAGS += -m32
|
||||
endif
|
||||
|
||||
# TODO: verify whether -m64 implies V9 on relevant Sun Studio versions
|
||||
# (those that handle gcc assembler syntax)
|
||||
ifeq (sparc,$(arch))
|
||||
CPLUS_FLAGS += -m64
|
||||
LIB_LINK_FLAGS += -m64
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
ASSEMBLY_SOURCE=$(arch)-fbe
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
M_INCLUDES = $(INCLUDES) -I$(MALLOC_ROOT) -I$(MALLOC_SOURCE_ROOT)
|
||||
M_CPLUS_FLAGS = $(CPLUS_FLAGS)
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
src/tbb
|
||||
src/tbbmalloc
|
||||
include/tbb
|
||||
src/rml/server
|
||||
src/rml/client
|
||||
src/rml/include
|
||||
source/malloc
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
ifndef tbb_os
|
||||
ifeq ($(OS), Windows_NT)
|
||||
export tbb_os=windows
|
||||
else
|
||||
OS:=$(shell uname)
|
||||
ifeq ($(OS),)
|
||||
$(error "$(OS) is not supported")
|
||||
else
|
||||
export tbb_os=$(OS)
|
||||
ifeq ($(OS), Linux)
|
||||
export tbb_os=linux
|
||||
endif
|
||||
ifeq ($(OS), Darwin)
|
||||
export tbb_os=macos
|
||||
endif
|
||||
endif # OS successfully detected
|
||||
endif # !Windows
|
||||
endif # !tbb_os
|
||||
|
||||
ifeq ($(wildcard $(tbb_root)/build/$(tbb_os).inc),)
|
||||
$(error "$(tbb_os)" is not supported. Add build/$(tbb_os).inc file with os-specific settings )
|
||||
endif
|
||||
|
||||
# detect arch and runtime versions, provide common os-specific definitions
|
||||
include $(tbb_root)/build/$(tbb_os).inc
|
||||
|
||||
ifeq ($(arch),)
|
||||
$(error Architecture not detected)
|
||||
endif
|
||||
ifeq ($(runtime),)
|
||||
$(error Runtime version not detected)
|
||||
endif
|
||||
ifeq ($(wildcard $(tbb_root)/build/$(tbb_os).$(compiler).inc),)
|
||||
$(error Compiler "$(compiler)" is not supported on $(tbb_os). Add build/$(tbb_os).$(compiler).inc file with compiler-specific settings )
|
||||
endif
|
||||
|
||||
# Support for running debug tests to release library and vice versa
|
||||
flip_cfg=$(subst _flipcfg,_release,$(subst _release,_debug,$(subst _debug,_flipcfg,$(1))))
|
||||
cross_cfg = $(if $(crosstest),$(call flip_cfg,$(1)),$(1))
|
||||
|
||||
ifdef BUILDING_PHASE
|
||||
# Setting default configuration to release
|
||||
cfg?=release
|
||||
# No lambas or other C++0x extensions by default for compilers that implement them as experimental features
|
||||
lambdas ?= 0
|
||||
cpp0x ?= 0
|
||||
# include compiler-specific build configurations
|
||||
-include $(tbb_root)/build/$(tbb_os).$(compiler).inc
|
||||
ifdef extra_inc
|
||||
-include $(tbb_root)/build/$(extra_inc)
|
||||
endif
|
||||
endif
|
||||
ifneq ($(BUILDING_PHASE),1)
|
||||
# definitions for top-level Makefiles
|
||||
origin_build_dir:=$(origin tbb_build_dir)
|
||||
tbb_build_dir?=$(tbb_root)$(SLASH)build
|
||||
tbb_build_prefix?=libs
|
||||
work_dir=$(tbb_build_dir)$(SLASH)$(tbb_build_prefix)
|
||||
ifneq ($(BUILDING_PHASE),0)
|
||||
work_dir:=$(work_dir)
|
||||
# assign new value for tbb_root if path is not absolute (the filter keeps only /* paths)
|
||||
ifeq ($(filter /% $(SLASH)%, $(subst :, ,$(tbb_root)) ),)
|
||||
ifeq ($(origin_build_dir),undefined)
|
||||
override tbb_root:=../..
|
||||
else
|
||||
override tbb_root:=$(CWD)/$(tbb_root)
|
||||
endif
|
||||
endif
|
||||
export tbb_root
|
||||
endif # BUILDING_PHASE != 0
|
||||
endif # BUILDING_PHASE != 1
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
.PRECIOUS: %.$(OBJ) %.$(DLL).$(OBJ) %.exe
|
||||
|
||||
ifeq ($(tbb_strict),1)
|
||||
ifeq ($(WARNING_AS_ERROR_KEY),)
|
||||
$(error WARNING_AS_ERROR_KEY is empty)
|
||||
endif
|
||||
# Do not remove line below!
|
||||
WARNING_KEY += $(WARNING_AS_ERROR_KEY)
|
||||
endif
|
||||
|
||||
ifndef TEST_EXT
|
||||
TEST_EXT = exe
|
||||
endif
|
||||
|
||||
INCLUDES += $(INCLUDE_KEY)$(tbb_root)/src $(INCLUDE_KEY)$(tbb_root)/src/rml/include $(INCLUDE_KEY)$(tbb_root)/include
|
||||
|
||||
CPLUS_FLAGS += $(WARNING_KEY) $(CXXFLAGS)
|
||||
LINK_FLAGS += $(LDFLAGS)
|
||||
LIB_LINK_FLAGS += $(LDFLAGS)
|
||||
CPLUS_FLAGS_NOSTRICT:=$(subst -strict_ansi,-ansi,$(CPLUS_FLAGS))
|
||||
|
||||
LIB_LINK_CMD ?= $(CPLUS) $(PIC_KEY)
|
||||
ifeq ($(origin LIB_OUTPUT_KEY), undefined)
|
||||
LIB_OUTPUT_KEY = $(OUTPUT_KEY)
|
||||
endif
|
||||
ifeq ($(origin LIB_LINK_LIBS), undefined)
|
||||
LIB_LINK_LIBS = $(LIBDL) $(LIBS)
|
||||
endif
|
||||
|
||||
CONLY ?= $(CPLUS)
|
||||
|
||||
# The most generic rules
|
||||
%.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(CXX_WARN_SUPPRESS) $(INCLUDES) $<
|
||||
|
||||
%.$(OBJ): %.c
|
||||
$(CONLY) $(COMPILE_ONLY) $(C_FLAGS) $(INCLUDES) $<
|
||||
|
||||
%.$(OBJ): %.asm
|
||||
$(ASM) $(ASM_FLAGS) $<
|
||||
|
||||
%.$(OBJ): %.s
|
||||
cpp <$< | grep -v '^#' >$*.tmp
|
||||
$(ASM) $(ASM_FLAGS) -o $@ $*.tmp
|
||||
rm $*.tmp
|
||||
|
||||
# Rule for generating .E file if needed for visual inspection
|
||||
%.E: %.cpp
|
||||
$(CPLUS) $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(INCLUDES) $(PREPROC_ONLY) $< >$@
|
||||
|
||||
# TODO Rule for generating .asm file if needed for visual inspection
|
||||
%.asm: %.cpp
|
||||
$(CPLUS) /c /Fa $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(INCLUDES) $<
|
||||
|
||||
# TODO Rule for generating .s file if needed for visual inspection
|
||||
%.s: %.cpp
|
||||
$(CPLUS) -S $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(INCLUDES) $<
|
||||
|
||||
# Customizations
|
||||
|
||||
ifeq (1,$(TBB_NOSTRICT))
|
||||
# GNU 3.2.3 headers have a ISO syntax that is rejected by Intel compiler in -strict_ansi mode.
|
||||
# The Mac uses gcc, so the list is empty for that platform.
|
||||
# The files below need the -strict_ansi flag downgraded to -ansi to compile
|
||||
|
||||
$(KNOWN_NOSTRICT): %.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS_NOSTRICT) $(CXX_ONLY_FLAGS) $(INCLUDES) $<
|
||||
endif
|
||||
|
||||
$(KNOWN_WARNINGS): %.$(OBJ): %.cpp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(subst $(WARNING_KEY),,$(CPLUS_FLAGS_NOSTRICT)) $(CXX_ONLY_FLAGS) $(INCLUDES) $<
|
||||
|
||||
tbb_misc.$(OBJ): tbb_misc.cpp version_string.tmp
|
||||
$(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS_NOSTRICT) $(CXX_ONLY_FLAGS) $(INCLUDE_KEY). $(INCLUDES) $<
|
||||
|
||||
tbb_misc.E: tbb_misc.cpp version_string.tmp
|
||||
$(CPLUS) $(CPLUS_FLAGS_NOSTRICT) $(CXX_ONLY_FLAGS) $(INCLUDE_KEY). $(INCLUDES) $(PREPROC_ONLY) $< >$@
|
||||
|
||||
%.res: %.rc version_string.tmp $(TBB.MANIFEST)
|
||||
rc /Fo$@ $(INCLUDES) $(filter /D%,$(CPLUS_FLAGS)) $<
|
||||
|
||||
tbbvars:
|
||||
$(MAKE_TBBVARS)
|
||||
|
||||
ifneq (,$(TBB.MANIFEST))
|
||||
$(TBB.MANIFEST):
|
||||
cmd /C "echo #include ^<stdio.h^> >tbbmanifest.c"
|
||||
cmd /C "echo int main(){return 0;} >>tbbmanifest.c"
|
||||
cl $(C_FLAGS) tbbmanifest.c
|
||||
|
||||
version_string.tmp: $(TBB.MANIFEST)
|
||||
$(MAKE_VERSIONS)
|
||||
cmd /C "echo #define TBB_MANIFEST 1 >> version_string.tmp"
|
||||
|
||||
else
|
||||
version_string.tmp:
|
||||
$(MAKE_VERSIONS)
|
||||
endif
|
||||
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
// Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
//
|
||||
// This file is part of Threading Building Blocks.
|
||||
//
|
||||
// Threading Building Blocks is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// version 2 as published by the Free Software Foundation.
|
||||
//
|
||||
// Threading Building Blocks is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Threading Building Blocks; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
function doWork() {
|
||||
var WshShell = WScript.CreateObject("WScript.Shell");
|
||||
|
||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
|
||||
var tmpExec;
|
||||
|
||||
if ( WScript.Arguments.Count() > 1 && WScript.Arguments(1) == "gcc" ) {
|
||||
if ( WScript.Arguments(0) == "/arch" ) {
|
||||
WScript.Echo( "ia32" );
|
||||
}
|
||||
else if ( WScript.Arguments(0) == "/runtime" ) {
|
||||
WScript.Echo( "mingw" );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//Compile binary
|
||||
tmpExec = WshShell.Exec("cmd /c echo int main(){return 0;} >detect.c");
|
||||
while ( tmpExec.Status == 0 ) {
|
||||
WScript.Sleep(100);
|
||||
}
|
||||
|
||||
tmpExec = WshShell.Exec("cl /MD detect.c /link /MAP");
|
||||
while ( tmpExec.Status == 0 ) {
|
||||
WScript.Sleep(100);
|
||||
}
|
||||
|
||||
if ( WScript.Arguments(0) == "/arch" ) {
|
||||
//read compiler banner
|
||||
var clVersion = tmpExec.StdErr.ReadAll();
|
||||
|
||||
//detect target architecture
|
||||
var intel64=/AMD64|EM64T|x64/mgi;
|
||||
var ia64=/IA-64|Itanium/mgi;
|
||||
var ia32=/80x86/mgi;
|
||||
if ( clVersion.match(intel64) ) {
|
||||
WScript.Echo( "intel64" );
|
||||
} else if ( clVersion.match(ia64) ) {
|
||||
WScript.Echo( "ia64" );
|
||||
} else if ( clVersion.match(ia32) ) {
|
||||
WScript.Echo( "ia32" );
|
||||
} else {
|
||||
WScript.Echo( "unknown" );
|
||||
}
|
||||
}
|
||||
|
||||
if ( WScript.Arguments(0) == "/runtime" ) {
|
||||
//read map-file
|
||||
var map = fso.OpenTextFile("detect.map", 1, 0);
|
||||
var mapContext = map.readAll();
|
||||
map.Close();
|
||||
|
||||
//detect runtime
|
||||
var vc71=/MSVCR71\.DLL/mgi;
|
||||
var vc80=/MSVCR80\.DLL/mgi;
|
||||
var vc90=/MSVCR90\.DLL/mgi;
|
||||
var vc100=/MSVCR100\.DLL/mgi;
|
||||
var psdk=/MSVCRT\.DLL/mgi;
|
||||
if ( mapContext.match(vc71) ) {
|
||||
WScript.Echo( "vc7.1" );
|
||||
} else if ( mapContext.match(vc80) ) {
|
||||
WScript.Echo( "vc8" );
|
||||
} else if ( mapContext.match(vc90) ) {
|
||||
WScript.Echo( "vc9" );
|
||||
} else if ( mapContext.match(vc100) ) {
|
||||
WScript.Echo( "vc10" );
|
||||
} else if ( mapContext.match(psdk) ) {
|
||||
// Our current naming convention assumes vc7.1 for 64-bit Windows PSDK
|
||||
WScript.Echo( "vc7.1" );
|
||||
} else {
|
||||
WScript.Echo( "unknown" );
|
||||
}
|
||||
}
|
||||
|
||||
// delete intermediate files
|
||||
if ( fso.FileExists("detect.c") )
|
||||
fso.DeleteFile ("detect.c", false);
|
||||
if ( fso.FileExists("detect.obj") )
|
||||
fso.DeleteFile ("detect.obj", false);
|
||||
if ( fso.FileExists("detect.map") )
|
||||
fso.DeleteFile ("detect.map", false);
|
||||
if ( fso.FileExists("detect.exe") )
|
||||
fso.DeleteFile ("detect.exe", false);
|
||||
if ( fso.FileExists("detect.exe.manifest") )
|
||||
fso.DeleteFile ("detect.exe.manifest", false);
|
||||
}
|
||||
|
||||
if ( WScript.Arguments.Count() > 0 ) {
|
||||
|
||||
try {
|
||||
doWork();
|
||||
} catch( error )
|
||||
{
|
||||
WScript.Echo( "unknown" );
|
||||
WScript.Quit( 0 );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
WScript.Echo( "/arch or /runtime should be set" );
|
||||
}
|
||||
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
@echo off
|
||||
REM
|
||||
REM Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
REM
|
||||
REM This file is part of Threading Building Blocks.
|
||||
REM
|
||||
REM Threading Building Blocks is free software; you can redistribute it
|
||||
REM and/or modify it under the terms of the GNU General Public License
|
||||
REM version 2 as published by the Free Software Foundation.
|
||||
REM
|
||||
REM Threading Building Blocks is distributed in the hope that it will be
|
||||
REM useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
REM of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
REM GNU General Public License for more details.
|
||||
REM
|
||||
REM You should have received a copy of the GNU General Public License
|
||||
REM along with Threading Building Blocks; if not, write to the Free Software
|
||||
REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
REM
|
||||
REM As a special exception, you may use this file as part of a free software
|
||||
REM library without restriction. Specifically, if other files instantiate
|
||||
REM templates or use macros or inline functions from this file, or you compile
|
||||
REM this file and link it with other files to produce an executable, this
|
||||
REM file does not by itself cause the resulting executable to be covered by
|
||||
REM the GNU General Public License. This exception does not however
|
||||
REM invalidate any other reasons why the executable file might be covered by
|
||||
REM the GNU General Public License.
|
||||
REM
|
||||
if exist tbbvars.bat exit
|
||||
echo Generating tbbvars.bat
|
||||
echo @echo off>tbbvars.bat
|
||||
setlocal
|
||||
for %%D in ("%tbb_root%") do set actual_root=%%~fD
|
||||
if x%1==x goto without
|
||||
|
||||
echo SET TBB22_INSTALL_DIR=%actual_root%>>tbbvars.bat
|
||||
echo SET TBB_ARCH_PLATFORM=%arch%\%runtime%>>tbbvars.bat
|
||||
echo SET INCLUDE=%%TBB22_INSTALL_DIR%%\include;%%INCLUDE%%>>tbbvars.bat
|
||||
echo SET LIB=%%TBB22_INSTALL_DIR%%\build\%1;%%LIB%%>>tbbvars.bat
|
||||
echo SET PATH=%%TBB22_INSTALL_DIR%%\build\%1;%%PATH%%>>tbbvars.bat
|
||||
|
||||
if exist tbbvars.sh goto skipsh
|
||||
set fslash_root=%actual_root:\=/%
|
||||
echo Generating tbbvars.sh
|
||||
echo #!/bin/sh>tbbvars.sh
|
||||
echo export TBB22_INSTALL_DIR="%fslash_root%">>tbbvars.sh
|
||||
echo TBB_ARCH_PLATFORM="%arch%\%runtime%">>tbbvars.sh
|
||||
echo if [ -z "${PATH}" ]; then>>tbbvars.sh
|
||||
echo export PATH="${TBB22_INSTALL_DIR}/build/%1">>tbbvars.sh
|
||||
echo else>>tbbvars.sh
|
||||
echo export PATH="${TBB22_INSTALL_DIR}/build/%1;$PATH">>tbbvars.sh
|
||||
echo fi>>tbbvars.sh
|
||||
echo if [ -z "${LIB}" ]; then>>tbbvars.sh
|
||||
echo export LIB="${TBB22_INSTALL_DIR}/build/%1">>tbbvars.sh
|
||||
echo else>>tbbvars.sh
|
||||
echo export LIB="${TBB22_INSTALL_DIR}/build/%1;$LIB">>tbbvars.sh
|
||||
echo fi>>tbbvars.sh
|
||||
echo if [ -z "${INCLUDE}" ]; then>>tbbvars.sh
|
||||
echo export INCLUDE="${TBB22_INSTALL_DIR}/include">>tbbvars.sh
|
||||
echo else>>tbbvars.sh
|
||||
echo export INCLUDE="${TBB22_INSTALL_DIR}/include;$INCLUDE">>tbbvars.sh
|
||||
echo fi>>tbbvars.sh
|
||||
:skipsh
|
||||
|
||||
if exist tbbvars.csh goto skipcsh
|
||||
echo Generating tbbvars.csh
|
||||
echo #!/bin/csh>tbbvars.csh
|
||||
echo setenv TBB22_INSTALL_DIR "%actual_root%">>tbbvars.csh
|
||||
echo setenv TBB_ARCH_PLATFORM "%arch%\%runtime%">>tbbvars.csh
|
||||
echo if (! $?PATH) then>>tbbvars.csh
|
||||
echo setenv PATH "${TBB22_INSTALL_DIR}\build\%1">>tbbvars.csh
|
||||
echo else>>tbbvars.csh
|
||||
echo setenv PATH "${TBB22_INSTALL_DIR}\build\%1;$PATH">>tbbvars.csh
|
||||
echo endif>>tbbvars.csh
|
||||
echo if (! $?LIB) then>>tbbvars.csh
|
||||
echo setenv LIB "${TBB22_INSTALL_DIR}\build\%1">>tbbvars.csh
|
||||
echo else>>tbbvars.csh
|
||||
echo setenv LIB "${TBB22_INSTALL_DIR}\build\%1;$LIB">>tbbvars.csh
|
||||
echo endif>>tbbvars.csh
|
||||
echo if (! $?INCLUDE) then>>tbbvars.csh
|
||||
echo setenv INCLUDE "${TBB22_INSTALL_DIR}\include">>tbbvars.csh
|
||||
echo else>>tbbvars.csh
|
||||
echo setenv INCLUDE "${TBB22_INSTALL_DIR}\include;$INCLUDE">>tbbvars.csh
|
||||
echo endif>>tbbvars.csh
|
||||
)
|
||||
:skipcsh
|
||||
exit
|
||||
|
||||
:without
|
||||
set bin_dir=%CD%
|
||||
echo SET tbb_root=%actual_root%>>tbbvars.bat
|
||||
echo SET tbb_bin=%bin_dir%>>tbbvars.bat
|
||||
echo SET TBB_ARCH_PLATFORM=%arch%\%runtime%>>tbbvars.bat
|
||||
echo SET INCLUDE="%%tbb_root%%\include";%%INCLUDE%%>>tbbvars.bat
|
||||
echo SET LIB="%%tbb_bin%%";%%LIB%%>>tbbvars.bat
|
||||
echo SET PATH="%%tbb_bin%%";%%PATH%%>>tbbvars.bat
|
||||
|
||||
endlocal
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
# Script used to generate tbbvars.[c]sh scripts
|
||||
bin_dir="$PWD" #
|
||||
cd "$tbb_root" # keep this comments here
|
||||
tbb_root="$PWD" # to make it unsensible
|
||||
cd "$bin_dir" # to EOL encoding
|
||||
[ "`uname`" = "Darwin" ] && dll_path="DYLD_LIBRARY_PATH" || dll_path="LD_LIBRARY_PATH" #
|
||||
custom_exp="$CXXFLAGS" #
|
||||
if [ -z "$TBB_CUSTOM_VARS_SH" ]; then #
|
||||
custom_exp_sh="" #
|
||||
else #
|
||||
custom_exp_sh="export $TBB_CUSTOM_VARS_SH" #
|
||||
fi #
|
||||
if [ -z "$TBB_CUSTOM_VARS_CSH" ]; then #
|
||||
custom_exp_csh="" #
|
||||
else #
|
||||
custom_exp_csh="setenv $TBB_CUSTOM_VARS_CSH" #
|
||||
fi #
|
||||
if [ -z "$1" ]; then # custom tbb_build_dir, can't make with TBB_INSTALL_DIR
|
||||
[ -f ./tbbvars.sh ] || cat >./tbbvars.sh <<EOF
|
||||
#!/bin/bash
|
||||
tbb_root="${tbb_root}" #
|
||||
tbb_bin="${bin_dir}" #
|
||||
if [ -z "\$CPATH" ]; then #
|
||||
export CPATH="\${tbb_root}/include" #
|
||||
else #
|
||||
export CPATH="\${tbb_root}/include:\$CPATH" #
|
||||
fi #
|
||||
if [ -z "\$LIBRARY_PATH" ]; then #
|
||||
export LIBRARY_PATH="\${tbb_bin}" #
|
||||
else #
|
||||
export LIBRARY_PATH="\${tbb_bin}:\$LIBRARY_PATH" #
|
||||
fi #
|
||||
if [ -z "\$${dll_path}" ]; then #
|
||||
export ${dll_path}="\${tbb_bin}" #
|
||||
else #
|
||||
export ${dll_path}="\${tbb_bin}:\$${dll_path}" #
|
||||
fi #
|
||||
${custom_exp_sh} #
|
||||
EOF
|
||||
[ -f ./tbbvars.csh ] || cat >./tbbvars.csh <<EOF
|
||||
#!/bin/csh
|
||||
setenv tbb_root "${tbb_root}" #
|
||||
setenv tbb_bin "${bin_dir}" #
|
||||
if (! \$?CPATH) then #
|
||||
setenv CPATH "\${tbb_root}/include" #
|
||||
else #
|
||||
setenv CPATH "\${tbb_root}/include:\$CPATH" #
|
||||
endif #
|
||||
if (! \$?LIBRARY_PATH) then #
|
||||
setenv LIBRARY_PATH "\${tbb_bin}" #
|
||||
else #
|
||||
setenv LIBRARY_PATH "\${tbb_bin}:\$LIBRARY_PATH" #
|
||||
endif #
|
||||
if (! \$?${dll_path}) then #
|
||||
setenv ${dll_path} "\${tbb_bin}" #
|
||||
else #
|
||||
setenv ${dll_path} "\${tbb_bin}:\$${dll_path}" #
|
||||
endif #
|
||||
${custom_exp_csh} #
|
||||
EOF
|
||||
else # make with TBB_INSTALL_DIR
|
||||
[ -f ./tbbvars.sh ] || cat >./tbbvars.sh <<EOF
|
||||
#!/bin/bash
|
||||
export TBB22_INSTALL_DIR="${tbb_root}" #
|
||||
tbb_bin="\${TBB22_INSTALL_DIR}/build/$1" #
|
||||
if [ -z "\$CPATH" ]; then #
|
||||
export CPATH="\${TBB22_INSTALL_DIR}/include" #
|
||||
else #
|
||||
export CPATH="\${TBB22_INSTALL_DIR}/include:\$CPATH" #
|
||||
fi #
|
||||
if [ -z "\$LIBRARY_PATH" ]; then #
|
||||
export LIBRARY_PATH="\${tbb_bin}" #
|
||||
else #
|
||||
export LIBRARY_PATH="\${tbb_bin}:\$LIBRARY_PATH" #
|
||||
fi #
|
||||
if [ -z "\$${dll_path}" ]; then #
|
||||
export ${dll_path}="\${tbb_bin}" #
|
||||
else #
|
||||
export ${dll_path}="\${tbb_bin}:\$${dll_path}" #
|
||||
fi #
|
||||
${custom_exp_sh} #
|
||||
EOF
|
||||
[ -f ./tbbvars.csh ] || cat >./tbbvars.csh <<EOF
|
||||
#!/bin/csh
|
||||
setenv TBB22_INSTALL_DIR "${tbb_root}" #
|
||||
setenv tbb_bin "\${TBB22_INSTALL_DIR}/build/$1" #
|
||||
if (! \$?CPATH) then #
|
||||
setenv CPATH "\${TBB22_INSTALL_DIR}/include" #
|
||||
else #
|
||||
setenv CPATH "\${TBB22_INSTALL_DIR}/include:\$CPATH" #
|
||||
endif #
|
||||
if (! \$?LIBRARY_PATH) then #
|
||||
setenv LIBRARY_PATH "\${tbb_bin}" #
|
||||
else #
|
||||
setenv LIBRARY_PATH "\${tbb_bin}:\$LIBRARY_PATH" #
|
||||
endif #
|
||||
if (! \$?${dll_path}) then #
|
||||
setenv ${dll_path} "\${tbb_bin}" #
|
||||
else #
|
||||
setenv ${dll_path} "\${tbb_bin}:\$${dll_path}" #
|
||||
endif #
|
||||
${custom_exp_csh} #
|
||||
EOF
|
||||
fi #
|
||||
|
|
@ -1,230 +0,0 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<H2>Overview</H2>
|
||||
This directory contains the internal Makefile infrastructure for Threading Building Blocks.
|
||||
|
||||
<P>
|
||||
See below for how to <A HREF=#build>build</A> TBB and how to <A HREF=#port>port</A> TBB
|
||||
to a new platform, operating system or architecture.
|
||||
</P>
|
||||
|
||||
<H2>Files</H2>
|
||||
The files here are not intended to be used directly. See below for usage.
|
||||
<DL>
|
||||
<DT><A HREF="Makefile.tbb">Makefile.tbb</A>
|
||||
<DD>Main Makefile to build the TBB library.
|
||||
Invoked via 'make tbb' from <A HREF=../Makefile>top-level Makefile</A>.
|
||||
<DT><A HREF="Makefile.tbbmalloc">Makefile.tbbmalloc</A>
|
||||
<DD>Main Makefile to build the TBB scalable memory allocator library as well as its tests.
|
||||
Invoked via 'make tbbmalloc' from <A HREF=../Makefile>top-level Makefile</A>.
|
||||
<DT><A HREF="Makefile.test">Makefile.test</A>
|
||||
<DD>Main Makefile to build and run the tests for the TBB library.
|
||||
Invoked via 'make test' from <A HREF=../Makefile>top-level Makefile</A>.
|
||||
<DT><A HREF="common.inc">common.inc</A>
|
||||
<DD>Main common included Makefile that includes OS-specific and compiler-specific Makefiles.
|
||||
<DT><os>.inc
|
||||
<DD>OS-specific Makefile for a particular <os>.
|
||||
<DT><os>.<compiler>.inc
|
||||
<DD>Compiler-specific Makefile for a particular <os> / <compiler> combination.
|
||||
<DT>*.sh
|
||||
<DD>Infrastructure utilities for Linux*, Mac OS* X, and UNIX*-related systems.
|
||||
<DT>*.js, *.bat
|
||||
<DD>Infrastructure utilities for Windows* systems.
|
||||
</DL>
|
||||
|
||||
<A NAME=build><H2>To Build</H2></A>
|
||||
<P>
|
||||
To port TBB to a new platform, operating system or architecture, see the <A HREF=#port>porting directions</A> below.
|
||||
</P>
|
||||
|
||||
<H3>Software prerequisites:</H3>
|
||||
<OL>
|
||||
<LI>C++ compiler for the platform, operating system and architecture of interest.
|
||||
Either the native compiler for your system, or, optionally, the appropriate Intel® C++ compiler, may be used.
|
||||
<LI>GNU make utility. On Windows*, if a UNIX* emulator is used to run GNU make,
|
||||
it should be able to run Windows* utilities and commands. On Linux*, Mac OS* X, etc.,
|
||||
shell commands issued by GNU make should execute in a Bourne or BASH compatible shell.
|
||||
</OL>
|
||||
|
||||
<P>
|
||||
TBB libraries can be built by performing the following steps.
|
||||
On systems that support only one ABI (e.g., 32-bit), these steps build the libraries for that ABI.
|
||||
On systems that support both 64-bit and 32-bit libraries, these steps build the 64-bit libraries
|
||||
(Linux*, Mac OS* X, and related systems) or whichever ABI is selected in the development environment (Windows* systems).
|
||||
</P>
|
||||
<OL>
|
||||
<LI>Change to the <A HREF=../index.html>top-level directory</A> of the installed software.
|
||||
<LI>If using the Intel® C++ compiler, make sure the appropriate compiler is available in your PATH
|
||||
(e.g., by sourcing the appropriate iccvars script for the compiler to be used).
|
||||
<LI>Invoke GNU make using no arguments, for example, 'gmake'.
|
||||
</OL>
|
||||
|
||||
<P>
|
||||
To build TBB libraries for other than the default ABI (e.g., to build 32-bit libraries on Linux*, Mac OS* X,
|
||||
or related systems that support both 64-bit and 32-bit libraries), perform the following steps.
|
||||
</P>
|
||||
<OL>
|
||||
<LI>Change to the <A HREF=../index.html>top-level directory</A> of the installed software.
|
||||
<LI>If using the Intel® C++ compiler, make sure the appropriate compiler is available in your PATH
|
||||
(e.g., by sourcing the appropriate iccvars script for the compiler to be used).
|
||||
<LI>Invoke GNU make as follows, 'gmake arch=ia32'.
|
||||
</OL>
|
||||
|
||||
<P>The default make target will build the release and debug versions of the TBB library.</P>
|
||||
<P>Other targets are available in the top-level Makefile. You might find the following targets useful:
|
||||
<UL>
|
||||
<LI>'make test' will build and run TBB <A HREF=../src/test>unit-tests</A>;
|
||||
<LI>'make examples' will build and run TBB <A HREF=../examples/index.html>examples</A>;
|
||||
<LI>'make all' will do all of the above.
|
||||
</UL>
|
||||
See also the list of other targets below.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
By default, the libraries will be built in sub-directories within the build/ directory.
|
||||
The sub-directories are named according to the operating system, architecture, compiler and software environment used
|
||||
(the sub-directory names also distinguish release vs. debug libraries). On Linux*, the software environment comprises
|
||||
the GCC, libc and kernel version used. On Mac OS* X, the software environment comprises the GCC and OS version used.
|
||||
On Windows, the software environment comprises the Microsoft* Visual Studio* version used.
|
||||
See below for how to change the default build directory.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
To perform different build and/or test operations, use the following steps.
|
||||
</P>
|
||||
<OL>
|
||||
<LI>Change to the <A HREF=../index.html>top-level directory</A> of the installed software.
|
||||
<LI>If using the Intel® C++ compiler, make sure the appropriate compiler is available in your PATH
|
||||
(e.g., by sourcing the appropriate iccvars script for the compiler to be used).
|
||||
<LI>Invoke GNU make by using one or more of the following commands.
|
||||
<DL>
|
||||
<DT><TT>make</TT>
|
||||
<DD>Default build. Equivalent to 'make tbb tbbmalloc'.
|
||||
<DT><TT>make all</TT>
|
||||
<DD>Equivalent to 'make tbb tbbmalloc test examples'.
|
||||
<DT><TT>cd src;make release</TT>
|
||||
<DD>Build and test release libraries only.
|
||||
<DT><TT>cd src;make debug</TT>
|
||||
<DD>Build and test debug libraries only.
|
||||
<DT><TT>make tbb</TT>
|
||||
<DD>Make TBB release and debug libraries.
|
||||
<DT><TT>make tbbmalloc</TT>
|
||||
<DD>Make TBB scalable memory allocator libraries.
|
||||
<DT><TT>make test</TT>
|
||||
<DD>Compile and run unit-tests
|
||||
<DT><TT>make examples</TT>
|
||||
<DD>Build libraries and run all examples, like doing 'make debug clean release' from
|
||||
<A HREF=../examples/Makefile>the general example Makefile</A>.
|
||||
<DT><TT>make compiler=<B>{</B>icl, icc<B>}</B> <B>[</B>(above options or targets)<B>]</B></TT>
|
||||
<DD>Build and run as above, but use Intel® compilers instead of default, native compilers
|
||||
(e.g., icl instead of cl.exe on Windows* systems, or icc instead of g++ on Linux* or Mac OS* X systems).
|
||||
<DT><TT>make arch=<B>{</B>ia32, intel64, ia64<B>}</B> <B>[</B>(above options or targets)<B>]</B></TT>
|
||||
<DD>Build and run as above, but build libraries for the selected ABI.
|
||||
Might be useful for cross-compilation; ensure proper environment is set before running this command.
|
||||
<DT><TT>make tbb_root=<B>{</B>(TBB directory)<B>}</B> <B>[</B>(above options or targets)<B>]</B></TT>
|
||||
<DD>Build and run as above; for use when invoking 'make' from a directory other than
|
||||
the <A HREF=../index.html>top-level directory</A>.
|
||||
<DT><TT>make tbb_build_dir=<B>{</B>(build directory)<B>}</B> <B>[</B>(above options or targets)<B>]</B></TT>
|
||||
<DD>Build and run as above, but place the built libraries in the specified directory, rather than in the default
|
||||
sub-directory within the build/ directory. This command might have troubles with the build in case the sources
|
||||
installed to the directory with spaces in the path.
|
||||
<DT><TT>make tbb_build_prefix=<B>{</B>(build sub-directory)<B>}</B> <B>[</B>(above options or targets)<B>]</B></TT>
|
||||
<DD>Build and run as above, but place the built libraries in the specified sub-directory within the build/ directory,
|
||||
rather than using the default sub-directory name.
|
||||
<DT><TT>make <B>[</B>(above options)<B>]</B> clean</TT>
|
||||
<DD>Remove any executables or intermediate files produced by the above commands.
|
||||
Includes build directories, object files, libraries and test executables.
|
||||
</DL>
|
||||
</OL>
|
||||
|
||||
<A NAME=port><H2>To Port</H2></A>
|
||||
<P>
|
||||
This section provides information on how to port TBB to a new platform, operating system or architecture.
|
||||
A subset or a superset of these steps may be required for porting to a given platform.
|
||||
</P>
|
||||
|
||||
<H4>To port the TBB source code:</H4>
|
||||
<OL>
|
||||
<LI>If porting to a new architecture, create a file that describes the architecture-specific details for that architecture.
|
||||
<UL>
|
||||
<LI>Create a <os>_<architecture>.h file in the <A HREF=../include/tbb/machine>include/tbb/machine</A> directory
|
||||
that describes these details.
|
||||
<UL>
|
||||
<LI>The <os>_<architecture>.h is named after the operating system and architecture as recognized by
|
||||
<A HREF=../include/tbb/tbb_machine.h>include/tbb/tbb_machine.h</A> and the Makefile infrastructure.
|
||||
<LI>This file defines the implementations of synchronization operations, and also the
|
||||
scheduler yield function, for the operating system and architecture.
|
||||
<LI>Several examples of <os>_<architecture>.h files can be found in the
|
||||
<A HREF=../include/tbb/machine>include/tbb/machine</A> directory.
|
||||
<UL>
|
||||
<LI>A minimal implementation defines the 4-byte and 8-byte compare-and-swap operations,
|
||||
and the scheduler yield function. See <A HREF=../include/tbb/machine/mac_ppc.h>include/tbb/machine/mac_ppc.h</A>
|
||||
for an example of a minimal implementation.
|
||||
<LI>More complex implementation examples can also be found in the
|
||||
<A HREF=../include/tbb/machine>include/tbb/machine</A> directory
|
||||
that implement all the individual variants of synchronization operations that TBB uses.
|
||||
Such implementations are more verbose but may achieve better performance on a given architecture.
|
||||
<LI>In a given implementation, any synchronization operation that is not defined is implemented, by default,
|
||||
in terms of 4-byte or 8-byte compare-and-swap. More operations can thus be added incrementally to increase
|
||||
the performance of an implementation.
|
||||
<LI>In most cases, synchronization operations are implemented as inline assembly code; examples also exist,
|
||||
(e.g., for Intel® Itanium® processors) that use out-of-line assembly code in *.s or *.asm files
|
||||
(see the assembly code sub-directories in the <A HREF=../src/tbb>src/tbb</A> directory).
|
||||
</UL>
|
||||
</UL>
|
||||
<LI>Modify <A HREF=../include/tbb/tbb_machine.h>include/tbb/tbb_machine.h</A>, if needed, to invoke the appropriate
|
||||
<os>_<architecture>.h file in the <A HREF=../include/tbb/machine>include/tbb/machine</A> directory.
|
||||
</UL>
|
||||
<LI>Add an implementation of DetectNumberOfWorkers() in <A HREF=../src/tbb/tbb_misc.h>src/tbb/tbb_misc.h</A>,
|
||||
if needed, that returns the number of cores found on the system. This is used to determine the default
|
||||
number of threads for the TBB task scheduler.
|
||||
<LI>Either properly define FillDynamicLinks for use in
|
||||
<A HREF=../src/tbb/cache_aligned_allocator.cpp>src/tbb/cache_aligned_allocator.cpp</A>,
|
||||
or hardcode the allocator to be used.
|
||||
<LI>Additional types might be required in the union defined in
|
||||
<A HREF=../include/tbb/aligned_space.h>include/tbb/aligned_space.h</A>
|
||||
to ensure proper alignment on your platform.
|
||||
<LI>Changes may be required in <A HREF=../include/tbb/tick_count.h>include/tbb/tick_count.h</A>
|
||||
for systems that do not provide gettimeofday.
|
||||
</OL>
|
||||
|
||||
<H4>To port the Makefile infrastructure:</H4>
|
||||
Modify the appropriate files in the Makefile infrastructure to add a new platform, operating system or architecture as needed.
|
||||
See the Makefile infrastructure files for examples.
|
||||
<OL>
|
||||
<LI>The <A HREF=../Makefile>top-level Makefile</A> includes <A HREF=common.inc>common.inc</A> to determine the operating system.
|
||||
<UL>
|
||||
<LI>To add a new operating system, add the appropriate test to <A HREF=common.inc>common.inc</A>,
|
||||
and create the needed <os>.inc and <os>.<compiler>.inc files (see below).
|
||||
</UL>
|
||||
<LI>The <os>.inc file makes OS-specific settings for a particular <os>.
|
||||
<UL>
|
||||
<LI>For example, <A HREF=linux.inc>linux.inc</A> makes settings specific to Linux* systems.
|
||||
<LI>This file performs OS-dependent tests to determine the specific platform and/or architecture,
|
||||
and sets other platform-dependent values.
|
||||
<LI>Add a new <os>.inc file for each new operating system added.
|
||||
</UL>
|
||||
<LI>The <os>.<compiler>.inc file makes compiler-specific settings for a particular
|
||||
<os> / <compiler> combination.
|
||||
<UL>
|
||||
<LI>For example, <A HREF=linux.gcc.inc>linux.gcc.inc</A> makes specific settings for using GCC on Linux* systems,
|
||||
and <A HREF=linux.icc.inc>linux.icc.inc</A> makes specific settings for using the Intel® C++ compiler on Linux* systems.
|
||||
<LI>This file sets particular compiler, assembler and linker options required when using a particular
|
||||
<os> / <compiler> combination.
|
||||
<LI>Add a new <os>.<compiler>.inc file for each new <os> / <compiler> combination added.
|
||||
</UL>
|
||||
</OL>
|
||||
|
||||
<HR>
|
||||
<A HREF="../index.html">Up to parent directory</A>
|
||||
<P></P>
|
||||
Copyright © 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
<P></P>
|
||||
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
|
||||
registered trademarks or trademarks of Intel Corporation or its
|
||||
subsidiaries in the United States and other countries.
|
||||
<P></P>
|
||||
* Other names and brands may be claimed as the property of others.
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
COMPILE_ONLY = -c -MMD
|
||||
PREPROC_ONLY = -E -x c
|
||||
INCLUDE_KEY = -I
|
||||
DEFINE_KEY = -D
|
||||
OUTPUT_KEY = -o #
|
||||
OUTPUTOBJ_KEY = -o #
|
||||
PIC_KEY = -fPIC
|
||||
WARNING_AS_ERROR_KEY = -Werror
|
||||
WARNING_KEY = -Wall
|
||||
WARNING_SUPPRESS = -Wno-parentheses
|
||||
RML_WARNING_SUPPRESS = -Wno-non-virtual-dtor
|
||||
DYLIB_KEY = -shared
|
||||
LIBDL = -ldl
|
||||
|
||||
TBB_NOSTRICT = 1
|
||||
|
||||
CPLUS = g++
|
||||
CONLY = gcc
|
||||
LIB_LINK_FLAGS = -shared -Wl,-soname=$(BUILDING_LIBRARY)
|
||||
LIBS = -lpthread -lrt
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = -DDO_ITT_NOTIFY -O2 -DUSE_PTHREAD
|
||||
endif
|
||||
ifeq ($(cfg), debug)
|
||||
CPLUS_FLAGS = -DTBB_USE_DEBUG -DDO_ITT_NOTIFY -g -O0 -DUSE_PTHREAD
|
||||
endif
|
||||
|
||||
ifneq (0,$(cpp0x))
|
||||
CXX_ONLY_FLAGS = -std=c++0x
|
||||
endif
|
||||
|
||||
ASM=
|
||||
ASM_FLAGS=
|
||||
|
||||
TBB_ASM.OBJ=
|
||||
|
||||
ifeq (ia64,$(arch))
|
||||
# Position-independent code (PIC) is a must on IA-64, even for regular (not shared) executables
|
||||
CPLUS_FLAGS += $(PIC_KEY)
|
||||
endif
|
||||
|
||||
ifeq (intel64,$(arch))
|
||||
CPLUS_FLAGS += -m64
|
||||
LIB_LINK_FLAGS += -m64
|
||||
endif
|
||||
|
||||
ifeq (ia32,$(arch))
|
||||
CPLUS_FLAGS += -m32
|
||||
LIB_LINK_FLAGS += -m32
|
||||
endif
|
||||
|
||||
# for some gcc versions on Solaris, -m64 may imply V9, but perhaps not everywhere (TODO: verify)
|
||||
ifeq (sparc,$(arch))
|
||||
CPLUS_FLAGS += -mcpu=v9 -m64
|
||||
LIB_LINK_FLAGS += -mcpu=v9 -m64
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
ASSEMBLY_SOURCE=$(arch)-gas
|
||||
ifeq (ia64,$(arch))
|
||||
ASM=as
|
||||
ASM_FLAGS += -xexplicit
|
||||
TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o ia64_misc.o
|
||||
endif
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
COMPILE_ONLY = -c -MMD
|
||||
PREPROC_ONLY = -E -x c
|
||||
INCLUDE_KEY = -I
|
||||
DEFINE_KEY = -D
|
||||
OUTPUT_KEY = -o #
|
||||
OUTPUTOBJ_KEY = -o #
|
||||
PIC_KEY = -fPIC
|
||||
WARNING_AS_ERROR_KEY = -Werror
|
||||
WARNING_KEY = -w1
|
||||
DYLIB_KEY = -shared
|
||||
LIBDL = -ldl
|
||||
export COMPILER_VERSION := ICC: $(shell icc -V </dev/null 2>&1 | grep 'Version')
|
||||
#TODO: autodetection of arch from COMPILER_VERSION!!
|
||||
|
||||
TBB_NOSTRICT = 1
|
||||
|
||||
CPLUS = icpc
|
||||
CONLY = icc
|
||||
|
||||
ifeq (release,$(cfg))
|
||||
CPLUS_FLAGS = -O2 -strict_ansi -DUSE_PTHREAD
|
||||
else
|
||||
CPLUS_FLAGS = -O0 -g -strict_ansi -DUSE_PTHREAD -DTBB_USE_DEBUG
|
||||
endif
|
||||
|
||||
ifneq (,$(codecov))
|
||||
CPLUS_FLAGS += -prof-genx
|
||||
else
|
||||
CPLUS_FLAGS += -DDO_ITT_NOTIFY
|
||||
endif
|
||||
|
||||
OPENMP_FLAG = -openmp
|
||||
LIB_LINK_FLAGS = -shared -i-static -Wl,-soname=$(BUILDING_LIBRARY)
|
||||
LIBS = -lpthread -lrt
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
|
||||
ASM=
|
||||
ASM_FLAGS=
|
||||
|
||||
TBB_ASM.OBJ=
|
||||
|
||||
ifeq (ia64,$(arch))
|
||||
# Position-independent code (PIC) is a must on IA-64, even for regular (not shared) executables
|
||||
CPLUS_FLAGS += $(PIC_KEY)
|
||||
endif
|
||||
|
||||
ifneq (00,$(lambdas)$(cpp0x))
|
||||
CPLUS_FLAGS += -std=c++0x -D_TBB_CPP0X
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
ASSEMBLY_SOURCE=$(arch)-gas
|
||||
ifeq (ia64,$(arch))
|
||||
ASM=ias
|
||||
TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o ia64_misc.o
|
||||
endif
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
ifndef arch
|
||||
uname_m:=$(shell uname -m)
|
||||
ifeq ($(uname_m),i686)
|
||||
export arch:=ia32
|
||||
endif
|
||||
ifeq ($(uname_m),ia64)
|
||||
export arch:=ia64
|
||||
endif
|
||||
ifeq ($(uname_m),x86_64)
|
||||
export arch:=intel64
|
||||
endif
|
||||
ifeq ($(uname_m),sparc64)
|
||||
export arch:=sparc
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef runtime
|
||||
#gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc --version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//')
|
||||
gcc_version_full=$(shell gcc --version | grep 'gcc'| egrep -o ' [0-9]+\.[0-9]+\.[0-9]+.*' | sed -e 's/^\ //')
|
||||
gcc_version=$(shell echo "$(gcc_version_full)" | egrep -o '^[0-9]+\.[0-9]+\.[0-9]+\s*' | head -n 1 | sed -e 's/ *//g')
|
||||
os_version:=$(shell uname -r)
|
||||
os_kernel_version:=$(shell uname -r | sed -e 's/-.*$$//')
|
||||
export os_glibc_version_full:=$(shell getconf GNU_LIBC_VERSION | grep glibc | sed -e 's/^glibc //')
|
||||
os_glibc_version:=$(shell echo "$(os_glibc_version_full)" | sed -e '2,$$d' -e 's/-.*$$//')
|
||||
export runtime:=cc$(gcc_version)_libc$(os_glibc_version)_kernel$(os_kernel_version)
|
||||
endif
|
||||
|
||||
native_compiler := gcc
|
||||
export compiler ?= gcc
|
||||
debugger ?= gdb
|
||||
|
||||
CMD=sh -c
|
||||
CWD=$(shell pwd)
|
||||
RM?=rm -f
|
||||
RD?=rmdir
|
||||
MD?=mkdir -p
|
||||
NUL= /dev/null
|
||||
SLASH=/
|
||||
MAKE_VERSIONS=sh $(tbb_root)/build/version_info_linux.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp
|
||||
MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh
|
||||
|
||||
ifdef LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH := .:$(LD_LIBRARY_PATH)
|
||||
else
|
||||
export LD_LIBRARY_PATH := .
|
||||
endif
|
||||
|
||||
####### Build settings ########################################################
|
||||
|
||||
OBJ = o
|
||||
DLL = so
|
||||
LIBEXT = so
|
||||
SONAME_SUFFIX =$(shell grep TBB_COMPATIBLE_INTERFACE_VERSION $(tbb_root)/include/tbb/tbb_stddef.h | egrep -o [0-9.]+)
|
||||
|
||||
def_prefix = $(if $(findstring 32,$(arch)),lin32,$(if $(findstring intel64,$(arch)),lin64,lin64ipf))
|
||||
TBB.DEF = $(tbb_root)/src/tbb/$(def_prefix)-tbb-export.def
|
||||
|
||||
EXPORT_KEY = -Wl,--version-script,
|
||||
TBB.DLL = $(TBB_NO_VERSION.DLL).$(SONAME_SUFFIX)
|
||||
TBB.LIB = $(TBB.DLL)
|
||||
TBB_NO_VERSION.DLL=libtbb$(DEBUG_SUFFIX).$(DLL)
|
||||
LINK_TBB.LIB = $(TBB_NO_VERSION.DLL)
|
||||
|
||||
MALLOC_NO_VERSION.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL)
|
||||
MALLOC.DEF = $(MALLOC_ROOT)/lin-tbbmalloc-export.def
|
||||
MALLOC.DLL = $(MALLOC_NO_VERSION.DLL).$(SONAME_SUFFIX)
|
||||
MALLOC.LIB = $(MALLOC_NO_VERSION.DLL)
|
||||
LINK_MALLOC.LIB = $(MALLOC_NO_VERSION.DLL)
|
||||
|
||||
MALLOCPROXY_NO_VERSION.DLL = libtbbmalloc_proxy$(DEBUG_SUFFIX).$(DLL)
|
||||
MALLOCPROXY.DEF = $(MALLOC_ROOT)/$(def_prefix)-proxy-export.def
|
||||
MALLOCPROXY.DLL = $(MALLOCPROXY_NO_VERSION.DLL).$(SONAME_SUFFIX)
|
||||
MALLOCPROXY.LIB = $(MALLOCPROXY_NO_VERSION.DLL)
|
||||
|
||||
RML_NO_VERSION.DLL = libirml$(DEBUG_SUFFIX).$(DLL)
|
||||
RML.DEF = $(RML_SERVER_ROOT)/lin-rml-export.def
|
||||
RML.DLL = $(RML_NO_VERSION.DLL).1
|
||||
RML.LIB = $(RML_NO_VERSION.DLL)
|
||||
|
||||
TBB_NOSTRICT=1
|
||||
|
||||
TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
CPLUS = g++
|
||||
CONLY = gcc
|
||||
COMPILE_ONLY = -c -MMD
|
||||
PREPROC_ONLY = -E -x c
|
||||
INCLUDE_KEY = -I
|
||||
DEFINE_KEY = -D
|
||||
OUTPUT_KEY = -o #
|
||||
OUTPUTOBJ_KEY = -o #
|
||||
PIC_KEY = -fPIC
|
||||
WARNING_AS_ERROR_KEY = -Werror
|
||||
WARNING_KEY = -Wall
|
||||
WARNING_SUPPRESS =
|
||||
DYLIB_KEY = -dynamiclib
|
||||
EXPORT_KEY = -Wl,-exported_symbols_list,
|
||||
LIBDL = -ldl
|
||||
|
||||
LIBS = -lpthread
|
||||
LINK_FLAGS =
|
||||
LIB_LINK_FLAGS = -dynamiclib
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = -O2
|
||||
else
|
||||
CPLUS_FLAGS = -g -O0 -DTBB_USE_DEBUG
|
||||
endif
|
||||
|
||||
CPLUS_FLAGS += -DUSE_PTHREAD
|
||||
|
||||
ifeq (intel64,$(arch))
|
||||
CPLUS_FLAGS += -m64
|
||||
LINK_FLAGS += -m64
|
||||
LIB_LINK_FLAGS += -m64
|
||||
endif
|
||||
|
||||
ifeq (ia32,$(arch))
|
||||
CPLUS_FLAGS += -m32
|
||||
LINK_FLAGS += -m32
|
||||
LIB_LINK_FLAGS += -m32
|
||||
endif
|
||||
|
||||
ifeq (ppc64,$(arch))
|
||||
CPLUS_FLAGS += -arch ppc64
|
||||
LINK_FLAGS += -arch ppc64
|
||||
LIB_LINK_FLAGS += -arch ppc64
|
||||
endif
|
||||
|
||||
ifeq (ppc,$(arch))
|
||||
CPLUS_FLAGS += -arch ppc
|
||||
LINK_FLAGS += -arch ppc
|
||||
LIB_LINK_FLAGS += -arch ppc
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
CPLUS = icpc
|
||||
CONLY = icc
|
||||
COMPILE_ONLY = -c -MMD
|
||||
PREPROC_ONLY = -E -x c
|
||||
INCLUDE_KEY = -I
|
||||
DEFINE_KEY = -D
|
||||
OUTPUT_KEY = -o #
|
||||
OUTPUTOBJ_KEY = -o #
|
||||
PIC_KEY = -fPIC
|
||||
WARNING_AS_ERROR_KEY = -Werror
|
||||
WARNING_KEY = -w1
|
||||
DYLIB_KEY = -dynamiclib
|
||||
EXPORT_KEY = -Wl,-exported_symbols_list,
|
||||
LIBDL = -ldl
|
||||
export COMPILER_VERSION := $(shell icc -V </dev/null 2>&1 | grep 'Version')
|
||||
#TODO: autodetection of arch from COMPILER_VERSION!!
|
||||
|
||||
OPENMP_FLAG = -openmp
|
||||
LIBS = -lpthread
|
||||
LINK_FLAGS =
|
||||
LIB_LINK_FLAGS = -dynamiclib -i-static
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = -O2 -fno-omit-frame-pointer
|
||||
else
|
||||
CPLUS_FLAGS = -g -O0 -DTBB_USE_DEBUG
|
||||
endif
|
||||
|
||||
CPLUS_FLAGS += -DUSE_PTHREAD
|
||||
|
||||
ifneq (,$(codecov))
|
||||
CPLUS_FLAGS += -prof-genx
|
||||
endif
|
||||
|
||||
ifneq (00,$(lambdas)$(cpp0x))
|
||||
CPLUS_FLAGS += -std=c++0x -D_TBB_CPP0X
|
||||
endif
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
####### Detections and Commands ###############################################
|
||||
ifndef arch
|
||||
ifeq ($(shell /usr/sbin/sysctl -n hw.machine),Power Macintosh)
|
||||
ifeq ($(shell /usr/sbin/sysctl -n hw.optional.64bitops),1)
|
||||
export arch:=ppc64
|
||||
else
|
||||
export arch:=ppc32
|
||||
endif
|
||||
else
|
||||
ifeq ($(shell /usr/sbin/sysctl -n hw.optional.x86_64 2>/dev/null),1)
|
||||
export arch:=intel64
|
||||
else
|
||||
export arch:=ia32
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef runtime
|
||||
#gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//' )
|
||||
gcc_version_full=$(shell gcc --version | grep 'gcc'| egrep -o ' [0-9]+\.[0-9]+\.[0-9]+.*' | sed -e 's/^\ //')
|
||||
gcc_version=$(shell echo "$(gcc_version_full)" | egrep -o '^[0-9]+\.[0-9]+\.[0-9]+\s*' | head -n 1 | sed -e 's/ *//g')
|
||||
os_version:=$(shell /usr/bin/sw_vers -productVersion)
|
||||
export runtime:=cc$(gcc_version)_os$(os_version)
|
||||
endif
|
||||
|
||||
native_compiler := gcc
|
||||
export compiler ?= gcc
|
||||
debugger ?= gdb
|
||||
|
||||
CMD=$(SHELL) -c
|
||||
CWD=$(shell pwd)
|
||||
RM?=rm -f
|
||||
RD?=rmdir
|
||||
MD?=mkdir -p
|
||||
NUL= /dev/null
|
||||
SLASH=/
|
||||
MAKE_VERSIONS=sh $(tbb_root)/build/version_info_macos.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp
|
||||
MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh
|
||||
|
||||
####### Build settings ########################################################
|
||||
|
||||
OBJ=o
|
||||
DLL=dylib
|
||||
LIBEXT=dylib
|
||||
|
||||
def_prefix = $(if $(findstring 32,$(arch)),mac32,mac64)
|
||||
|
||||
TBB.DEF = $(tbb_root)/src/tbb/$(def_prefix)-tbb-export.def
|
||||
TBB.DLL = libtbb$(DEBUG_SUFFIX).$(DLL)
|
||||
TBB.LIB = $(TBB.DLL)
|
||||
LINK_TBB.LIB = $(TBB.LIB)
|
||||
|
||||
MALLOC.DEF = $(MALLOC_ROOT)/$(def_prefix)-tbbmalloc-export.def
|
||||
MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL)
|
||||
MALLOC.LIB = $(MALLOC.DLL)
|
||||
|
||||
TBB_NOSTRICT=1
|
||||
|
||||
TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh
|
||||
|
|
@ -1 +0,0 @@
|
|||
hwcap_1 = OVERRIDE;
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
@echo off
|
||||
REM
|
||||
REM Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
REM
|
||||
REM This file is part of Threading Building Blocks.
|
||||
REM
|
||||
REM Threading Building Blocks is free software; you can redistribute it
|
||||
REM and/or modify it under the terms of the GNU General Public License
|
||||
REM version 2 as published by the Free Software Foundation.
|
||||
REM
|
||||
REM Threading Building Blocks is distributed in the hope that it will be
|
||||
REM useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
REM of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
REM GNU General Public License for more details.
|
||||
REM
|
||||
REM You should have received a copy of the GNU General Public License
|
||||
REM along with Threading Building Blocks; if not, write to the Free Software
|
||||
REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
REM
|
||||
REM As a special exception, you may use this file as part of a free software
|
||||
REM library without restriction. Specifically, if other files instantiate
|
||||
REM templates or use macros or inline functions from this file, or you compile
|
||||
REM this file and link it with other files to produce an executable, this
|
||||
REM file does not by itself cause the resulting executable to be covered by
|
||||
REM the GNU General Public License. This exception does not however
|
||||
REM invalidate any other reasons why the executable file might be covered by
|
||||
REM the GNU General Public License.
|
||||
REM
|
||||
|
||||
REM no LD_PRELOAD under Windows
|
||||
if "%1"=="-l" (
|
||||
echo skip
|
||||
exit
|
||||
)
|
||||
|
||||
%*
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
while getopts "l:" flag #
|
||||
do #
|
||||
if [ `uname` != 'Linux' ] ; then #
|
||||
echo 'skip' #
|
||||
exit #
|
||||
fi #
|
||||
LD_PRELOAD=$OPTARG #
|
||||
shift `expr $OPTIND - 1` #
|
||||
done #
|
||||
# Set stack limit
|
||||
ulimit -s 10240 #
|
||||
# Run the command line passed via parameters
|
||||
export LD_PRELOAD #
|
||||
./$* #
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
# Script used to generate version info string
|
||||
echo "#define __TBB_VERSION_STRINGS \\"
|
||||
echo '"TBB:' "BUILD_HOST\t\t"`hostname -s`" ("`uname -m`")"'" ENDL \'
|
||||
# find OS name in *-release and issue* files by filtering blank lines and lsb-release content out
|
||||
echo '"TBB:' "BUILD_OS\t\t"`lsb_release -sd 2>/dev/null | grep -ih '[a-z] ' - /etc/*release /etc/issue 2>/dev/null | head -1 | sed -e 's/["\\\\]//g'`'" ENDL \'
|
||||
echo '"TBB:' "BUILD_KERNEL\t"`uname -srv`'" ENDL \'
|
||||
echo '"TBB:' "BUILD_GCC\t\t"`g++ -v </dev/null 2>&1 | grep 'gcc.*version'`'" ENDL \'
|
||||
[ -z "$COMPILER_VERSION" ] || echo '"TBB:' "BUILD_COMPILER\t"$COMPILER_VERSION'" ENDL \'
|
||||
echo '"TBB:' "BUILD_GLIBC\t"`getconf GNU_LIBC_VERSION | grep glibc | sed -e 's/^glibc //'`'" ENDL \'
|
||||
echo '"TBB:' "BUILD_LD\t\t"`ld -v 2>&1 | grep 'version'`'" ENDL \'
|
||||
echo '"TBB:' "BUILD_TARGET\t$arch on $runtime"'" ENDL \'
|
||||
echo '"TBB:' "BUILD_COMMAND\t"$*'" ENDL \'
|
||||
echo ""
|
||||
echo "#define __TBB_DATETIME \""`date -u`"\""
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
# Script used to generate version info string
|
||||
echo "#define __TBB_VERSION_STRINGS \\"
|
||||
echo '"TBB:' "BUILD_HOST\t\t"`hostname -s`" ("`arch`")"'" ENDL \'
|
||||
echo '"TBB:' "BUILD_OS\t\t"`sw_vers -productName`" version "`sw_vers -productVersion`'" ENDL \'
|
||||
echo '"TBB:' "BUILD_KERNEL\t"`uname -v`'" ENDL \'
|
||||
echo '"TBB:' "BUILD_GCC\t\t"`gcc -v </dev/null 2>&1 | grep 'version'`'" ENDL \'
|
||||
[ -z "$COMPILER_VERSION" ] || echo '"TBB:' "BUILD_COMPILER\t"$COMPILER_VERSION'" ENDL \'
|
||||
echo '"TBB:' "BUILD_TARGET\t$arch on $runtime"'" ENDL \'
|
||||
echo '"TBB:' "BUILD_COMMAND\t"$*'" ENDL \'
|
||||
echo ""
|
||||
echo "#define __TBB_DATETIME \""`date -u`"\""
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
# Script used to generate version info string
|
||||
echo "#define __TBB_VERSION_STRINGS \\"
|
||||
echo '"TBB:' "BUILD_HOST\t"`hostname`" ("`arch`")"'" ENDL \'
|
||||
echo '"TBB:' "BUILD_OS\t\t"`uname`'" ENDL \'
|
||||
echo '"TBB:' "BUILD_KERNEL\t"`uname -srv`'" ENDL \'
|
||||
echo '"TBB:' "BUILD_SUNCC\t"`CC -V </dev/null 2>&1 | grep 'C++'`'" ENDL \'
|
||||
[ -z "$COMPILER_VERSION" ] || echo '"TBB: ' "BUILD_COMPILER\t"$COMPILER_VERSION'" ENDL \'
|
||||
echo '"TBB:' "BUILD_TARGET\t$arch on $runtime"'" ENDL \'
|
||||
echo '"TBB:' "BUILD_COMMAND\t"$*'" ENDL \'
|
||||
echo ""
|
||||
echo "#define __TBB_DATETIME \""`date -u`"\""
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
// Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
//
|
||||
// This file is part of Threading Building Blocks.
|
||||
//
|
||||
// Threading Building Blocks is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// version 2 as published by the Free Software Foundation.
|
||||
//
|
||||
// Threading Building Blocks is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Threading Building Blocks; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
var WshShell = WScript.CreateObject("WScript.Shell");
|
||||
|
||||
var tmpExec;
|
||||
|
||||
WScript.Echo("#define __TBB_VERSION_STRINGS \\");
|
||||
|
||||
//Getting BUILD_HOST
|
||||
WScript.echo( "\"TBB: BUILD_HOST\\t\\t" +
|
||||
WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%") +
|
||||
"\" ENDL \\" );
|
||||
|
||||
//Getting BUILD_OS
|
||||
tmpExec = WshShell.Exec("cmd /c ver");
|
||||
while ( tmpExec.Status == 0 ) {
|
||||
WScript.Sleep(100);
|
||||
}
|
||||
tmpExec.StdOut.ReadLine();
|
||||
|
||||
WScript.echo( "\"TBB: BUILD_OS\\t\\t" +
|
||||
tmpExec.StdOut.ReadLine() +
|
||||
"\" ENDL \\" );
|
||||
|
||||
if ( WScript.Arguments(0).toLowerCase().match("gcc") ) {
|
||||
tmpExec = WshShell.Exec("gcc --version");
|
||||
WScript.echo( "\"TBB: BUILD_COMPILER\\t" +
|
||||
tmpExec.StdOut.ReadLine() +
|
||||
"\" ENDL \\" );
|
||||
|
||||
} else { // MS / Intel compilers
|
||||
//Getting BUILD_CL
|
||||
tmpExec = WshShell.Exec("cmd /c echo #define 0 0>empty.cpp");
|
||||
tmpExec = WshShell.Exec("cl -c empty.cpp ");
|
||||
while ( tmpExec.Status == 0 ) {
|
||||
WScript.Sleep(100);
|
||||
}
|
||||
var clVersion = tmpExec.StdErr.ReadLine();
|
||||
WScript.echo( "\"TBB: BUILD_CL\\t\\t" +
|
||||
clVersion +
|
||||
"\" ENDL \\" );
|
||||
|
||||
//Getting BUILD_COMPILER
|
||||
if ( WScript.Arguments(0).toLowerCase().match("icl") ) {
|
||||
tmpExec = WshShell.Exec("icl -c empty.cpp ");
|
||||
while ( tmpExec.Status == 0 ) {
|
||||
WScript.Sleep(100);
|
||||
}
|
||||
WScript.echo( "\"TBB: BUILD_COMPILER\\t" +
|
||||
tmpExec.StdErr.ReadLine() +
|
||||
"\" ENDL \\" );
|
||||
} else {
|
||||
WScript.echo( "\"TBB: BUILD_COMPILER\\t\\t" +
|
||||
clVersion +
|
||||
"\" ENDL \\" );
|
||||
}
|
||||
tmpExec = WshShell.Exec("cmd /c del /F /Q empty.obj empty.cpp");
|
||||
}
|
||||
|
||||
//Getting BUILD_TARGET
|
||||
WScript.echo( "\"TBB: BUILD_TARGET\\t" +
|
||||
WScript.Arguments(1) +
|
||||
"\" ENDL \\" );
|
||||
|
||||
//Getting BUILD_COMMAND
|
||||
WScript.echo( "\"TBB: BUILD_COMMAND\\t" + WScript.Arguments(2) + "\" ENDL" );
|
||||
|
||||
//Getting __TBB_DATETIME and __TBB_VERSION_YMD
|
||||
var date = new Date();
|
||||
WScript.echo( "#define __TBB_DATETIME \"" + date.toUTCString() + "\"" );
|
||||
WScript.echo( "#define __TBB_VERSION_YMD " + date.getUTCFullYear() + ", " +
|
||||
(date.getUTCMonth() > 8 ? (date.getUTCMonth()+1):("0"+(date.getUTCMonth()+1))) +
|
||||
(date.getUTCDate() > 9 ? date.getUTCDate():("0"+date.getUTCDate())) );
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Original strings
|
||||
|
||||
#define __TBB_VERSION_STRINGS \
|
||||
"TBB: BUILD_HOST\t\tvpolin-mobl1 (ia32)" ENDL \
|
||||
"TBB: BUILD_OS\t\tMicrosoft Windows XP [Version 5.1.2600]" ENDL \
|
||||
"TBB: BUILD_CL\t\tMicrosoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86" ENDL \
|
||||
"TBB: BUILD_COMPILER\tIntel(R) C++ Compiler for 32-bit applications, Version 9.1 Build 20070109Z Package ID: W_CC_C_9.1.034 " ENDL \
|
||||
"TBB: BUILD_TARGET\t" ENDL \
|
||||
"TBB: BUILD_COMMAND\t" ENDL \
|
||||
|
||||
#define __TBB_DATETIME "Mon Jun 4 10:16:07 UTC 2007"
|
||||
#define __TBB_VERSION_YMD 2007, 0604
|
||||
|
||||
|
||||
|
||||
# The script must be run from two directory levels below this level.
|
||||
x='"TBB: '
|
||||
y='" ENDL \'
|
||||
echo "#define __TBB_VERSION_STRINGS \\"
|
||||
echo $x "BUILD_HOST\t\t"`hostname`" ("`../../arch.exe`")"$y
|
||||
echo $x "BUILD_OS\t\t"`../../win_version.bat|grep -i 'Version'`$y
|
||||
echo >empty.cpp
|
||||
echo $x "BUILD_CL\t\t"`cl -c empty.cpp 2>&1 | grep -i Version`$y
|
||||
echo $x "BUILD_COMPILER\t"`icl -c empty.cpp 2>&1 | grep -i Version`$y
|
||||
echo $x "BUILD_TARGET\t"$TBB_ARCH$y
|
||||
echo $x "BUILD_COMMAND\t"$*$y
|
||||
echo ""
|
||||
# A workaround for MKS 8.6 where `date -u` crashes.
|
||||
date -u > date.tmp
|
||||
echo "#define __TBB_DATETIME \""`cat date.tmp`"\""
|
||||
echo "#define __TBB_VERSION_YMD "`date '+%Y, %m%d'`
|
||||
rm empty.cpp
|
||||
rm empty.obj
|
||||
rm date.tmp
|
||||
*/
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<H2>Overview</H2>
|
||||
This directory contains the visual studio* 2005 solution to build Threading Building Blocks.
|
||||
|
||||
|
||||
<H2>Files</H2>
|
||||
<DL>
|
||||
<DT><A HREF="makefile.sln">makefile.sln</A>
|
||||
<DD>Solution file.
|
||||
<DT><A HREF="tbb.vcproj">tbb.vcproj</A>
|
||||
<DD>Library project file.
|
||||
<DT><A HREF="tbbmalloc.vcproj">tbbmalloc.vcproj</A>
|
||||
<DD>Scalable allocator library project file. Allocator sources are expected to be located in <A HREF="../../src/tbbmalloc">../../src/tbbmalloc</A> folder.
|
||||
<DT><A HREF="tbbmalloc_proxy.vcproj">tbbmalloc_proxy.vcproj</A>
|
||||
<DD>Standard allocator replacement project file.
|
||||
</DL>
|
||||
|
||||
<HR>
|
||||
<A HREF="../index.html">Up to parent directory</A>
|
||||
<P></P>
|
||||
Copyright © 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
<P></P>
|
||||
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
|
||||
registered trademarks or trademarks of Intel Corporation or its
|
||||
subsidiaries in the United States and other countries.
|
||||
<P></P>
|
||||
* Other names and brands may be claimed as the property of others.
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8898CE0B-0BFB-45AE-AA71-83735ED2510D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
index.html = index.html
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbb", "tbb.vcxproj", "{F62787DD-1327-448B-9818-030062BCFAA5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbbmalloc", "tbbmalloc.vcxproj", "{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbbmalloc_proxy", "tbbmalloc_proxy.vcxproj", "{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Debug|x64.Build.0 = Debug|x64
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Release|Win32.Build.0 = Release|Win32
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Release|x64.ActiveCfg = Release|x64
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Release|x64.Build.0 = Release|x64
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|x64.Build.0 = Debug|x64
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|Win32.Build.0 = Release|Win32
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|x64.ActiveCfg = Release|x64
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|x64.Build.0 = Release|x64
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|x64.Build.0 = Debug|x64
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|Win32.Build.0 = Release|Win32
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|x64.ActiveCfg = Release|x64
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -1,346 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{F62787DD-1327-448B-9818-030062BCFAA5}</ProjectGuid>
|
||||
<RootNamespace>tbb</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)ia32\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ia32\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)intel64\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">intel64\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)ia32\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ia32\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)intel64\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">intel64\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_debug</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_debug</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbb.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbb_debug.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbb.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbb_debug.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /Oy /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbb.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbb.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbb.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbb.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="..\..\src\tbb\ia32-masm\atomic_support.asm">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/coff /Zi</AdditionalOptions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/coff /Zi</AdditionalOptions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</MASM>
|
||||
<CustomBuild Include="..\..\src\tbb\intel64-masm\atomic_support.asm">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">building atomic_support.obj</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 /Fo"intel64\Debug\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../src/tbb/intel64-masm/atomic_support.asm
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">intel64\Debug\atomic_support.obj;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">building atomic_support.obj</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 /Fo"intel64\Release\atomic_support.obj" /DEM64T=1 /c /Zi ../../src/tbb/intel64-masm/atomic_support.asm
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">intel64\Release\atomic_support.obj;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<MASM Include="..\..\src\tbb\ia32-masm\lock_byte.asm">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/coff /Zi</AdditionalOptions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/coff /Zi</AdditionalOptions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\tbb\itt_notify_proxy.c" />
|
||||
<ClCompile Include="..\..\src\tbb\concurrent_hash_map.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\concurrent_queue.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\concurrent_vector.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\dynamic_link.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\itt_notify.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\cache_aligned_allocator.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\pipeline.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\queuing_mutex.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\queuing_rw_mutex.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\spin_rw_mutex.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\spin_mutex.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\task.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\tbb_misc.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\mutex.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\recursive_mutex.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\tbb_thread.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\private_server.cpp" />
|
||||
<ClCompile Include="..\..\src\rml\client\rml_tbb.cpp" />
|
||||
<ClCompile Include="..\..\src\old\concurrent_vector_v2.cpp" />
|
||||
<ClCompile Include="..\..\src\old\concurrent_queue_v2.cpp" />
|
||||
<ClCompile Include="..\..\src\old\spin_rw_mutex_v2.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\src\tbb\win32-tbb-export.def">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../include >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../include >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\..\src\tbb\win64-tbb-export.def">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../include >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../include >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\tbb\_tbb_windef.h" />
|
||||
<ClInclude Include="..\..\include\tbb\aligned_space.h" />
|
||||
<ClInclude Include="..\..\include\tbb\atomic.h" />
|
||||
<ClInclude Include="..\..\include\tbb\blocked_range.h" />
|
||||
<ClInclude Include="..\..\include\tbb\blocked_range2d.h" />
|
||||
<ClInclude Include="..\..\include\tbb\blocked_range3d.h" />
|
||||
<ClInclude Include="..\..\include\tbb\cache_aligned_allocator.h" />
|
||||
<ClInclude Include="..\..\include\tbb\concurrent_hash_map.h" />
|
||||
<ClInclude Include="..\..\include\tbb\concurrent_queue.h" />
|
||||
<ClInclude Include="..\..\src\old\concurrent_queue_v2.h" />
|
||||
<ClInclude Include="..\..\include\tbb\concurrent_vector.h" />
|
||||
<ClInclude Include="..\..\src\old\concurrent_vector_v2.h" />
|
||||
<ClInclude Include="..\..\src\tbb\dynamic_link.h" />
|
||||
<ClInclude Include="..\..\include\tbb\enumerable_thread_specific.h" />
|
||||
<ClInclude Include="..\..\src\tbb\gate.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\ibm_aix51.h" />
|
||||
<ClInclude Include="..\..\src\tbb\itt_notify.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\linux_common.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\linux_intel64.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\linux_ia32.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\linux_ia64.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\mac_ppc.h" />
|
||||
<ClInclude Include="..\..\include\tbb\mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\null_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\null_rw_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_do.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_for.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_reduce.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_scan.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_sort.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_while.h" />
|
||||
<ClInclude Include="..\..\include\tbb\partitioner.h" />
|
||||
<ClInclude Include="..\..\include\tbb\pipeline.h" />
|
||||
<ClInclude Include="..\..\include\tbb\queuing_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\queuing_rw_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\recursive_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\scalable_allocator.h" />
|
||||
<ClInclude Include="..\..\include\tbb\spin_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\spin_rw_mutex.h" />
|
||||
<ClInclude Include="..\..\src\old\spin_rw_mutex_v2.h" />
|
||||
<ClInclude Include="..\..\include\tbb\task.h" />
|
||||
<ClInclude Include="..\..\include\tbb\task_scheduler_init.h" />
|
||||
<ClInclude Include="..\..\include\tbb\task_scheduler_observer.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_allocator.h" />
|
||||
<ClInclude Include="..\..\src\tbb\tbb_assert_impl.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_exception.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_machine.h" />
|
||||
<ClInclude Include="..\..\src\tbb\tbb_misc.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_profiling.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_stddef.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_thread.h" />
|
||||
<ClInclude Include="..\..\src\tbb\tbb_version.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbbmalloc_proxy.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tick_count.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\windows_intel64.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\windows_ia32.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\tbb\tbb_resource.rc">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1,337 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}</ProjectGuid>
|
||||
<RootNamespace>tbbmalloc</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)ia32\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ia32\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)intel64\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">intel64\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)ia32\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ia32\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)intel64\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">intel64\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_debug</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_debug</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MDd /Od /Ob0 /Zi /EHs- /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbbmalloc.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbbmalloc_debug.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MDd /Od /Ob0 /Zi /EHs- /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbbmalloc.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbbmalloc_debug.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MD /O2 /Zi /EHs- /Zc:forScope /Zc:wchar_t /Oy /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbbmalloc.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbbmalloc.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MD /O2 /Zi /EHs- /Zc:forScope /Zc:wchar_t /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbbmalloc.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbbmalloc.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="..\..\src\tbb\ia32-masm\atomic_support.asm">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/coff /Zi</AdditionalOptions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/coff /Zi</AdditionalOptions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</MASM>
|
||||
<CustomBuild Include="..\..\src\tbb\intel64-masm\atomic_support.asm">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">building atomic_support.obj</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 /Fo"intel64\Debug\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../src/tbb/intel64-masm/atomic_support.asm
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">intel64\Debug\atomic_support.obj;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">building atomic_support.obj</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 /Fo"intel64\Release\atomic_support.obj" /DEM64T=1 /c /Zi ../../src/tbb/intel64-masm/atomic_support.asm
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">intel64\Release\atomic_support.obj;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<MASM Include="..\..\src\tbb\ia32-masm\lock_byte.asm">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/coff /Zi</AdditionalOptions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/coff /Zi</AdditionalOptions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\tbb\itt_notify_proxy.c" />
|
||||
<ClCompile Include="..\..\src\tbbmalloc\tbbmalloc.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\dynamic_link.cpp" />
|
||||
<ClCompile Include="..\..\src\tbb\tbb_misc.cpp" />
|
||||
<ClCompile Include="..\..\src\tbbmalloc\MemoryAllocator.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\src\tbbmalloc\win32-tbbmalloc-export.def">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">generating tbbmalloc.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl /nologo /TC /EP ../../src/tbbmalloc/win32-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbbmalloc.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)tbbmalloc.def;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl /nologo /TC /EP ../../src/tbbmalloc/win32-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbbmalloc.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)tbbmalloc.def;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">generating tbbmalloc.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl /nologo /TC /EP ../../src/tbbmalloc/win32-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbbmalloc.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)tbbmalloc.def;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\..\src\tbbmalloc\win64-tbbmalloc-export.def">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">generating tbbmalloc.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl /nologo /TC /EP ../../src/tbbmalloc/win64-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbbmalloc.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)tbbmalloc.def;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">generating tbb.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbb.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)tbb.def;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">generating tbbmalloc.def file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cl /nologo /TC /EP ../../src/tbbmalloc/win64-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)tbbmalloc.def
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)tbbmalloc.def;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\tbb\_tbb_windef.h" />
|
||||
<ClInclude Include="..\..\include\tbb\aligned_space.h" />
|
||||
<ClInclude Include="..\..\include\tbb\atomic.h" />
|
||||
<ClInclude Include="..\..\include\tbb\blocked_range.h" />
|
||||
<ClInclude Include="..\..\include\tbb\blocked_range2d.h" />
|
||||
<ClInclude Include="..\..\include\tbb\blocked_range3d.h" />
|
||||
<ClInclude Include="..\..\include\tbb\cache_aligned_allocator.h" />
|
||||
<ClInclude Include="..\..\include\tbb\concurrent_hash_map.h" />
|
||||
<ClInclude Include="..\..\include\tbb\concurrent_queue.h" />
|
||||
<ClInclude Include="..\..\include\tbb\concurrent_vector.h" />
|
||||
<ClInclude Include="..\..\src\tbbmalloc\Customize.h" />
|
||||
<ClInclude Include="..\..\include\tbb\enumerable_thread_specific.h" />
|
||||
<ClInclude Include="..\..\src\tbbmalloc\LifoQueue.h" />
|
||||
<ClInclude Include="..\..\src\tbbmalloc\MapMemory.h" />
|
||||
<ClInclude Include="..\..\include\tbb\mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\null_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\null_rw_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_do.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_for.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_reduce.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_scan.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_sort.h" />
|
||||
<ClInclude Include="..\..\include\tbb\parallel_while.h" />
|
||||
<ClInclude Include="..\..\include\tbb\partitioner.h" />
|
||||
<ClInclude Include="..\..\include\tbb\pipeline.h" />
|
||||
<ClInclude Include="..\..\include\tbb\queuing_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\queuing_rw_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\recursive_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\scalable_allocator.h" />
|
||||
<ClInclude Include="..\..\include\tbb\spin_mutex.h" />
|
||||
<ClInclude Include="..\..\include\tbb\spin_rw_mutex.h" />
|
||||
<ClInclude Include="..\..\src\tbbmalloc\Statistics.h" />
|
||||
<ClInclude Include="..\..\include\tbb\task.h" />
|
||||
<ClInclude Include="..\..\include\tbb\task_scheduler_init.h" />
|
||||
<ClInclude Include="..\..\include\tbb\task_scheduler_observer.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_allocator.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_exception.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_machine.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_profiling.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_stddef.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbb_thread.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbbmalloc_proxy.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tick_count.h" />
|
||||
<ClInclude Include="..\..\src\tbbmalloc\TypeDefinitions.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\windows_intel64.h" />
|
||||
<ClInclude Include="..\..\include\tbb\machine\windows_ia32.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\tbbmalloc\tbbmalloc.rc">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="tbb.vcxproj">
|
||||
<Project>{f62787dd-1327-448b-9818-030062bcfaa5}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}</ProjectGuid>
|
||||
<RootNamespace>tbbmalloc_proxy</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)ia32\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ia32\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)intel64\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">intel64\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)ia32\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ia32\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)intel64\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">intel64\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_debug</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_debug</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>$(OutDir)tbbmalloc_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)tbbmalloc_proxy_debug.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbbmalloc.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbbmalloc_proxy_debug.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /Oy /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbbmalloc_proxy.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalOptions> /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)tbbmalloc.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(OutDir)tbbmalloc_proxy.dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\tbbmalloc\proxy.cpp" />
|
||||
<ClCompile Include="..\..\src\tbbmalloc\tbb_function_replacement.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\tbbmalloc\tbb_function_replacement.h" />
|
||||
<ClInclude Include="..\..\include\tbb\tbbmalloc_proxy.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\tbbmalloc\tbbmalloc.rc">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="tbbmalloc.vcxproj">
|
||||
<Project>{b15f131e-328a-4d42-adc2-9ff4ca6306d8}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1 +0,0 @@
|
|||
#define __TBB_VERSION_STRINGS "Empty"
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<H2>Overview</H2>
|
||||
This directory contains the visual studio* 2005 solution to build Threading Building Blocks.
|
||||
|
||||
|
||||
<H2>Files</H2>
|
||||
<DL>
|
||||
<DT><A HREF="makefile.sln">makefile.sln</A>
|
||||
<DD>Solution file.
|
||||
<DT><A HREF="tbb.vcproj">tbb.vcproj</A>
|
||||
<DD>Library project file.
|
||||
<DT><A HREF="tbbmalloc.vcproj">tbbmalloc.vcproj</A>
|
||||
<DD>Scalable allocator library project file. Allocator sources are expected to be located in <A HREF="../../src/tbbmalloc">../../src/tbbmalloc</A> folder.
|
||||
<DT><A HREF="tbbmalloc_proxy.vcproj">tbbmalloc_proxy.vcproj</A>
|
||||
<DD>Standard allocator replacement project file.
|
||||
</DL>
|
||||
|
||||
<HR>
|
||||
<A HREF="../index.html">Up to parent directory</A>
|
||||
<P></P>
|
||||
Copyright © 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
<P></P>
|
||||
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
|
||||
registered trademarks or trademarks of Intel Corporation or its
|
||||
subsidiaries in the United States and other countries.
|
||||
<P></P>
|
||||
* Other names and brands may be claimed as the property of others.
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbb", "tbb.vcproj", "{F62787DD-1327-448B-9818-030062BCFAA5}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbbmalloc", "tbbmalloc.vcproj", "{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5} = {F62787DD-1327-448B-9818-030062BCFAA5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8898CE0B-0BFB-45AE-AA71-83735ED2510D}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
index.html = index.html
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbbmalloc_proxy", "tbbmalloc_proxy.vcproj", "{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8} = {B15F131E-328A-4D42-ADC2-9FF4CA6306D8}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Debug|x64.Build.0 = Debug|x64
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Release|Win32.Build.0 = Release|Win32
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Release|x64.ActiveCfg = Release|x64
|
||||
{F62787DD-1327-448B-9818-030062BCFAA5}.Release|x64.Build.0 = Release|x64
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Debug|x64.Build.0 = Debug|x64
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|Win32.Build.0 = Release|Win32
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|x64.ActiveCfg = Release|x64
|
||||
{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}.Release|x64.Build.0 = Release|x64
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Debug|x64.Build.0 = Debug|x64
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|Win32.Build.0 = Release|Win32
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|x64.ActiveCfg = Release|x64
|
||||
{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -1,310 +0,0 @@
|
|||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="tbb" ProjectGUID="{F62787DD-1327-448B-9818-030062BCFAA5}" RootNamespace="tbb" Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform Name="Win32"/>
|
||||
<Platform Name="x64"/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
<DefaultToolFile FileName="masm.rules"/>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)ia32\$(ConfigurationName)" IntermediateDirectory="ia32\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include" Optimization="0" AdditionalIncludeDirectories="." PreprocessorDefinitions="" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbb.def" OutputFile="$(OutDir)\tbb_debug.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Debug|x64" OutputDirectory="$(SolutionDir)intel64\$(ConfigurationName)" IntermediateDirectory="intel64\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool" TargetEnvironment="3"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include" Optimization="0" AdditionalIncludeDirectories="." PreprocessorDefinitions="" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="false" DebugInformationFormat="3" ShowIncludes="false"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbb.def" OutputFile="$(OutDir)\tbb_debug.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" TargetMachine="17"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)ia32\$(ConfigurationName)" IntermediateDirectory="ia32\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0" WholeProgramOptimization="1">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /Oy /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include" AdditionalIncludeDirectories="." PreprocessorDefinitions="" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbb.def" OutputFile="$(OutDir)\tbb.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Release|x64" OutputDirectory="$(SolutionDir)intel64\$(ConfigurationName)" IntermediateDirectory="intel64\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0" WholeProgramOptimization="1">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool" TargetEnvironment="3"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include" AdditionalIncludeDirectories="." PreprocessorDefinitions="" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbb.def" OutputFile="$(OutDir)\tbb.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="17"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter Name="Source Files" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File RelativePath="..\..\src\tbb\ia32-masm\atomic_support.asm">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="MASM" AdditionalOptions="/coff /Zi"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM" AdditionalOptions="/coff /Zi"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\intel64-masm\atomic_support.asm">
|
||||
<FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64">
|
||||
<Tool Name="VCCustomBuildTool" Description="building atomic_support.obj" CommandLine="ml64 /Fo"intel64\Debug\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../src/tbb/intel64-masm/atomic_support.asm
|
||||
" Outputs="intel64\Debug\atomic_support.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64">
|
||||
<Tool Name="VCCustomBuildTool" Description="building atomic_support.obj" CommandLine="ml64 /Fo"intel64\Release\atomic_support.obj" /DEM64T=1 /c /Zi ../../src/tbb/intel64-masm/atomic_support.asm
|
||||
" Outputs="intel64\Release\atomic_support.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\itt_notify_proxy.c">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\ia32-masm\lock_byte.asm">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="MASM" AdditionalOptions="/coff /Zi"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM" AdditionalOptions="/coff /Zi"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\win32-tbb-export.def">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../include >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../include >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\win64-tbb-export.def">
|
||||
<FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../include >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32" ExcludedFromBuild="true">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../include >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\concurrent_hash_map.cpp"/><File RelativePath="..\..\src\tbb\concurrent_queue.cpp"/><File RelativePath="..\..\src\tbb\concurrent_vector.cpp"/><File RelativePath="..\..\src\tbb\dynamic_link.cpp"/><File RelativePath="..\..\src\tbb\itt_notify.cpp"/><File RelativePath="..\..\src\tbb\cache_aligned_allocator.cpp"/><File RelativePath="..\..\src\tbb\pipeline.cpp"/><File RelativePath="..\..\src\tbb\queuing_mutex.cpp"/><File RelativePath="..\..\src\tbb\queuing_rw_mutex.cpp"/><File RelativePath="..\..\src\tbb\spin_rw_mutex.cpp"/><File RelativePath="..\..\src\tbb\spin_mutex.cpp"/><File RelativePath="..\..\src\tbb\task.cpp"/><File RelativePath="..\..\src\tbb\tbb_misc.cpp"/><File RelativePath="..\..\src\tbb\mutex.cpp"/><File RelativePath="..\..\src\tbb\recursive_mutex.cpp"/><File RelativePath="..\..\src\tbb\tbb_thread.cpp"/><File RelativePath="..\..\src\tbb\private_server.cpp"/><File RelativePath="..\..\src\rml\client\rml_tbb.cpp"/><File RelativePath="..\..\src\old\concurrent_vector_v2.cpp"/><File RelativePath="..\..\src\old\concurrent_queue_v2.cpp"/><File RelativePath="..\..\src\old\spin_rw_mutex_v2.cpp"/></Filter>
|
||||
<Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File RelativePath="..\..\include\tbb\_tbb_windef.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\aligned_space.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\atomic.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\blocked_range.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\blocked_range2d.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\blocked_range3d.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\cache_aligned_allocator.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\concurrent_hash_map.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\concurrent_queue.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\old\concurrent_queue_v2.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\concurrent_vector.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\old\concurrent_vector_v2.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\dynamic_link.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\enumerable_thread_specific.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\gate.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\ibm_aix51.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\itt_notify.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\linux_common.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\linux_intel64.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\linux_ia32.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\linux_ia64.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\mac_ppc.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\null_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\null_rw_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_do.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_for.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_reduce.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_scan.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_sort.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_while.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\partitioner.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\pipeline.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\queuing_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\queuing_rw_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\recursive_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\scalable_allocator.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\spin_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\spin_rw_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\old\spin_rw_mutex_v2.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\task.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\task_scheduler_init.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\task_scheduler_observer.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_allocator.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\tbb_assert_impl.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_exception.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_machine.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\tbb_misc.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_profiling.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_stddef.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_thread.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\tbb_version.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbbmalloc_proxy.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tick_count.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\windows_intel64.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\windows_ia32.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
<File RelativePath="..\..\src\tbb\tbb_resource.rc">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
|
@ -1,290 +0,0 @@
|
|||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="tbbmalloc" ProjectGUID="{B15F131E-328A-4D42-ADC2-9FF4CA6306D8}" RootNamespace="tbbmalloc" Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform Name="Win32"/>
|
||||
<Platform Name="x64"/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
<DefaultToolFile FileName="masm.rules"/>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)ia32\$(ConfigurationName)" IntermediateDirectory="ia32\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MDd /Od /Ob0 /Zi /EHs- /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc" Optimization="0" AdditionalIncludeDirectories="." PreprocessorDefinitions="" MinimalRebuild="true" ExceptionHandling="0" BasicRuntimeChecks="0" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" SuppressStartupBanner="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbbmalloc.def" OutputFile="$(OutDir)\tbbmalloc_debug.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Debug|x64" OutputDirectory="$(SolutionDir)intel64\$(ConfigurationName)" IntermediateDirectory="intel64\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool" TargetEnvironment="3"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MDd /Od /Ob0 /Zi /EHs- /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc" Optimization="0" AdditionalIncludeDirectories="." MinimalRebuild="false" ExceptionHandling="0" BasicRuntimeChecks="0" RuntimeLibrary="3" TreatWChar_tAsBuiltInType="true" UsePrecompiledHeader="0" WarningLevel="4" SuppressStartupBanner="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3" ShowIncludes="false"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbbmalloc.def" OutputFile="$(OutDir)\tbbmalloc_debug.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" TargetMachine="17"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)ia32\$(ConfigurationName)" IntermediateDirectory="ia32\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0" WholeProgramOptimization="1">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MD /O2 /Zi /EHs- /Zc:forScope /Zc:wchar_t /Oy /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc" AdditionalIncludeDirectories="." PreprocessorDefinitions="" ExceptionHandling="0" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" SuppressStartupBanner="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbbmalloc.def" OutputFile="$(OutDir)\tbbmalloc.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Release|x64" OutputDirectory="$(SolutionDir)intel64\$(ConfigurationName)" IntermediateDirectory="intel64\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0" WholeProgramOptimization="1">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool" TargetEnvironment="3"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MD /O2 /Zi /EHs- /Zc:forScope /Zc:wchar_t /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc" AdditionalIncludeDirectories="." PreprocessorDefinitions="" ExceptionHandling="0" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" SuppressStartupBanner="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbbmalloc.def" OutputFile="$(OutDir)\tbbmalloc.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="17"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter Name="Source Files" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File RelativePath="..\..\src\tbb\ia32-masm\atomic_support.asm">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="MASM" AdditionalOptions="/coff /Zi"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM" AdditionalOptions="/coff /Zi"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\intel64-masm\atomic_support.asm">
|
||||
<FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64">
|
||||
<Tool Name="VCCustomBuildTool" Description="building atomic_support.obj" CommandLine="ml64 /Fo"intel64\Debug\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../src/tbb/intel64-masm/atomic_support.asm
|
||||
" Outputs="intel64\Debug\atomic_support.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64">
|
||||
<Tool Name="VCCustomBuildTool" Description="building atomic_support.obj" CommandLine="ml64 /Fo"intel64\Release\atomic_support.obj" /DEM64T=1 /c /Zi ../../src/tbb/intel64-masm/atomic_support.asm
|
||||
" Outputs="intel64\Release\atomic_support.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\itt_notify_proxy.c">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbb\ia32-masm\lock_byte.asm">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="MASM" AdditionalOptions="/coff /Zi"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM" AdditionalOptions="/coff /Zi"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="MASM"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbbmalloc\win32-tbbmalloc-export.def">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbbmalloc.def file" CommandLine="cl /nologo /TC /EP ../../src/tbbmalloc/win32-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbbmalloc.def
|
||||
" Outputs="$(IntDir)\tbbmalloc.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbbmalloc/win32-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbbmalloc.def
|
||||
" Outputs="$(IntDir)\tbbmalloc.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbbmalloc.def file" CommandLine="cl /nologo /TC /EP ../../src/tbbmalloc/win32-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbbmalloc.def
|
||||
" Outputs="$(IntDir)\tbbmalloc.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64" ExcludedFromBuild="true">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win32-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbbmalloc\win64-tbbmalloc-export.def">
|
||||
<FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbbmalloc.def file" CommandLine="cl /nologo /TC /EP ../../src/tbbmalloc/win64-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbbmalloc.def
|
||||
" Outputs="$(IntDir)\tbbmalloc.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32" ExcludedFromBuild="true">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbb.def file" CommandLine="cl /nologo /TC /EP ../../src/tbb/win64-tbb-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbb.def
|
||||
" Outputs="$(IntDir)\tbb.def"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64">
|
||||
<Tool Name="VCCustomBuildTool" Description="generating tbbmalloc.def file" CommandLine="cl /nologo /TC /EP ../../src/tbbmalloc/win64-tbbmalloc-export.def /DTBB_USE_DEBUG /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 >$(IntDir)\tbbmalloc.def
|
||||
" Outputs="$(IntDir)\tbbmalloc.def"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbbmalloc\tbbmalloc.cpp"/><File RelativePath="..\..\src\tbb\dynamic_link.cpp"/><File RelativePath="..\..\src\tbb\tbb_misc.cpp"/><File RelativePath="..\..\src\tbbmalloc\MemoryAllocator.cpp"/></Filter>
|
||||
<Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File RelativePath="..\..\include\tbb\_tbb_windef.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\aligned_space.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\atomic.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\blocked_range.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\blocked_range2d.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\blocked_range3d.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\cache_aligned_allocator.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\concurrent_hash_map.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\concurrent_queue.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\concurrent_vector.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbbmalloc\Customize.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\enumerable_thread_specific.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbbmalloc\LifoQueue.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbbmalloc\MapMemory.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\null_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\null_rw_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_do.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_for.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_reduce.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_scan.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_sort.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\parallel_while.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\partitioner.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\pipeline.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\queuing_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\queuing_rw_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\recursive_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\scalable_allocator.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\spin_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\spin_rw_mutex.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbbmalloc\Statistics.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\task.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\task_scheduler_init.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\task_scheduler_observer.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_allocator.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_exception.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_machine.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_profiling.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_stddef.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbb_thread.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbbmalloc_proxy.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tick_count.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\src\tbbmalloc\TypeDefinitions.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\windows_intel64.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\machine\windows_ia32.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
<File RelativePath="..\..\src\tbbmalloc\tbbmalloc.rc">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="tbbmalloc_proxy" ProjectGUID="{02F61511-D5B6-46E6-B4BB-DEAA96E6BCC7}" RootNamespace="tbbmalloc_proxy" Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform Name="Win32"/>
|
||||
<Platform Name="x64"/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
<DefaultToolFile FileName="masm.rules"/>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)ia32\$(ConfigurationName)" IntermediateDirectory="ia32\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc" Optimization="0" AdditionalIncludeDirectories="." PreprocessorDefinitions="" MinimalRebuild="true" ExceptionHandling="1" BasicRuntimeChecks="0" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" SuppressStartupBanner="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO " AdditionalDependencies="$(OutDir)\tbbmalloc_debug.lib" OutputFile="$(OutDir)\tbbmalloc_proxy_debug.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Debug|x64" OutputDirectory="$(SolutionDir)intel64\$(ConfigurationName)" IntermediateDirectory="intel64\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool" TargetEnvironment="3"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc" Optimization="0" AdditionalIncludeDirectories="." MinimalRebuild="false" ExceptionHandling="0" BasicRuntimeChecks="0" RuntimeLibrary="3" TreatWChar_tAsBuiltInType="true" UsePrecompiledHeader="0" WarningLevel="4" SuppressStartupBanner="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3" ShowIncludes="false"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbbmalloc.def" OutputFile="$(OutDir)\tbbmalloc_proxy_debug.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" TargetMachine="17"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)ia32\$(ConfigurationName)" IntermediateDirectory="ia32\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0" WholeProgramOptimization="1">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /Oy /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc" AdditionalIncludeDirectories="." PreprocessorDefinitions="" ExceptionHandling="0" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" SuppressStartupBanner="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO " OutputFile="$(OutDir)\tbbmalloc_proxy.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration Name="Release|x64" OutputDirectory="$(SolutionDir)intel64\$(ConfigurationName)" IntermediateDirectory="intel64\$(ConfigurationName)" ConfigurationType="2" CharacterSet="0" WholeProgramOptimization="1">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="MASM"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool" TargetEnvironment="3"/>
|
||||
<Tool Name="VCCLCompilerTool" AdditionalOptions=" /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /W4 /Wp64 /I../../src /I../../src/rml/include /I../../include /I../../src/tbbmalloc /I../../src/tbbmalloc" AdditionalIncludeDirectories="." PreprocessorDefinitions="" ExceptionHandling="0" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" SuppressStartupBanner="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool Name="VCLinkerTool" AdditionalOptions="/nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO /DEF:$(IntDir)\tbbmalloc.def" OutputFile="$(OutDir)\tbbmalloc_proxy.dll" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="17"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter Name="Source Files" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File RelativePath="..\..\src\tbbmalloc\proxy.cpp"/><File RelativePath="..\..\src\tbbmalloc\tbb_function_replacement.cpp"/></Filter>
|
||||
<Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File RelativePath="..\..\src\tbbmalloc\tbb_function_replacement.h">
|
||||
</File>
|
||||
<File RelativePath="..\..\include\tbb\tbbmalloc_proxy.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
<File RelativePath="..\..\src\tbbmalloc\tbbmalloc.rc">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64">
|
||||
<Tool Name="VCResourceCompilerTool" AdditionalOptions="/I../../src /I../../include /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
|
@ -1 +0,0 @@
|
|||
#define __TBB_VERSION_STRINGS "Empty"
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Define compiler-specific variables.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting compiler flags.
|
||||
#------------------------------------------------------------------------------
|
||||
CPLUS = cl /nologo
|
||||
LINK_FLAGS = /link /nologo
|
||||
LIB_LINK_FLAGS=/link /nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO
|
||||
MS_CRT_KEY = /MD$(if $(findstring debug,$(cfg)),d)
|
||||
EH_FLAGS = /EHsc /GR
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = $(MS_CRT_KEY) /O2 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t
|
||||
ASM_FLAGS =
|
||||
ifeq (ia32,$(arch))
|
||||
CPLUS_FLAGS += /Oy
|
||||
endif
|
||||
endif
|
||||
ifeq ($(cfg), debug)
|
||||
CPLUS_FLAGS = $(MS_CRT_KEY) /Od /Ob0 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG
|
||||
ASM_FLAGS = /DUSE_FRAME_POINTER
|
||||
endif
|
||||
|
||||
|
||||
COMPILE_ONLY = /c
|
||||
PREPROC_ONLY = /TC /EP
|
||||
INCLUDE_KEY = /I
|
||||
DEFINE_KEY = /D
|
||||
OUTPUT_KEY = /Fe
|
||||
OUTPUTOBJ_KEY = /Fo
|
||||
WARNING_AS_ERROR_KEY = /WX
|
||||
|
||||
ifeq ($(runtime),vc7.1)
|
||||
WARNING_KEY = /W3
|
||||
else
|
||||
WARNING_KEY = /W4
|
||||
endif
|
||||
|
||||
DYLIB_KEY = /DLL
|
||||
EXPORT_KEY = /DEF:
|
||||
|
||||
ifeq ($(runtime),vc8)
|
||||
OPENMP_FLAG = /openmp
|
||||
WARNING_KEY += /Wp64
|
||||
CPLUS_FLAGS += /D_USE_RTM_VERSION
|
||||
endif
|
||||
ifeq ($(runtime),vc9)
|
||||
OPENMP_FLAG = /openmp
|
||||
endif
|
||||
|
||||
ifeq (intel64,$(arch))
|
||||
CPLUS_FLAGS += /GS-
|
||||
endif
|
||||
|
||||
|
||||
|
||||
CPLUS_FLAGS += /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE \
|
||||
/D_WIN32_WINNT=$(_WIN32_WINNT)
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting compiler flags.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
ASSEMBLY_SOURCE=$(arch)-masm
|
||||
ifeq (intel64,$(arch))
|
||||
ASM=ml64
|
||||
ASM_FLAGS += /DEM64T=1 /c /Zi
|
||||
TBB_ASM.OBJ = atomic_support.obj
|
||||
else
|
||||
ASM=ml
|
||||
ASM_FLAGS += /c /coff /Zi
|
||||
TBB_ASM.OBJ = atomic_support.obj lock_byte.obj
|
||||
endif
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
M_CPLUS_FLAGS = $(subst $(EH_FLAGS),/EHs-,$(CPLUS_FLAGS))
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of define compiler-specific variables.
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Overriding settings from windows.inc
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
SLASH= $(strip \)
|
||||
OBJ = o
|
||||
LIBEXT = dll # MinGW allows linking with DLLs directly
|
||||
|
||||
TBB.RES =
|
||||
MALLOC.RES =
|
||||
TBB.MANIFEST =
|
||||
MALLOC.MANIFEST =
|
||||
|
||||
# TODO: do better when/if mingw64 support is added
|
||||
TBB.DEF = $(tbb_root)/src/tbb/lin32-tbb-export.def
|
||||
MALLOC.DEF = $(MALLOC_ROOT)/win-gcc-tbbmalloc-export.def
|
||||
|
||||
LINK_TBB.LIB = $(TBB.LIB)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of overridden settings
|
||||
#------------------------------------------------------------------------------
|
||||
# Compiler-specific variables
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
CPLUS = g++
|
||||
COMPILE_ONLY = -c -MMD
|
||||
PREPROC_ONLY = -E -x c
|
||||
INCLUDE_KEY = -I
|
||||
DEFINE_KEY = -D
|
||||
OUTPUT_KEY = -o #
|
||||
OUTPUTOBJ_KEY = -o #
|
||||
PIC_KEY =
|
||||
WARNING_AS_ERROR_KEY = -Werror
|
||||
WARNING_KEY = -Wall -Wno-uninitialized
|
||||
WARNING_SUPPRESS = -Wno-parentheses
|
||||
DYLIB_KEY = -shared
|
||||
LIBDL =
|
||||
EXPORT_KEY = -Wl,--version-script,
|
||||
LIBS = -lpsapi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of compiler-specific variables
|
||||
#------------------------------------------------------------------------------
|
||||
# Command lines
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
LINK_FLAGS = -Wl,--enable-auto-import
|
||||
LIB_LINK_FLAGS = $(DYLIB_KEY)
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = -O2
|
||||
endif
|
||||
ifeq ($(cfg), debug)
|
||||
CPLUS_FLAGS = -g -O0 -DTBB_USE_DEBUG
|
||||
endif
|
||||
CPLUS_FLAGS += -DUSE_WINTHREAD
|
||||
|
||||
# MinGW specific
|
||||
CPLUS_FLAGS += -D__MSVCRT_VERSION__=0x0700 -msse -mthreads
|
||||
|
||||
CONLY = gcc
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
|
||||
ifeq (intel64,$(arch))
|
||||
CPLUS_FLAGS += -m64
|
||||
LIB_LINK_FLAGS += -m64
|
||||
endif
|
||||
|
||||
ifeq (ia32,$(arch))
|
||||
CPLUS_FLAGS += -m32
|
||||
LIB_LINK_FLAGS += -m32
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of command lines
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting assembler data
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
ASM=
|
||||
ASM_FLAGS=
|
||||
TBB_ASM.OBJ=
|
||||
ASSEMBLY_SOURCE=$(arch)-gas
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting assembler data
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Define compiler-specific variables.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting default configuration to release.
|
||||
#------------------------------------------------------------------------------
|
||||
cfg ?= release
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting default configuration to release.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting compiler flags.
|
||||
#------------------------------------------------------------------------------
|
||||
CPLUS = icl /nologo $(VCCOMPAT_FLAG)
|
||||
LINK_FLAGS = /link /nologo
|
||||
LIB_LINK_FLAGS= /link /nologo /DLL /MAP /DEBUG /fixed:no /INCREMENTAL:NO
|
||||
MS_CRT_KEY = /MD$(if $(findstring debug,$(cfg)),d)
|
||||
EH_FLAGS = /EHsc /GR
|
||||
|
||||
ifeq ($(cfg), release)
|
||||
CPLUS_FLAGS = $(MS_CRT_KEY) /O2 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t
|
||||
ASM_FLAGS =
|
||||
ifeq (ia32,$(arch))
|
||||
CPLUS_FLAGS += /Oy
|
||||
endif
|
||||
endif
|
||||
ifeq ($(cfg), debug)
|
||||
CPLUS_FLAGS = $(MS_CRT_KEY) /Od /Ob0 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG
|
||||
LINK_FLAGS += libmmds.lib /NODEFAULTLIB:libmmdd.lib
|
||||
ASM_FLAGS = /DUSE_FRAME_POINTER
|
||||
endif
|
||||
|
||||
|
||||
COMPILE_ONLY = /c /QMMD
|
||||
PREPROC_ONLY = /EP /Tc
|
||||
INCLUDE_KEY = /I
|
||||
DEFINE_KEY = /D
|
||||
OUTPUT_KEY = /Fe
|
||||
OUTPUTOBJ_KEY = /Fo
|
||||
WARNING_AS_ERROR_KEY = /WX
|
||||
WARNING_KEY = /W3
|
||||
DYLIB_KEY = /DLL
|
||||
EXPORT_KEY = /DEF:
|
||||
|
||||
ifeq (intel64,$(arch))
|
||||
CPLUS_FLAGS += /GS-
|
||||
endif
|
||||
|
||||
ifneq (,$(codecov))
|
||||
CPLUS_FLAGS += /Qprof-genx
|
||||
else
|
||||
CPLUS_FLAGS += /DDO_ITT_NOTIFY
|
||||
endif
|
||||
|
||||
OPENMP_FLAG = /Qopenmp
|
||||
CPLUS_FLAGS += /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE \
|
||||
/D_WIN32_WINNT=$(_WIN32_WINNT)
|
||||
|
||||
ifeq ($(runtime),vc8)
|
||||
CPLUS_FLAGS += /D_USE_RTM_VERSION
|
||||
endif
|
||||
|
||||
C_FLAGS = $(CPLUS_FLAGS)
|
||||
|
||||
ifneq (00,$(lambdas)$(cpp0x))
|
||||
CPLUS_FLAGS += /Qstd=c++0x /D_TBB_CPP0X
|
||||
endif
|
||||
|
||||
VCVERSION:=$(runtime)
|
||||
VCCOMPAT_FLAG := $(if $(findstring vc7.1, $(VCVERSION)),/Qvc7.1)
|
||||
ifeq ($(VCCOMPAT_FLAG),)
|
||||
VCCOMPAT_FLAG := $(if $(findstring vc8, $(VCVERSION)),/Qvc8)
|
||||
endif
|
||||
ifeq ($(VCCOMPAT_FLAG),)
|
||||
VCCOMPAT_FLAG := $(if $(findstring vc9, $(VCVERSION)),/Qvc9)
|
||||
endif
|
||||
ifeq ($(VCCOMPAT_FLAG),)
|
||||
$(error VC version not detected correctly: $(VCVERSION) )
|
||||
endif
|
||||
export VCCOMPAT_FLAG
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting compiler flags.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
ASSEMBLY_SOURCE=$(arch)-masm
|
||||
ifeq (intel64,$(arch))
|
||||
ASM=ml64
|
||||
ASM_FLAGS += /DEM64T=1 /c /Zi
|
||||
TBB_ASM.OBJ = atomic_support.obj
|
||||
else
|
||||
ASM=ml
|
||||
ASM_FLAGS += /c /coff /Zi
|
||||
TBB_ASM.OBJ = atomic_support.obj lock_byte.obj
|
||||
endif
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting assembler data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
M_CPLUS_FLAGS = $(subst $(EH_FLAGS),/EHs-,$(CPLUS_FLAGS))
|
||||
#------------------------------------------------------------------------------
|
||||
# End of setting tbbmalloc data.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# End of define compiler-specific variables.
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
# Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
#
|
||||
# This file is part of Threading Building Blocks.
|
||||
#
|
||||
# Threading Building Blocks is free software; you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# Threading Building Blocks is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Threading Building Blocks; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
ifdef tbb_build_dir
|
||||
test_dir:=$(tbb_build_dir)
|
||||
else
|
||||
test_dir:=.
|
||||
endif
|
||||
|
||||
# TODO give an error if archs doesn't match
|
||||
ifndef arch
|
||||
export arch:=$(shell cmd /C "cscript /nologo /E:jscript $(tbb_root)/build/detect.js /arch $(compiler)")
|
||||
endif
|
||||
|
||||
ifndef runtime
|
||||
export runtime:=$(shell cmd /C "cscript /nologo /E:jscript $(tbb_root)/build/detect.js /runtime $(compiler)")
|
||||
endif
|
||||
|
||||
native_compiler := cl
|
||||
export compiler ?= cl
|
||||
debugger ?= devenv /debugexe
|
||||
|
||||
CMD=cmd /C
|
||||
CWD=$(shell cmd /C echo %CD%)
|
||||
RM=cmd /C del /Q /F
|
||||
RD=cmd /C rmdir
|
||||
MD=cmd /c mkdir
|
||||
SLASH=\\
|
||||
NUL = nul
|
||||
|
||||
OBJ = obj
|
||||
DLL = dll
|
||||
LIBEXT = lib
|
||||
|
||||
def_prefix = $(if $(findstring ia32,$(arch)),win32,win64)
|
||||
|
||||
# Target Windows version. Do not increase beyond 0x0500 without prior discussion!
|
||||
# Used as the value for macro definition opiton in windows.cl.inc etc.
|
||||
_WIN32_WINNT=0x0400
|
||||
|
||||
TBB.DEF = $(tbb_root)/src/tbb/$(def_prefix)-tbb-export.def
|
||||
TBB.DLL = tbb$(DEBUG_SUFFIX).$(DLL)
|
||||
TBB.LIB = tbb$(DEBUG_SUFFIX).$(LIBEXT)
|
||||
TBB.RES = tbb_resource.res
|
||||
# On Windows, we use #pragma comment to set the proper TBB lib to link with
|
||||
# But for cross-configuration testing, need to link explicitly
|
||||
LINK_TBB.LIB = $(if $(crosstest),$(TBB.LIB))
|
||||
TBB.MANIFEST =
|
||||
ifneq ($(filter vc8 vc9,$(runtime)),)
|
||||
TBB.MANIFEST = tbbmanifest.exe.manifest
|
||||
endif
|
||||
|
||||
MALLOC.DEF = $(MALLOC_ROOT)/$(def_prefix)-tbbmalloc-export.def
|
||||
MALLOC.DLL = tbbmalloc$(DEBUG_SUFFIX).$(DLL)
|
||||
MALLOC.LIB = tbbmalloc$(DEBUG_SUFFIX).$(LIBEXT)
|
||||
MALLOC.RES = tbbmalloc.res
|
||||
MALLOC.MANIFEST =
|
||||
ifneq ($(filter vc8 vc9,$(runtime)),)
|
||||
MALLOC.MANIFEST = tbbmanifest.exe.manifest
|
||||
endif
|
||||
LINK_MALLOC.LIB = $(MALLOC.LIB)
|
||||
|
||||
MALLOCPROXY.DLL = tbbmalloc_proxy$(DEBUG_SUFFIX).$(DLL)
|
||||
MALLOCPROXY.LIB = tbbmalloc_proxy$(DEBUG_SUFFIX).$(LIBEXT)
|
||||
|
||||
RML.DEF = $(RML_SERVER_ROOT)/$(def_prefix)-rml-export.def
|
||||
RML.DLL = irml$(DEBUG_SUFFIX).$(DLL)
|
||||
RML.LIB = irml$(DEBUG_SUFFIX).$(LIBEXT)
|
||||
RML.RES = irml.res
|
||||
ifneq ($(runtime),vc7.1)
|
||||
RML.MANIFEST = tbbmanifest.exe.manifest
|
||||
endif
|
||||
|
||||
MAKE_VERSIONS = cmd /C cscript /nologo /E:jscript $(subst \,/,$(tbb_root))/build/version_info_windows.js $(compiler) $(arch) $(subst \,/,"$(CPLUS) $(CPLUS_FLAGS) $(INCLUDES)") > version_string.tmp
|
||||
MAKE_TBBVARS = cmd /C "$(subst /,\,$(tbb_root))\build\generate_tbbvars.bat"
|
||||
|
||||
TEST_LAUNCHER = $(subst /,\,$(tbb_root))\build\test_launcher.bat
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<H2>Overview</H2>
|
||||
Include files for Threading Building Blocks.
|
||||
|
||||
<H2>Directories</H2>
|
||||
<DL>
|
||||
<DT><A HREF="tbb/index.html">tbb</A>
|
||||
<DD>Include files for Threading Building Blocks classes and functions.
|
||||
</DL>
|
||||
|
||||
<HR>
|
||||
<A HREF="../index.html">Up to parent directory</A>
|
||||
<p></p>
|
||||
Copyright © 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
<p></p>
|
||||
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
|
||||
registered trademarks or trademarks of Intel Corporation or its
|
||||
subsidiaries in the United States and other countries.
|
||||
<p></p>
|
||||
* Other names and brands may be claimed as the property of others.
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
@ -1,973 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_concurrent_queue_internal_H
|
||||
#define __TBB_concurrent_queue_internal_H
|
||||
|
||||
#include "tbb_stddef.h"
|
||||
#include "tbb_machine.h"
|
||||
#include "atomic.h"
|
||||
#include "spin_mutex.h"
|
||||
#include "cache_aligned_allocator.h"
|
||||
#include "tbb_exception.h"
|
||||
#include <iterator>
|
||||
#include <new>
|
||||
|
||||
namespace tbb {
|
||||
|
||||
#if !__TBB_TEMPLATE_FRIENDS_BROKEN
|
||||
|
||||
// forward declaration
|
||||
namespace strict_ppl {
|
||||
template<typename T, typename A> class concurrent_queue;
|
||||
}
|
||||
|
||||
template<typename T, typename A> class concurrent_bounded_queue;
|
||||
|
||||
namespace deprecated {
|
||||
template<typename T, typename A> class concurrent_queue;
|
||||
}
|
||||
#endif
|
||||
|
||||
//! For internal use only.
|
||||
namespace strict_ppl {
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
using namespace tbb::internal;
|
||||
|
||||
typedef size_t ticket;
|
||||
|
||||
static void* invalid_page;
|
||||
|
||||
template<typename T> class micro_queue ;
|
||||
template<typename T> class micro_queue_pop_finalizer ;
|
||||
template<typename T> class concurrent_queue_base_v3;
|
||||
|
||||
//! parts of concurrent_queue_rep that do not have references to micro_queue
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
struct concurrent_queue_rep_base : no_copy {
|
||||
template<typename T> friend class micro_queue;
|
||||
template<typename T> friend class concurrent_queue_base_v3;
|
||||
|
||||
protected:
|
||||
//! Approximately n_queue/golden ratio
|
||||
static const size_t phi = 3;
|
||||
|
||||
public:
|
||||
// must be power of 2
|
||||
static const size_t n_queue = 8;
|
||||
|
||||
//! Prefix on a page
|
||||
struct page {
|
||||
page* next;
|
||||
uintptr_t mask;
|
||||
};
|
||||
|
||||
atomic<ticket> head_counter;
|
||||
char pad1[NFS_MaxLineSize-sizeof(atomic<ticket>)];
|
||||
atomic<ticket> tail_counter;
|
||||
char pad2[NFS_MaxLineSize-sizeof(atomic<ticket>)];
|
||||
|
||||
//! Always a power of 2
|
||||
size_t items_per_page;
|
||||
|
||||
//! Size of an item
|
||||
size_t item_size;
|
||||
|
||||
//! number of invalid entries in the queue
|
||||
atomic<size_t> n_invalid_entries;
|
||||
|
||||
char pad3[NFS_MaxLineSize-sizeof(size_t)-sizeof(size_t)-sizeof(atomic<size_t>)];
|
||||
} ;
|
||||
|
||||
//! Abstract class to define interface for page allocation/deallocation
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
class concurrent_queue_page_allocator
|
||||
{
|
||||
template<typename T> friend class micro_queue ;
|
||||
template<typename T> friend class micro_queue_pop_finalizer ;
|
||||
protected:
|
||||
virtual ~concurrent_queue_page_allocator() {}
|
||||
private:
|
||||
virtual concurrent_queue_rep_base::page* allocate_page() = 0;
|
||||
virtual void deallocate_page( concurrent_queue_rep_base::page* p ) = 0;
|
||||
} ;
|
||||
|
||||
#if _MSC_VER && !defined(__INTEL_COMPILER)
|
||||
// unary minus operator applied to unsigned type, result still unsigned
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4146 )
|
||||
#endif
|
||||
|
||||
//! A queue using simple locking.
|
||||
/** For efficient, this class has no constructor.
|
||||
The caller is expected to zero-initialize it. */
|
||||
template<typename T>
|
||||
class micro_queue : no_copy {
|
||||
typedef concurrent_queue_rep_base::page page;
|
||||
|
||||
//! Class used to ensure exception-safety of method "pop"
|
||||
class destroyer: no_copy {
|
||||
T& my_value;
|
||||
public:
|
||||
destroyer( T& value ) : my_value(value) {}
|
||||
~destroyer() {my_value.~T();}
|
||||
};
|
||||
|
||||
T& get_ref( page& page, size_t index ) {
|
||||
return static_cast<T*>(static_cast<void*>(&page+1))[index];
|
||||
}
|
||||
|
||||
void copy_item( page& dst, size_t index, const void* src ) {
|
||||
new( &get_ref(dst,index) ) T(*static_cast<const T*>(src));
|
||||
}
|
||||
|
||||
void copy_item( page& dst, size_t dindex, const page& src, size_t sindex ) {
|
||||
new( &get_ref(dst,dindex) ) T( static_cast<const T*>(static_cast<const void*>(&src+1))[sindex] );
|
||||
}
|
||||
|
||||
void assign_and_destroy_item( void* dst, page& src, size_t index ) {
|
||||
T& from = get_ref(src,index);
|
||||
destroyer d(from);
|
||||
*static_cast<T*>(dst) = from;
|
||||
}
|
||||
|
||||
void spin_wait_until_my_turn( atomic<ticket>& counter, ticket k, concurrent_queue_rep_base& rb ) const ;
|
||||
|
||||
public:
|
||||
friend class micro_queue_pop_finalizer<T>;
|
||||
|
||||
atomic<page*> head_page;
|
||||
atomic<ticket> head_counter;
|
||||
|
||||
atomic<page*> tail_page;
|
||||
atomic<ticket> tail_counter;
|
||||
|
||||
spin_mutex page_mutex;
|
||||
|
||||
void push( const void* item, ticket k, concurrent_queue_base_v3<T>& base ) ;
|
||||
|
||||
bool pop( void* dst, ticket k, concurrent_queue_base_v3<T>& base ) ;
|
||||
|
||||
micro_queue& assign( const micro_queue& src, concurrent_queue_base_v3<T>& base ) ;
|
||||
|
||||
page* make_copy( concurrent_queue_base_v3<T>& base, const page* src_page, size_t begin_in_page, size_t end_in_page, ticket& g_index ) ;
|
||||
|
||||
void make_invalid( ticket k ) ;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void micro_queue<T>::spin_wait_until_my_turn( atomic<ticket>& counter, ticket k, concurrent_queue_rep_base& rb ) const {
|
||||
atomic_backoff backoff;
|
||||
do {
|
||||
backoff.pause();
|
||||
if( counter&0x1 ) {
|
||||
++rb.n_invalid_entries;
|
||||
throw_bad_last_alloc_exception_v4();
|
||||
}
|
||||
} while( counter!=k ) ;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void micro_queue<T>::push( const void* item, ticket k, concurrent_queue_base_v3<T>& base ) {
|
||||
k &= -concurrent_queue_rep_base::n_queue;
|
||||
page* p = NULL;
|
||||
size_t index = k/concurrent_queue_rep_base::n_queue & (base.my_rep->items_per_page-1);
|
||||
if( !index ) {
|
||||
try {
|
||||
concurrent_queue_page_allocator& pa = base;
|
||||
p = pa.allocate_page();
|
||||
} catch (...) {
|
||||
++base.my_rep->n_invalid_entries;
|
||||
make_invalid( k );
|
||||
}
|
||||
p->mask = 0;
|
||||
p->next = NULL;
|
||||
}
|
||||
|
||||
if( tail_counter!=k ) spin_wait_until_my_turn( tail_counter, k, *base.my_rep );
|
||||
|
||||
if( p ) {
|
||||
spin_mutex::scoped_lock lock( page_mutex );
|
||||
if( page* q = tail_page )
|
||||
q->next = p;
|
||||
else
|
||||
head_page = p;
|
||||
tail_page = p;
|
||||
} else {
|
||||
p = tail_page;
|
||||
}
|
||||
|
||||
try {
|
||||
copy_item( *p, index, item );
|
||||
// If no exception was thrown, mark item as present.
|
||||
p->mask |= uintptr_t(1)<<index;
|
||||
tail_counter += concurrent_queue_rep_base::n_queue;
|
||||
} catch (...) {
|
||||
++base.my_rep->n_invalid_entries;
|
||||
tail_counter += concurrent_queue_rep_base::n_queue;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool micro_queue<T>::pop( void* dst, ticket k, concurrent_queue_base_v3<T>& base ) {
|
||||
k &= -concurrent_queue_rep_base::n_queue;
|
||||
if( head_counter!=k ) spin_wait_until_eq( head_counter, k );
|
||||
if( tail_counter==k ) spin_wait_while_eq( tail_counter, k );
|
||||
page& p = *head_page;
|
||||
__TBB_ASSERT( &p, NULL );
|
||||
size_t index = k/concurrent_queue_rep_base::n_queue & (base.my_rep->items_per_page-1);
|
||||
bool success = false;
|
||||
{
|
||||
micro_queue_pop_finalizer<T> finalizer( *this, base, k+concurrent_queue_rep_base::n_queue, index==base.my_rep->items_per_page-1 ? &p : NULL );
|
||||
if( p.mask & uintptr_t(1)<<index ) {
|
||||
success = true;
|
||||
assign_and_destroy_item( dst, p, index );
|
||||
} else {
|
||||
--base.my_rep->n_invalid_entries;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
micro_queue<T>& micro_queue<T>::assign( const micro_queue<T>& src, concurrent_queue_base_v3<T>& base ) {
|
||||
head_counter = src.head_counter;
|
||||
tail_counter = src.tail_counter;
|
||||
page_mutex = src.page_mutex;
|
||||
|
||||
const page* srcp = src.head_page;
|
||||
if( srcp ) {
|
||||
ticket g_index = head_counter;
|
||||
try {
|
||||
size_t n_items = (tail_counter-head_counter)/concurrent_queue_rep_base::n_queue;
|
||||
size_t index = head_counter/concurrent_queue_rep_base::n_queue & (base.my_rep->items_per_page-1);
|
||||
size_t end_in_first_page = (index+n_items<base.my_rep->items_per_page)?(index+n_items):base.my_rep->items_per_page;
|
||||
|
||||
head_page = make_copy( base, srcp, index, end_in_first_page, g_index );
|
||||
page* cur_page = head_page;
|
||||
|
||||
if( srcp != src.tail_page ) {
|
||||
for( srcp = srcp->next; srcp!=src.tail_page; srcp=srcp->next ) {
|
||||
cur_page->next = make_copy( base, srcp, 0, base.my_rep->items_per_page, g_index );
|
||||
cur_page = cur_page->next;
|
||||
}
|
||||
|
||||
__TBB_ASSERT( srcp==src.tail_page, NULL );
|
||||
size_t last_index = tail_counter/concurrent_queue_rep_base::n_queue & (base.my_rep->items_per_page-1);
|
||||
if( last_index==0 ) last_index = base.my_rep->items_per_page;
|
||||
|
||||
cur_page->next = make_copy( base, srcp, 0, last_index, g_index );
|
||||
cur_page = cur_page->next;
|
||||
}
|
||||
tail_page = cur_page;
|
||||
} catch (...) {
|
||||
make_invalid( g_index );
|
||||
}
|
||||
} else {
|
||||
head_page = tail_page = NULL;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void micro_queue<T>::make_invalid( ticket k ) {
|
||||
static page dummy = {static_cast<page*>((void*)1), 0};
|
||||
// mark it so that no more pushes are allowed.
|
||||
invalid_page = &dummy;
|
||||
{
|
||||
spin_mutex::scoped_lock lock( page_mutex );
|
||||
tail_counter = k+concurrent_queue_rep_base::n_queue+1;
|
||||
if( page* q = tail_page )
|
||||
q->next = static_cast<page*>(invalid_page);
|
||||
else
|
||||
head_page = static_cast<page*>(invalid_page);
|
||||
tail_page = static_cast<page*>(invalid_page);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
concurrent_queue_rep_base::page* micro_queue<T>::make_copy( concurrent_queue_base_v3<T>& base, const concurrent_queue_rep_base::page* src_page, size_t begin_in_page, size_t end_in_page, ticket& g_index ) {
|
||||
concurrent_queue_page_allocator& pa = base;
|
||||
page* new_page = pa.allocate_page();
|
||||
new_page->next = NULL;
|
||||
new_page->mask = src_page->mask;
|
||||
for( ; begin_in_page!=end_in_page; ++begin_in_page, ++g_index )
|
||||
if( new_page->mask & uintptr_t(1)<<begin_in_page )
|
||||
copy_item( *new_page, begin_in_page, *src_page, begin_in_page );
|
||||
return new_page;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
class micro_queue_pop_finalizer: no_copy {
|
||||
typedef concurrent_queue_rep_base::page page;
|
||||
ticket my_ticket;
|
||||
micro_queue<T>& my_queue;
|
||||
page* my_page;
|
||||
concurrent_queue_page_allocator& allocator;
|
||||
public:
|
||||
micro_queue_pop_finalizer( micro_queue<T>& queue, concurrent_queue_base_v3<T>& b, ticket k, page* p ) :
|
||||
my_ticket(k), my_queue(queue), my_page(p), allocator(b)
|
||||
{}
|
||||
~micro_queue_pop_finalizer() ;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
micro_queue_pop_finalizer<T>::~micro_queue_pop_finalizer() {
|
||||
page* p = my_page;
|
||||
if( p ) {
|
||||
spin_mutex::scoped_lock lock( my_queue.page_mutex );
|
||||
page* q = p->next;
|
||||
my_queue.head_page = q;
|
||||
if( !q ) {
|
||||
my_queue.tail_page = NULL;
|
||||
}
|
||||
}
|
||||
my_queue.head_counter = my_ticket;
|
||||
if( p ) {
|
||||
allocator.deallocate_page( p );
|
||||
}
|
||||
}
|
||||
|
||||
#if _MSC_VER && !defined(__INTEL_COMPILER)
|
||||
#pragma warning( pop )
|
||||
#endif // warning 4146 is back
|
||||
|
||||
template<typename T> class concurrent_queue_iterator_rep ;
|
||||
template<typename T> class concurrent_queue_iterator_base_v3;
|
||||
|
||||
//! representation of concurrent_queue_base
|
||||
/**
|
||||
* the class inherits from concurrent_queue_rep_base and defines an array of micro_queue<T>'s
|
||||
*/
|
||||
template<typename T>
|
||||
struct concurrent_queue_rep : public concurrent_queue_rep_base {
|
||||
micro_queue<T> array[n_queue];
|
||||
|
||||
//! Map ticket to an array index
|
||||
static size_t index( ticket k ) {
|
||||
return k*phi%n_queue;
|
||||
}
|
||||
|
||||
micro_queue<T>& choose( ticket k ) {
|
||||
// The formula here approximates LRU in a cache-oblivious way.
|
||||
return array[index(k)];
|
||||
}
|
||||
};
|
||||
|
||||
//! base class of concurrent_queue
|
||||
/**
|
||||
* The class implements the interface defined by concurrent_queue_page_allocator
|
||||
* and has a pointer to an instance of concurrent_queue_rep.
|
||||
*/
|
||||
template<typename T>
|
||||
class concurrent_queue_base_v3: public concurrent_queue_page_allocator {
|
||||
//! Internal representation
|
||||
concurrent_queue_rep<T>* my_rep;
|
||||
|
||||
friend struct concurrent_queue_rep<T>;
|
||||
friend class micro_queue<T>;
|
||||
friend class concurrent_queue_iterator_rep<T>;
|
||||
friend class concurrent_queue_iterator_base_v3<T>;
|
||||
|
||||
protected:
|
||||
typedef typename concurrent_queue_rep<T>::page page;
|
||||
|
||||
private:
|
||||
/* override */ virtual page *allocate_page() {
|
||||
concurrent_queue_rep<T>& r = *my_rep;
|
||||
size_t n = sizeof(page) + r.items_per_page*r.item_size;
|
||||
return reinterpret_cast<page*>(allocate_block ( n ));
|
||||
}
|
||||
|
||||
/* override */ virtual void deallocate_page( concurrent_queue_rep_base::page *p ) {
|
||||
concurrent_queue_rep<T>& r = *my_rep;
|
||||
size_t n = sizeof(page) + r.items_per_page*r.item_size;
|
||||
deallocate_block( reinterpret_cast<void*>(p), n );
|
||||
}
|
||||
|
||||
//! custom allocator
|
||||
virtual void *allocate_block( size_t n ) = 0;
|
||||
|
||||
//! custom de-allocator
|
||||
virtual void deallocate_block( void *p, size_t n ) = 0;
|
||||
|
||||
protected:
|
||||
concurrent_queue_base_v3( size_t item_size ) ;
|
||||
|
||||
/* override */ virtual ~concurrent_queue_base_v3() {
|
||||
size_t nq = my_rep->n_queue;
|
||||
for( size_t i=0; i<nq; i++ )
|
||||
__TBB_ASSERT( my_rep->array[i].tail_page==NULL, "pages were not freed properly" );
|
||||
cache_aligned_allocator<concurrent_queue_rep<T> >().deallocate(my_rep,1);
|
||||
}
|
||||
|
||||
//! Enqueue item at tail of queue
|
||||
void internal_push( const void* src ) {
|
||||
concurrent_queue_rep<T>& r = *my_rep;
|
||||
ticket k = r.tail_counter++;
|
||||
r.choose(k).push( src, k, *this );
|
||||
}
|
||||
|
||||
//! Attempt to dequeue item from queue.
|
||||
/** NULL if there was no item to dequeue. */
|
||||
bool internal_try_pop( void* dst ) ;
|
||||
|
||||
//! Get size of queue; result may be invalid if queue is modified concurrently
|
||||
size_t internal_size() const ;
|
||||
|
||||
//! check if the queue is empty; thread safe
|
||||
bool internal_empty() const ;
|
||||
|
||||
//! free any remaining pages
|
||||
/* note that the name may be misleading, but it remains so due to a historical accident. */
|
||||
void internal_finish_clear() ;
|
||||
|
||||
//! throw an exception
|
||||
void internal_throw_exception() const {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
//! copy internal representation
|
||||
void assign( const concurrent_queue_base_v3& src ) ;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concurrent_queue_base_v3<T>::concurrent_queue_base_v3( size_t item_size ) {
|
||||
my_rep = cache_aligned_allocator<concurrent_queue_rep<T> >().allocate(1);
|
||||
__TBB_ASSERT( (size_t)my_rep % NFS_GetLineSize()==0, "alignment error" );
|
||||
__TBB_ASSERT( (size_t)&my_rep->head_counter % NFS_GetLineSize()==0, "alignment error" );
|
||||
__TBB_ASSERT( (size_t)&my_rep->tail_counter % NFS_GetLineSize()==0, "alignment error" );
|
||||
__TBB_ASSERT( (size_t)&my_rep->array % NFS_GetLineSize()==0, "alignment error" );
|
||||
memset(my_rep,0,sizeof(concurrent_queue_rep<T>));
|
||||
my_rep->item_size = item_size;
|
||||
my_rep->items_per_page = item_size<=8 ? 32 :
|
||||
item_size<=16 ? 16 :
|
||||
item_size<=32 ? 8 :
|
||||
item_size<=64 ? 4 :
|
||||
item_size<=128 ? 2 :
|
||||
1;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool concurrent_queue_base_v3<T>::internal_try_pop( void* dst ) {
|
||||
concurrent_queue_rep<T>& r = *my_rep;
|
||||
ticket k;
|
||||
do {
|
||||
k = r.head_counter;
|
||||
for(;;) {
|
||||
if( r.tail_counter<=k ) {
|
||||
// Queue is empty
|
||||
return false;
|
||||
}
|
||||
// Queue had item with ticket k when we looked. Attempt to get that item.
|
||||
ticket tk=k;
|
||||
#if defined(_MSC_VER) && defined(_Wp64)
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4267)
|
||||
#endif
|
||||
k = r.head_counter.compare_and_swap( tk+1, tk );
|
||||
#if defined(_MSC_VER) && defined(_Wp64)
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
if( k==tk )
|
||||
break;
|
||||
// Another thread snatched the item, retry.
|
||||
}
|
||||
} while( !r.choose( k ).pop( dst, k, *this ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
size_t concurrent_queue_base_v3<T>::internal_size() const {
|
||||
concurrent_queue_rep<T>& r = *my_rep;
|
||||
__TBB_ASSERT( sizeof(ptrdiff_t)<=sizeof(size_t), NULL );
|
||||
ticket hc = r.head_counter;
|
||||
size_t nie = r.n_invalid_entries;
|
||||
ticket tc = r.tail_counter;
|
||||
__TBB_ASSERT( hc!=tc || !nie, NULL );
|
||||
ptrdiff_t sz = tc-hc-nie;
|
||||
return sz<0 ? 0 : size_t(sz);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool concurrent_queue_base_v3<T>::internal_empty() const {
|
||||
concurrent_queue_rep<T>& r = *my_rep;
|
||||
ticket tc = r.tail_counter;
|
||||
ticket hc = r.head_counter;
|
||||
// if tc!=r.tail_counter, the queue was not empty at some point between the two reads.
|
||||
return tc==r.tail_counter && tc==hc+r.n_invalid_entries ;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void concurrent_queue_base_v3<T>::internal_finish_clear() {
|
||||
concurrent_queue_rep<T>& r = *my_rep;
|
||||
size_t nq = r.n_queue;
|
||||
for( size_t i=0; i<nq; ++i ) {
|
||||
page* tp = r.array[i].tail_page;
|
||||
__TBB_ASSERT( r.array[i].head_page==tp, "at most one page should remain" );
|
||||
if( tp!=NULL) {
|
||||
if( tp!=invalid_page ) deallocate_page( tp );
|
||||
r.array[i].tail_page = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void concurrent_queue_base_v3<T>::assign( const concurrent_queue_base_v3& src ) {
|
||||
concurrent_queue_rep<T>& r = *my_rep;
|
||||
r.items_per_page = src.my_rep->items_per_page;
|
||||
|
||||
// copy concurrent_queue_rep.
|
||||
r.head_counter = src.my_rep->head_counter;
|
||||
r.tail_counter = src.my_rep->tail_counter;
|
||||
r.n_invalid_entries = src.my_rep->n_invalid_entries;
|
||||
|
||||
// copy micro_queues
|
||||
for( size_t i = 0; i<r.n_queue; ++i )
|
||||
r.array[i].assign( src.my_rep->array[i], *this);
|
||||
|
||||
__TBB_ASSERT( r.head_counter==src.my_rep->head_counter && r.tail_counter==src.my_rep->tail_counter,
|
||||
"the source concurrent queue should not be concurrently modified." );
|
||||
}
|
||||
|
||||
template<typename Container, typename Value> class concurrent_queue_iterator;
|
||||
|
||||
template<typename T>
|
||||
class concurrent_queue_iterator_rep: no_assign {
|
||||
public:
|
||||
ticket head_counter;
|
||||
const concurrent_queue_base_v3<T>& my_queue;
|
||||
typename concurrent_queue_base_v3<T>::page* array[concurrent_queue_rep<T>::n_queue];
|
||||
concurrent_queue_iterator_rep( const concurrent_queue_base_v3<T>& queue ) :
|
||||
head_counter(queue.my_rep->head_counter),
|
||||
my_queue(queue)
|
||||
{
|
||||
for( size_t k=0; k<concurrent_queue_rep<T>::n_queue; ++k )
|
||||
array[k] = queue.my_rep->array[k].head_page;
|
||||
}
|
||||
|
||||
//! Set item to point to kth element. Return true if at end of queue or item is marked valid; false otherwise.
|
||||
bool get_item( void*& item, size_t k ) ;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
bool concurrent_queue_iterator_rep<T>::get_item( void*& item, size_t k ) {
|
||||
if( k==my_queue.my_rep->tail_counter ) {
|
||||
item = NULL;
|
||||
return true;
|
||||
} else {
|
||||
typename concurrent_queue_base_v3<T>::page* p = array[concurrent_queue_rep<T>::index(k)];
|
||||
__TBB_ASSERT(p,NULL);
|
||||
size_t i = k/concurrent_queue_rep<T>::n_queue & (my_queue.my_rep->items_per_page-1);
|
||||
item = static_cast<unsigned char*>(static_cast<void*>(p+1)) + my_queue.my_rep->item_size*i;
|
||||
return (p->mask & uintptr_t(1)<<i)!=0;
|
||||
}
|
||||
}
|
||||
|
||||
//! Type-independent portion of concurrent_queue_iterator.
|
||||
/** @ingroup containers */
|
||||
template<typename Value>
|
||||
class concurrent_queue_iterator_base_v3 : no_assign {
|
||||
//! Concurrentconcurrent_queue over which we are iterating.
|
||||
/** NULL if one past last element in queue. */
|
||||
concurrent_queue_iterator_rep<Value>* my_rep;
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
friend bool operator==( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j );
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
friend bool operator!=( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j );
|
||||
protected:
|
||||
//! Pointer to current item
|
||||
mutable void* my_item;
|
||||
|
||||
public:
|
||||
//! Default constructor
|
||||
concurrent_queue_iterator_base_v3() : my_rep(NULL), my_item(NULL) {
|
||||
#if __GNUC__==4&&__GNUC_MINOR__==3
|
||||
// to get around a possible gcc 4.3 bug
|
||||
__asm__ __volatile__("": : :"memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Copy constructor
|
||||
concurrent_queue_iterator_base_v3( const concurrent_queue_iterator_base_v3& i ) : my_rep(NULL), my_item(NULL) {
|
||||
assign(i);
|
||||
}
|
||||
|
||||
//! Construct iterator pointing to head of queue.
|
||||
concurrent_queue_iterator_base_v3( const concurrent_queue_base_v3<Value>& queue ) ;
|
||||
|
||||
protected:
|
||||
//! Assignment
|
||||
void assign( const concurrent_queue_iterator_base_v3<Value>& other ) ;
|
||||
|
||||
//! Advance iterator one step towards tail of queue.
|
||||
void advance() ;
|
||||
|
||||
//! Destructor
|
||||
~concurrent_queue_iterator_base_v3() {
|
||||
cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
|
||||
my_rep = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Value>
|
||||
concurrent_queue_iterator_base_v3<Value>::concurrent_queue_iterator_base_v3( const concurrent_queue_base_v3<Value>& queue ) {
|
||||
my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
|
||||
new( my_rep ) concurrent_queue_iterator_rep<Value>(queue);
|
||||
size_t k = my_rep->head_counter;
|
||||
if( !my_rep->get_item(my_item, k) ) advance();
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
void concurrent_queue_iterator_base_v3<Value>::assign( const concurrent_queue_iterator_base_v3<Value>& other ) {
|
||||
if( my_rep!=other.my_rep ) {
|
||||
if( my_rep ) {
|
||||
cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().deallocate(my_rep, 1);
|
||||
my_rep = NULL;
|
||||
}
|
||||
if( other.my_rep ) {
|
||||
my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep<Value> >().allocate(1);
|
||||
new( my_rep ) concurrent_queue_iterator_rep<Value>( *other.my_rep );
|
||||
}
|
||||
}
|
||||
my_item = other.my_item;
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
void concurrent_queue_iterator_base_v3<Value>::advance() {
|
||||
__TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" );
|
||||
size_t k = my_rep->head_counter;
|
||||
const concurrent_queue_base_v3<Value>& queue = my_rep->my_queue;
|
||||
#if TBB_USE_ASSERT
|
||||
void* tmp;
|
||||
my_rep->get_item(tmp,k);
|
||||
__TBB_ASSERT( my_item==tmp, NULL );
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
size_t i = k/concurrent_queue_rep<Value>::n_queue & (queue.my_rep->items_per_page-1);
|
||||
if( i==queue.my_rep->items_per_page-1 ) {
|
||||
typename concurrent_queue_base_v3<Value>::page*& root = my_rep->array[concurrent_queue_rep<Value>::index(k)];
|
||||
root = root->next;
|
||||
}
|
||||
// advance k
|
||||
my_rep->head_counter = ++k;
|
||||
if( !my_rep->get_item(my_item, k) ) advance();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline const concurrent_queue_iterator_base_v3<const T>& add_constness( const concurrent_queue_iterator_base_v3<T>& q )
|
||||
{
|
||||
return *reinterpret_cast<const concurrent_queue_iterator_base_v3<const T> *>(&q) ;
|
||||
}
|
||||
|
||||
//! Meets requirements of a forward iterator for STL.
|
||||
/** Value is either the T or const T type of the container.
|
||||
@ingroup containers */
|
||||
template<typename Container, typename Value>
|
||||
class concurrent_queue_iterator: public concurrent_queue_iterator_base_v3<Value>,
|
||||
public std::iterator<std::forward_iterator_tag,Value> {
|
||||
#if !__TBB_TEMPLATE_FRIENDS_BROKEN
|
||||
template<typename T, class A>
|
||||
friend class ::tbb::strict_ppl::concurrent_queue;
|
||||
#else
|
||||
public: // workaround for MSVC
|
||||
#endif
|
||||
//! Construct iterator pointing to head of queue.
|
||||
concurrent_queue_iterator( const concurrent_queue_base_v3<Value>& queue ) :
|
||||
concurrent_queue_iterator_base_v3<Value>(queue)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
concurrent_queue_iterator() {}
|
||||
|
||||
//! Copy constructor
|
||||
concurrent_queue_iterator( const concurrent_queue_iterator<Container,Value>& other ) :
|
||||
concurrent_queue_iterator_base_v3<Value>(other)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
concurrent_queue_iterator( const concurrent_queue_iterator<Container,T>& other ) :
|
||||
concurrent_queue_iterator_base_v3<Value>(add_constness(other))
|
||||
{
|
||||
}
|
||||
|
||||
//! Iterator assignment
|
||||
concurrent_queue_iterator& operator=( const concurrent_queue_iterator& other ) {
|
||||
assign(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Reference to current item
|
||||
Value& operator*() const {
|
||||
return *static_cast<Value*>(this->my_item);
|
||||
}
|
||||
|
||||
Value* operator->() const {return &operator*();}
|
||||
|
||||
//! Advance to next item in queue
|
||||
concurrent_queue_iterator& operator++() {
|
||||
this->advance();
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Post increment
|
||||
Value* operator++(int) {
|
||||
Value* result = &operator*();
|
||||
operator++();
|
||||
return result;
|
||||
}
|
||||
}; // concurrent_queue_iterator
|
||||
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
bool operator==( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j ) {
|
||||
return i.my_item==j.my_item;
|
||||
}
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
bool operator!=( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j ) {
|
||||
return i.my_item!=j.my_item;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
//! @endcond
|
||||
|
||||
} // namespace strict_ppl
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
class concurrent_queue_rep;
|
||||
class concurrent_queue_iterator_rep;
|
||||
class concurrent_queue_iterator_base_v3;
|
||||
template<typename Container, typename Value> class concurrent_queue_iterator;
|
||||
|
||||
//! For internal use only.
|
||||
/** Type-independent portion of concurrent_queue.
|
||||
@ingroup containers */
|
||||
class concurrent_queue_base_v3: no_copy {
|
||||
//! Internal representation
|
||||
concurrent_queue_rep* my_rep;
|
||||
|
||||
friend class concurrent_queue_rep;
|
||||
friend struct micro_queue;
|
||||
friend class micro_queue_pop_finalizer;
|
||||
friend class concurrent_queue_iterator_rep;
|
||||
friend class concurrent_queue_iterator_base_v3;
|
||||
protected:
|
||||
//! Prefix on a page
|
||||
struct page {
|
||||
page* next;
|
||||
uintptr_t mask;
|
||||
};
|
||||
|
||||
//! Capacity of the queue
|
||||
ptrdiff_t my_capacity;
|
||||
|
||||
//! Always a power of 2
|
||||
size_t items_per_page;
|
||||
|
||||
//! Size of an item
|
||||
size_t item_size;
|
||||
|
||||
private:
|
||||
virtual void copy_item( page& dst, size_t index, const void* src ) = 0;
|
||||
virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) = 0;
|
||||
protected:
|
||||
__TBB_EXPORTED_METHOD concurrent_queue_base_v3( size_t item_size );
|
||||
virtual __TBB_EXPORTED_METHOD ~concurrent_queue_base_v3();
|
||||
|
||||
//! Enqueue item at tail of queue
|
||||
void __TBB_EXPORTED_METHOD internal_push( const void* src );
|
||||
|
||||
//! Dequeue item from head of queue
|
||||
void __TBB_EXPORTED_METHOD internal_pop( void* dst );
|
||||
|
||||
//! Attempt to enqueue item onto queue.
|
||||
bool __TBB_EXPORTED_METHOD internal_push_if_not_full( const void* src );
|
||||
|
||||
//! Attempt to dequeue item from queue.
|
||||
/** NULL if there was no item to dequeue. */
|
||||
bool __TBB_EXPORTED_METHOD internal_pop_if_present( void* dst );
|
||||
|
||||
//! Get size of queue
|
||||
ptrdiff_t __TBB_EXPORTED_METHOD internal_size() const;
|
||||
|
||||
//! Check if the queue is emtpy
|
||||
bool __TBB_EXPORTED_METHOD internal_empty() const;
|
||||
|
||||
//! Set the queue capacity
|
||||
void __TBB_EXPORTED_METHOD internal_set_capacity( ptrdiff_t capacity, size_t element_size );
|
||||
|
||||
//! custom allocator
|
||||
virtual page *allocate_page() = 0;
|
||||
|
||||
//! custom de-allocator
|
||||
virtual void deallocate_page( page *p ) = 0;
|
||||
|
||||
//! free any remaining pages
|
||||
/* note that the name may be misleading, but it remains so due to a historical accident. */
|
||||
void __TBB_EXPORTED_METHOD internal_finish_clear() ;
|
||||
|
||||
//! throw an exception
|
||||
void __TBB_EXPORTED_METHOD internal_throw_exception() const;
|
||||
|
||||
//! copy internal representation
|
||||
void __TBB_EXPORTED_METHOD assign( const concurrent_queue_base_v3& src ) ;
|
||||
|
||||
private:
|
||||
virtual void copy_page_item( page& dst, size_t dindex, const page& src, size_t sindex ) = 0;
|
||||
};
|
||||
|
||||
//! Type-independent portion of concurrent_queue_iterator.
|
||||
/** @ingroup containers */
|
||||
class concurrent_queue_iterator_base_v3 {
|
||||
//! Concurrentconcurrent_queue over which we are iterating.
|
||||
/** NULL if one past last element in queue. */
|
||||
concurrent_queue_iterator_rep* my_rep;
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
friend bool operator==( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j );
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
friend bool operator!=( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j );
|
||||
protected:
|
||||
//! Pointer to current item
|
||||
mutable void* my_item;
|
||||
|
||||
//! Default constructor
|
||||
concurrent_queue_iterator_base_v3() : my_rep(NULL), my_item(NULL) {}
|
||||
|
||||
//! Copy constructor
|
||||
concurrent_queue_iterator_base_v3( const concurrent_queue_iterator_base_v3& i ) : my_rep(NULL), my_item(NULL) {
|
||||
assign(i);
|
||||
}
|
||||
|
||||
//! Construct iterator pointing to head of queue.
|
||||
__TBB_EXPORTED_METHOD concurrent_queue_iterator_base_v3( const concurrent_queue_base_v3& queue );
|
||||
|
||||
//! Assignment
|
||||
void __TBB_EXPORTED_METHOD assign( const concurrent_queue_iterator_base_v3& i );
|
||||
|
||||
//! Advance iterator one step towards tail of queue.
|
||||
void __TBB_EXPORTED_METHOD advance();
|
||||
|
||||
//! Destructor
|
||||
__TBB_EXPORTED_METHOD ~concurrent_queue_iterator_base_v3();
|
||||
};
|
||||
|
||||
typedef concurrent_queue_iterator_base_v3 concurrent_queue_iterator_base;
|
||||
|
||||
//! Meets requirements of a forward iterator for STL.
|
||||
/** Value is either the T or const T type of the container.
|
||||
@ingroup containers */
|
||||
template<typename Container, typename Value>
|
||||
class concurrent_queue_iterator: public concurrent_queue_iterator_base,
|
||||
public std::iterator<std::forward_iterator_tag,Value> {
|
||||
#if !defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
template<typename T, class A>
|
||||
friend class ::tbb::concurrent_bounded_queue;
|
||||
|
||||
template<typename T, class A>
|
||||
friend class ::tbb::deprecated::concurrent_queue;
|
||||
#else
|
||||
public: // workaround for MSVC
|
||||
#endif
|
||||
//! Construct iterator pointing to head of queue.
|
||||
concurrent_queue_iterator( const concurrent_queue_base_v3& queue ) :
|
||||
concurrent_queue_iterator_base_v3(queue)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
concurrent_queue_iterator() {}
|
||||
|
||||
/** If Value==Container::value_type, then this routine is the copy constructor.
|
||||
If Value==const Container::value_type, then this routine is a conversion constructor. */
|
||||
concurrent_queue_iterator( const concurrent_queue_iterator<Container,typename Container::value_type>& other ) :
|
||||
concurrent_queue_iterator_base_v3(other)
|
||||
{}
|
||||
|
||||
//! Iterator assignment
|
||||
concurrent_queue_iterator& operator=( const concurrent_queue_iterator& other ) {
|
||||
assign(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Reference to current item
|
||||
Value& operator*() const {
|
||||
return *static_cast<Value*>(my_item);
|
||||
}
|
||||
|
||||
Value* operator->() const {return &operator*();}
|
||||
|
||||
//! Advance to next item in queue
|
||||
concurrent_queue_iterator& operator++() {
|
||||
advance();
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Post increment
|
||||
Value* operator++(int) {
|
||||
Value* result = &operator*();
|
||||
operator++();
|
||||
return result;
|
||||
}
|
||||
}; // concurrent_queue_iterator
|
||||
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
bool operator==( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j ) {
|
||||
return i.my_item==j.my_item;
|
||||
}
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
bool operator!=( const concurrent_queue_iterator<C,T>& i, const concurrent_queue_iterator<C,U>& j ) {
|
||||
return i.my_item!=j.my_item;
|
||||
}
|
||||
|
||||
} // namespace internal;
|
||||
|
||||
//! @endcond
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_concurrent_queue_internal_H */
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_tbb_windef_H
|
||||
#error Do not #include this file directly. Use "#include tbb/tbb_stddef.h" instead.
|
||||
#endif /* __TBB_tbb_windef_H */
|
||||
|
||||
// Check that the target Windows version has all API calls requried for TBB.
|
||||
// Do not increase the version in condition beyond 0x0500 without prior discussion!
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT<0x0400
|
||||
#error TBB is unable to run on old Windows versions; _WIN32_WINNT must be 0x0400 or greater.
|
||||
#endif
|
||||
|
||||
#if !defined(_MT)
|
||||
#error TBB requires linkage with multithreaded C/C++ runtime library. \
|
||||
Choose multithreaded DLL runtime in project settings, or use /MD[d] compiler switch.
|
||||
#elif !defined(_DLL)
|
||||
#pragma message("Warning: Using TBB together with static C/C++ runtime library is not recommended. " \
|
||||
"Consider switching your project to multithreaded DLL runtime used by TBB.")
|
||||
#endif
|
||||
|
||||
// Workaround for the problem with MVSC headers failing to define namespace std
|
||||
namespace std {
|
||||
using ::size_t; using ::ptrdiff_t;
|
||||
}
|
||||
|
||||
#define __TBB_STRING_AUX(x) #x
|
||||
#define __TBB_STRING(x) __TBB_STRING_AUX(x)
|
||||
|
||||
// Default setting of TBB_USE_DEBUG
|
||||
#ifdef TBB_USE_DEBUG
|
||||
# if TBB_USE_DEBUG
|
||||
# if !defined(_DEBUG)
|
||||
# pragma message(__FILE__ "(" __TBB_STRING(__LINE__) ") : Warning: Recommend using /MDd if compiling with TBB_USE_DEBUG!=0")
|
||||
# endif
|
||||
# else
|
||||
# if defined(_DEBUG)
|
||||
# pragma message(__FILE__ "(" __TBB_STRING(__LINE__) ") : Warning: Recommend using /MD if compiling with TBB_USE_DEBUG==0")
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# ifdef _DEBUG
|
||||
# define TBB_USE_DEBUG 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __TBB_BUILD && !defined(__TBB_NO_IMPLICIT_LINKAGE)
|
||||
#define __TBB_NO_IMPLICIT_LINKAGE 1
|
||||
#endif
|
||||
|
||||
#if _MSC_VER
|
||||
#if !__TBB_NO_IMPLICIT_LINKAGE
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "tbb_debug.lib")
|
||||
#else
|
||||
#pragma comment(lib, "tbb.lib")
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_aligned_space_H
|
||||
#define __TBB_aligned_space_H
|
||||
|
||||
#include "tbb_stddef.h"
|
||||
#include "tbb_machine.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! Block of space aligned sufficiently to construct an array T with N elements.
|
||||
/** The elements are not constructed or destroyed by this class.
|
||||
@ingroup memory_allocation */
|
||||
template<typename T,size_t N>
|
||||
class aligned_space {
|
||||
private:
|
||||
typedef __TBB_TypeWithAlignmentAtLeastAsStrict(T) element_type;
|
||||
element_type array[(sizeof(T)*N+sizeof(element_type)-1)/sizeof(element_type)];
|
||||
public:
|
||||
//! Pointer to beginning of array
|
||||
T* begin() {return reinterpret_cast<T*>(this);}
|
||||
|
||||
//! Pointer to one past last element in array.
|
||||
T* end() {return begin()+N;}
|
||||
};
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_aligned_space_H */
|
||||
|
|
@ -1,397 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_atomic_H
|
||||
#define __TBB_atomic_H
|
||||
|
||||
#include <cstddef>
|
||||
#include "tbb_stddef.h"
|
||||
|
||||
#if _MSC_VER
|
||||
#define __TBB_LONG_LONG __int64
|
||||
#else
|
||||
#define __TBB_LONG_LONG long long
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#include "tbb_machine.h"
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||
// Workaround for overzealous compiler warnings
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4244 4267)
|
||||
#endif
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! Specifies memory fencing.
|
||||
enum memory_semantics {
|
||||
//! For internal use only.
|
||||
__TBB_full_fence,
|
||||
//! Acquire fence
|
||||
acquire,
|
||||
//! Release fence
|
||||
release
|
||||
};
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
#if __GNUC__ || __SUNPRO_CC
|
||||
#define __TBB_DECL_ATOMIC_FIELD(t,f,a) t f __attribute__ ((aligned(a)));
|
||||
#elif defined(__INTEL_COMPILER)||_MSC_VER >= 1300
|
||||
#define __TBB_DECL_ATOMIC_FIELD(t,f,a) __declspec(align(a)) t f;
|
||||
#else
|
||||
#error Do not know syntax for forcing alignment.
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
template<size_t S>
|
||||
struct atomic_rep; // Primary template declared, but never defined.
|
||||
|
||||
template<>
|
||||
struct atomic_rep<1> { // Specialization
|
||||
typedef int8_t word;
|
||||
int8_t value;
|
||||
};
|
||||
template<>
|
||||
struct atomic_rep<2> { // Specialization
|
||||
typedef int16_t word;
|
||||
__TBB_DECL_ATOMIC_FIELD(int16_t,value,2)
|
||||
};
|
||||
template<>
|
||||
struct atomic_rep<4> { // Specialization
|
||||
#if _MSC_VER && __TBB_WORDSIZE==4
|
||||
// Work-around that avoids spurious /Wp64 warnings
|
||||
typedef intptr_t word;
|
||||
#else
|
||||
typedef int32_t word;
|
||||
#endif
|
||||
__TBB_DECL_ATOMIC_FIELD(int32_t,value,4)
|
||||
};
|
||||
template<>
|
||||
struct atomic_rep<8> { // Specialization
|
||||
typedef int64_t word;
|
||||
__TBB_DECL_ATOMIC_FIELD(int64_t,value,8)
|
||||
};
|
||||
|
||||
template<size_t Size, memory_semantics M>
|
||||
struct atomic_traits; // Primary template declared, but not defined.
|
||||
|
||||
#define __TBB_DECL_FENCED_ATOMIC_PRIMITIVES(S,M) \
|
||||
template<> struct atomic_traits<S,M> { \
|
||||
typedef atomic_rep<S>::word word; \
|
||||
inline static word compare_and_swap( volatile void* location, word new_value, word comparand ) {\
|
||||
return __TBB_CompareAndSwap##S##M(location,new_value,comparand); \
|
||||
} \
|
||||
inline static word fetch_and_add( volatile void* location, word addend ) { \
|
||||
return __TBB_FetchAndAdd##S##M(location,addend); \
|
||||
} \
|
||||
inline static word fetch_and_store( volatile void* location, word value ) {\
|
||||
return __TBB_FetchAndStore##S##M(location,value); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define __TBB_DECL_ATOMIC_PRIMITIVES(S) \
|
||||
template<memory_semantics M> \
|
||||
struct atomic_traits<S,M> { \
|
||||
typedef atomic_rep<S>::word word; \
|
||||
inline static word compare_and_swap( volatile void* location, word new_value, word comparand ) {\
|
||||
return __TBB_CompareAndSwap##S(location,new_value,comparand); \
|
||||
} \
|
||||
inline static word fetch_and_add( volatile void* location, word addend ) { \
|
||||
return __TBB_FetchAndAdd##S(location,addend); \
|
||||
} \
|
||||
inline static word fetch_and_store( volatile void* location, word value ) {\
|
||||
return __TBB_FetchAndStore##S(location,value); \
|
||||
} \
|
||||
};
|
||||
|
||||
#if __TBB_DECL_FENCED_ATOMICS
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,__TBB_full_fence)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,__TBB_full_fence)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,__TBB_full_fence)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,__TBB_full_fence)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,acquire)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,acquire)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,acquire)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,acquire)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(1,release)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(2,release)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(4,release)
|
||||
__TBB_DECL_FENCED_ATOMIC_PRIMITIVES(8,release)
|
||||
#else
|
||||
__TBB_DECL_ATOMIC_PRIMITIVES(1)
|
||||
__TBB_DECL_ATOMIC_PRIMITIVES(2)
|
||||
__TBB_DECL_ATOMIC_PRIMITIVES(4)
|
||||
__TBB_DECL_ATOMIC_PRIMITIVES(8)
|
||||
#endif
|
||||
|
||||
//! Additive inverse of 1 for type T.
|
||||
/** Various compilers issue various warnings if -1 is used with various integer types.
|
||||
The baroque expression below avoids all the warnings (we hope). */
|
||||
#define __TBB_MINUS_ONE(T) (T(T(0)-T(1)))
|
||||
|
||||
//! Base class that provides basic functionality for atomic<T> without fetch_and_add.
|
||||
/** Works for any type T that has the same size as an integral type, has a trivial constructor/destructor,
|
||||
and can be copied/compared by memcpy/memcmp. */
|
||||
template<typename T>
|
||||
struct atomic_impl {
|
||||
protected:
|
||||
atomic_rep<sizeof(T)> rep;
|
||||
private:
|
||||
//! Union type used to convert type T to underlying integral type.
|
||||
union converter {
|
||||
T value;
|
||||
typename atomic_rep<sizeof(T)>::word bits;
|
||||
};
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
template<memory_semantics M>
|
||||
value_type fetch_and_store( value_type value ) {
|
||||
converter u, w;
|
||||
u.value = value;
|
||||
w.bits = internal::atomic_traits<sizeof(value_type),M>::fetch_and_store(&rep.value,u.bits);
|
||||
return w.value;
|
||||
}
|
||||
|
||||
value_type fetch_and_store( value_type value ) {
|
||||
return fetch_and_store<__TBB_full_fence>(value);
|
||||
}
|
||||
|
||||
template<memory_semantics M>
|
||||
value_type compare_and_swap( value_type value, value_type comparand ) {
|
||||
converter u, v, w;
|
||||
u.value = value;
|
||||
v.value = comparand;
|
||||
w.bits = internal::atomic_traits<sizeof(value_type),M>::compare_and_swap(&rep.value,u.bits,v.bits);
|
||||
return w.value;
|
||||
}
|
||||
|
||||
value_type compare_and_swap( value_type value, value_type comparand ) {
|
||||
return compare_and_swap<__TBB_full_fence>(value,comparand);
|
||||
}
|
||||
|
||||
operator value_type() const volatile { // volatile qualifier here for backwards compatibility
|
||||
converter w;
|
||||
w.bits = __TBB_load_with_acquire( rep.value );
|
||||
return w.value;
|
||||
}
|
||||
|
||||
protected:
|
||||
value_type store_with_release( value_type rhs ) {
|
||||
converter u;
|
||||
u.value = rhs;
|
||||
__TBB_store_with_release(rep.value,u.bits);
|
||||
return rhs;
|
||||
}
|
||||
};
|
||||
|
||||
//! Base class that provides basic functionality for atomic<T> with fetch_and_add.
|
||||
/** I is the underlying type.
|
||||
D is the difference type.
|
||||
StepType should be char if I is an integral type, and T if I is a T*. */
|
||||
template<typename I, typename D, typename StepType>
|
||||
struct atomic_impl_with_arithmetic: atomic_impl<I> {
|
||||
public:
|
||||
typedef I value_type;
|
||||
|
||||
template<memory_semantics M>
|
||||
value_type fetch_and_add( D addend ) {
|
||||
return value_type(internal::atomic_traits<sizeof(value_type),M>::fetch_and_add( &this->rep.value, addend*sizeof(StepType) ));
|
||||
}
|
||||
|
||||
value_type fetch_and_add( D addend ) {
|
||||
return fetch_and_add<__TBB_full_fence>(addend);
|
||||
}
|
||||
|
||||
template<memory_semantics M>
|
||||
value_type fetch_and_increment() {
|
||||
return fetch_and_add<M>(1);
|
||||
}
|
||||
|
||||
value_type fetch_and_increment() {
|
||||
return fetch_and_add(1);
|
||||
}
|
||||
|
||||
template<memory_semantics M>
|
||||
value_type fetch_and_decrement() {
|
||||
return fetch_and_add<M>(__TBB_MINUS_ONE(D));
|
||||
}
|
||||
|
||||
value_type fetch_and_decrement() {
|
||||
return fetch_and_add(__TBB_MINUS_ONE(D));
|
||||
}
|
||||
|
||||
public:
|
||||
value_type operator+=( D addend ) {
|
||||
return fetch_and_add(addend)+addend;
|
||||
}
|
||||
|
||||
value_type operator-=( D addend ) {
|
||||
// Additive inverse of addend computed using binary minus,
|
||||
// instead of unary minus, for sake of avoiding compiler warnings.
|
||||
return operator+=(D(0)-addend);
|
||||
}
|
||||
|
||||
value_type operator++() {
|
||||
return fetch_and_add(1)+1;
|
||||
}
|
||||
|
||||
value_type operator--() {
|
||||
return fetch_and_add(__TBB_MINUS_ONE(D))-1;
|
||||
}
|
||||
|
||||
value_type operator++(int) {
|
||||
return fetch_and_add(1);
|
||||
}
|
||||
|
||||
value_type operator--(int) {
|
||||
return fetch_and_add(__TBB_MINUS_ONE(D));
|
||||
}
|
||||
};
|
||||
|
||||
#if __TBB_WORDSIZE == 4
|
||||
// Plaforms with 32-bit hardware require special effort for 64-bit loads and stores.
|
||||
#if defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400
|
||||
|
||||
template<>
|
||||
inline atomic_impl<__TBB_LONG_LONG>::operator atomic_impl<__TBB_LONG_LONG>::value_type() const volatile {
|
||||
return __TBB_Load8(&rep.value);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline atomic_impl<unsigned __TBB_LONG_LONG>::operator atomic_impl<unsigned __TBB_LONG_LONG>::value_type() const volatile {
|
||||
return __TBB_Load8(&rep.value);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline atomic_impl<__TBB_LONG_LONG>::value_type atomic_impl<__TBB_LONG_LONG>::store_with_release( value_type rhs ) {
|
||||
__TBB_Store8(&rep.value,rhs);
|
||||
return rhs;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline atomic_impl<unsigned __TBB_LONG_LONG>::value_type atomic_impl<unsigned __TBB_LONG_LONG>::store_with_release( value_type rhs ) {
|
||||
__TBB_Store8(&rep.value,rhs);
|
||||
return rhs;
|
||||
}
|
||||
|
||||
#endif /* defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 */
|
||||
#endif /* __TBB_WORDSIZE==4 */
|
||||
|
||||
} /* Internal */
|
||||
//! @endcond
|
||||
|
||||
//! Primary template for atomic.
|
||||
/** See the Reference for details.
|
||||
@ingroup synchronization */
|
||||
template<typename T>
|
||||
struct atomic: internal::atomic_impl<T> {
|
||||
T operator=( T rhs ) {
|
||||
// "this" required here in strict ISO C++ because store_with_release is a dependent name
|
||||
return this->store_with_release(rhs);
|
||||
}
|
||||
atomic<T>& operator=( const atomic<T>& rhs ) {this->store_with_release(rhs); return *this;}
|
||||
};
|
||||
|
||||
#define __TBB_DECL_ATOMIC(T) \
|
||||
template<> struct atomic<T>: internal::atomic_impl_with_arithmetic<T,T,char> { \
|
||||
T operator=( T rhs ) {return store_with_release(rhs);} \
|
||||
atomic<T>& operator=( const atomic<T>& rhs ) {store_with_release(rhs); return *this;} \
|
||||
};
|
||||
|
||||
#if defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400
|
||||
__TBB_DECL_ATOMIC(__TBB_LONG_LONG)
|
||||
__TBB_DECL_ATOMIC(unsigned __TBB_LONG_LONG)
|
||||
#else
|
||||
// Some old versions of MVSC cannot correctly compile templates with "long long".
|
||||
#endif /* defined(__INTEL_COMPILER)||!defined(_MSC_VER)||_MSC_VER>=1400 */
|
||||
|
||||
__TBB_DECL_ATOMIC(long)
|
||||
__TBB_DECL_ATOMIC(unsigned long)
|
||||
|
||||
#if defined(_MSC_VER) && __TBB_WORDSIZE==4
|
||||
/* Special version of __TBB_DECL_ATOMIC that avoids gratuitous warnings from cl /Wp64 option.
|
||||
It is identical to __TBB_DECL_ATOMIC(unsigned) except that it replaces operator=(T)
|
||||
with an operator=(U) that explicitly converts the U to a T. Types T and U should be
|
||||
type synonyms on the platform. Type U should be the wider variant of T from the
|
||||
perspective of /Wp64. */
|
||||
#define __TBB_DECL_ATOMIC_ALT(T,U) \
|
||||
template<> struct atomic<T>: internal::atomic_impl_with_arithmetic<T,T,char> { \
|
||||
T operator=( U rhs ) {return store_with_release(T(rhs));} \
|
||||
atomic<T>& operator=( const atomic<T>& rhs ) {store_with_release(rhs); return *this;} \
|
||||
};
|
||||
__TBB_DECL_ATOMIC_ALT(unsigned,size_t)
|
||||
__TBB_DECL_ATOMIC_ALT(int,ptrdiff_t)
|
||||
#else
|
||||
__TBB_DECL_ATOMIC(unsigned)
|
||||
__TBB_DECL_ATOMIC(int)
|
||||
#endif /* defined(_MSC_VER) && __TBB_WORDSIZE==4 */
|
||||
|
||||
__TBB_DECL_ATOMIC(unsigned short)
|
||||
__TBB_DECL_ATOMIC(short)
|
||||
__TBB_DECL_ATOMIC(char)
|
||||
__TBB_DECL_ATOMIC(signed char)
|
||||
__TBB_DECL_ATOMIC(unsigned char)
|
||||
|
||||
#if !defined(_MSC_VER)||defined(_NATIVE_WCHAR_T_DEFINED)
|
||||
__TBB_DECL_ATOMIC(wchar_t)
|
||||
#endif /* _MSC_VER||!defined(_NATIVE_WCHAR_T_DEFINED) */
|
||||
|
||||
//! Specialization for atomic<T*> with arithmetic and operator->.
|
||||
template<typename T> struct atomic<T*>: internal::atomic_impl_with_arithmetic<T*,ptrdiff_t,T> {
|
||||
T* operator=( T* rhs ) {
|
||||
// "this" required here in strict ISO C++ because store_with_release is a dependent name
|
||||
return this->store_with_release(rhs);
|
||||
}
|
||||
atomic<T*>& operator=( const atomic<T*>& rhs ) {
|
||||
this->store_with_release(rhs); return *this;
|
||||
}
|
||||
T* operator->() const {
|
||||
return (*this);
|
||||
}
|
||||
};
|
||||
|
||||
//! Specialization for atomic<void*>, for sake of not allowing arithmetic or operator->.
|
||||
template<> struct atomic<void*>: internal::atomic_impl<void*> {
|
||||
void* operator=( void* rhs ) {
|
||||
// "this" required here in strict ISO C++ because store_with_release is a dependent name
|
||||
return this->store_with_release(rhs);
|
||||
}
|
||||
atomic<void*>& operator=( const atomic<void*>& rhs ) {
|
||||
this->store_with_release(rhs); return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||
#pragma warning (pop)
|
||||
#endif // warnings 4244, 4267 are back
|
||||
|
||||
#endif /* __TBB_atomic_H */
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_blocked_range_H
|
||||
#define __TBB_blocked_range_H
|
||||
|
||||
#include "tbb_stddef.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
/** \page range_req Requirements on range concept
|
||||
Class \c R implementing the concept of range must define:
|
||||
- \code R::R( const R& ); \endcode Copy constructor
|
||||
- \code R::~R(); \endcode Destructor
|
||||
- \code bool R::is_divisible() const; \endcode True if range can be partitioned into two subranges
|
||||
- \code bool R::empty() const; \endcode True if range is empty
|
||||
- \code R::R( R& r, split ); \endcode Split range \c r into two subranges.
|
||||
**/
|
||||
|
||||
//! A range over which to iterate.
|
||||
/** @ingroup algorithms */
|
||||
template<typename Value>
|
||||
class blocked_range {
|
||||
public:
|
||||
//! Type of a value
|
||||
/** Called a const_iterator for sake of algorithms that need to treat a blocked_range
|
||||
as an STL container. */
|
||||
typedef Value const_iterator;
|
||||
|
||||
//! Type for size of a range
|
||||
typedef std::size_t size_type;
|
||||
|
||||
//! Construct range with default-constructed values for begin and end.
|
||||
/** Requires that Value have a default constructor. */
|
||||
blocked_range() : my_begin(), my_end() {}
|
||||
|
||||
//! Construct range over half-open interval [begin,end), with the given grainsize.
|
||||
blocked_range( Value begin_, Value end_, size_type grainsize_=1 ) :
|
||||
my_end(end_), my_begin(begin_), my_grainsize(grainsize_)
|
||||
{
|
||||
__TBB_ASSERT( my_grainsize>0, "grainsize must be positive" );
|
||||
}
|
||||
|
||||
//! Beginning of range.
|
||||
const_iterator begin() const {return my_begin;}
|
||||
|
||||
//! One past last value in range.
|
||||
const_iterator end() const {return my_end;}
|
||||
|
||||
//! Size of the range
|
||||
/** Unspecified if end()<begin(). */
|
||||
size_type size() const {
|
||||
__TBB_ASSERT( !(end()<begin()), "size() unspecified if end()<begin()" );
|
||||
return size_type(my_end-my_begin);
|
||||
}
|
||||
|
||||
//! The grain size for this range.
|
||||
size_type grainsize() const {return my_grainsize;}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Methods that implement Range concept
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//! True if range is empty.
|
||||
bool empty() const {return !(my_begin<my_end);}
|
||||
|
||||
//! True if range is divisible.
|
||||
/** Unspecified if end()<begin(). */
|
||||
bool is_divisible() const {return my_grainsize<size();}
|
||||
|
||||
//! Split range.
|
||||
/** The new Range *this has the second half, the old range r has the first half.
|
||||
Unspecified if end()<begin() or !is_divisible(). */
|
||||
blocked_range( blocked_range& r, split ) :
|
||||
my_end(r.my_end),
|
||||
my_begin(do_split(r)),
|
||||
my_grainsize(r.my_grainsize)
|
||||
{}
|
||||
|
||||
private:
|
||||
/** NOTE: my_end MUST be declared before my_begin, otherwise the forking constructor will break. */
|
||||
Value my_end;
|
||||
Value my_begin;
|
||||
size_type my_grainsize;
|
||||
|
||||
//! Auxilary function used by forking constructor.
|
||||
/** Using this function lets us not require that Value support assignment or default construction. */
|
||||
static Value do_split( blocked_range& r ) {
|
||||
__TBB_ASSERT( r.is_divisible(), "cannot split blocked_range that is not divisible" );
|
||||
Value middle = r.my_begin + (r.my_end-r.my_begin)/2u;
|
||||
r.my_end = middle;
|
||||
return middle;
|
||||
}
|
||||
|
||||
template<typename RowValue, typename ColValue>
|
||||
friend class blocked_range2d;
|
||||
|
||||
template<typename RowValue, typename ColValue, typename PageValue>
|
||||
friend class blocked_range3d;
|
||||
};
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_blocked_range_H */
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_blocked_range2d_H
|
||||
#define __TBB_blocked_range2d_H
|
||||
|
||||
#include "tbb_stddef.h"
|
||||
#include "blocked_range.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! A 2-dimensional range that models the Range concept.
|
||||
/** @ingroup algorithms */
|
||||
template<typename RowValue, typename ColValue=RowValue>
|
||||
class blocked_range2d {
|
||||
public:
|
||||
//! Type for size of an iteation range
|
||||
typedef blocked_range<RowValue> row_range_type;
|
||||
typedef blocked_range<ColValue> col_range_type;
|
||||
|
||||
private:
|
||||
row_range_type my_rows;
|
||||
col_range_type my_cols;
|
||||
|
||||
public:
|
||||
|
||||
blocked_range2d( RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize,
|
||||
ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize ) :
|
||||
my_rows(row_begin,row_end,row_grainsize),
|
||||
my_cols(col_begin,col_end,col_grainsize)
|
||||
{
|
||||
}
|
||||
|
||||
blocked_range2d( RowValue row_begin, RowValue row_end,
|
||||
ColValue col_begin, ColValue col_end ) :
|
||||
my_rows(row_begin,row_end),
|
||||
my_cols(col_begin,col_end)
|
||||
{
|
||||
}
|
||||
|
||||
//! True if range is empty
|
||||
bool empty() const {
|
||||
// Yes, it is a logical OR here, not AND.
|
||||
return my_rows.empty() || my_cols.empty();
|
||||
}
|
||||
|
||||
//! True if range is divisible into two pieces.
|
||||
bool is_divisible() const {
|
||||
return my_rows.is_divisible() || my_cols.is_divisible();
|
||||
}
|
||||
|
||||
blocked_range2d( blocked_range2d& r, split ) :
|
||||
my_rows(r.my_rows),
|
||||
my_cols(r.my_cols)
|
||||
{
|
||||
if( my_rows.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_rows.grainsize()) ) {
|
||||
my_cols.my_begin = col_range_type::do_split(r.my_cols);
|
||||
} else {
|
||||
my_rows.my_begin = row_range_type::do_split(r.my_rows);
|
||||
}
|
||||
}
|
||||
|
||||
//! The rows of the iteration space
|
||||
const row_range_type& rows() const {return my_rows;}
|
||||
|
||||
//! The columns of the iteration space
|
||||
const col_range_type& cols() const {return my_cols;}
|
||||
};
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_blocked_range2d_H */
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_blocked_range3d_H
|
||||
#define __TBB_blocked_range3d_H
|
||||
|
||||
#include "tbb_stddef.h"
|
||||
#include "blocked_range.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! A 3-dimensional range that models the Range concept.
|
||||
/** @ingroup algorithms */
|
||||
template<typename PageValue, typename RowValue=PageValue, typename ColValue=RowValue>
|
||||
class blocked_range3d {
|
||||
public:
|
||||
//! Type for size of an iteation range
|
||||
typedef blocked_range<PageValue> page_range_type;
|
||||
typedef blocked_range<RowValue> row_range_type;
|
||||
typedef blocked_range<ColValue> col_range_type;
|
||||
|
||||
private:
|
||||
page_range_type my_pages;
|
||||
row_range_type my_rows;
|
||||
col_range_type my_cols;
|
||||
|
||||
public:
|
||||
|
||||
blocked_range3d( PageValue page_begin, PageValue page_end,
|
||||
RowValue row_begin, RowValue row_end,
|
||||
ColValue col_begin, ColValue col_end ) :
|
||||
my_pages(page_begin,page_end),
|
||||
my_rows(row_begin,row_end),
|
||||
my_cols(col_begin,col_end)
|
||||
{
|
||||
}
|
||||
|
||||
blocked_range3d( PageValue page_begin, PageValue page_end, typename page_range_type::size_type page_grainsize,
|
||||
RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize,
|
||||
ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize ) :
|
||||
my_pages(page_begin,page_end,page_grainsize),
|
||||
my_rows(row_begin,row_end,row_grainsize),
|
||||
my_cols(col_begin,col_end,col_grainsize)
|
||||
{
|
||||
}
|
||||
|
||||
//! True if range is empty
|
||||
bool empty() const {
|
||||
// Yes, it is a logical OR here, not AND.
|
||||
return my_pages.empty() || my_rows.empty() || my_cols.empty();
|
||||
}
|
||||
|
||||
//! True if range is divisible into two pieces.
|
||||
bool is_divisible() const {
|
||||
return my_pages.is_divisible() || my_rows.is_divisible() || my_cols.is_divisible();
|
||||
}
|
||||
|
||||
blocked_range3d( blocked_range3d& r, split ) :
|
||||
my_pages(r.my_pages),
|
||||
my_rows(r.my_rows),
|
||||
my_cols(r.my_cols)
|
||||
{
|
||||
if( my_pages.size()*double(my_rows.grainsize()) < my_rows.size()*double(my_pages.grainsize()) ) {
|
||||
if ( my_rows.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_rows.grainsize()) ) {
|
||||
my_cols.my_begin = col_range_type::do_split(r.my_cols);
|
||||
} else {
|
||||
my_rows.my_begin = row_range_type::do_split(r.my_rows);
|
||||
}
|
||||
} else {
|
||||
if ( my_pages.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_pages.grainsize()) ) {
|
||||
my_cols.my_begin = col_range_type::do_split(r.my_cols);
|
||||
} else {
|
||||
my_pages.my_begin = page_range_type::do_split(r.my_pages);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! The pages of the iteration space
|
||||
const page_range_type& pages() const {return my_pages;}
|
||||
|
||||
//! The rows of the iteration space
|
||||
const row_range_type& rows() const {return my_rows;}
|
||||
|
||||
//! The columns of the iteration space
|
||||
const col_range_type& cols() const {return my_cols;}
|
||||
|
||||
};
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_blocked_range3d_H */
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_cache_aligned_allocator_H
|
||||
#define __TBB_cache_aligned_allocator_H
|
||||
|
||||
#include <new>
|
||||
#include "tbb_stddef.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
//! Cache/sector line size.
|
||||
/** @ingroup memory_allocation */
|
||||
size_t __TBB_EXPORTED_FUNC NFS_GetLineSize();
|
||||
|
||||
//! Allocate memory on cache/sector line boundary.
|
||||
/** @ingroup memory_allocation */
|
||||
void* __TBB_EXPORTED_FUNC NFS_Allocate( size_t n_element, size_t element_size, void* hint );
|
||||
|
||||
//! Free memory allocated by NFS_Allocate.
|
||||
/** Freeing a NULL pointer is allowed, but has no effect.
|
||||
@ingroup memory_allocation */
|
||||
void __TBB_EXPORTED_FUNC NFS_Free( void* );
|
||||
}
|
||||
//! @endcond
|
||||
|
||||
#if _MSC_VER && !defined(__INTEL_COMPILER)
|
||||
// Workaround for erroneous "unreferenced parameter" warning in method destroy.
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4100)
|
||||
#endif
|
||||
|
||||
//! Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5
|
||||
/** The members are ordered the same way they are in section 20.4.1
|
||||
of the ISO C++ standard.
|
||||
@ingroup memory_allocation */
|
||||
template<typename T>
|
||||
class cache_aligned_allocator {
|
||||
public:
|
||||
typedef typename internal::allocator_type<T>::value_type value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
template<typename U> struct rebind {
|
||||
typedef cache_aligned_allocator<U> other;
|
||||
};
|
||||
|
||||
cache_aligned_allocator() throw() {}
|
||||
cache_aligned_allocator( const cache_aligned_allocator& ) throw() {}
|
||||
template<typename U> cache_aligned_allocator(const cache_aligned_allocator<U>&) throw() {}
|
||||
|
||||
pointer address(reference x) const {return &x;}
|
||||
const_pointer address(const_reference x) const {return &x;}
|
||||
|
||||
//! Allocate space for n objects, starting on a cache/sector line.
|
||||
pointer allocate( size_type n, const void* hint=0 ) {
|
||||
// The "hint" argument is always ignored in NFS_Allocate thus const_cast shouldn't hurt
|
||||
return pointer(internal::NFS_Allocate( n, sizeof(value_type), const_cast<void*>(hint) ));
|
||||
}
|
||||
|
||||
//! Free block of memory that starts on a cache line
|
||||
void deallocate( pointer p, size_type ) {
|
||||
internal::NFS_Free(p);
|
||||
}
|
||||
|
||||
//! Largest value for which method allocate might succeed.
|
||||
size_type max_size() const throw() {
|
||||
return (~size_t(0)-internal::NFS_MaxLineSize)/sizeof(value_type);
|
||||
}
|
||||
|
||||
//! Copy-construct value at location pointed to by p.
|
||||
void construct( pointer p, const value_type& value ) {new(static_cast<void*>(p)) value_type(value);}
|
||||
|
||||
//! Destroy value at location pointed to by p.
|
||||
void destroy( pointer p ) {p->~value_type();}
|
||||
};
|
||||
|
||||
#if _MSC_VER && !defined(__INTEL_COMPILER)
|
||||
#pragma warning (pop)
|
||||
#endif // warning 4100 is back
|
||||
|
||||
//! Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1
|
||||
/** @ingroup memory_allocation */
|
||||
template<>
|
||||
class cache_aligned_allocator<void> {
|
||||
public:
|
||||
typedef void* pointer;
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
template<typename U> struct rebind {
|
||||
typedef cache_aligned_allocator<U> other;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
inline bool operator==( const cache_aligned_allocator<T>&, const cache_aligned_allocator<U>& ) {return true;}
|
||||
|
||||
template<typename T, typename U>
|
||||
inline bool operator!=( const cache_aligned_allocator<T>&, const cache_aligned_allocator<U>& ) {return false;}
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_cache_aligned_allocator_H */
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_combinable_H
|
||||
#define __TBB_combinable_H
|
||||
|
||||
#include "tbb/enumerable_thread_specific.h"
|
||||
#include "tbb/cache_aligned_allocator.h"
|
||||
|
||||
namespace tbb {
|
||||
/** \name combinable
|
||||
**/
|
||||
//@{
|
||||
//! Thread-local storage with optional reduction
|
||||
/** @ingroup containers */
|
||||
template <typename T>
|
||||
class combinable {
|
||||
private:
|
||||
typedef typename tbb::cache_aligned_allocator<T> my_alloc;
|
||||
|
||||
typedef typename tbb::enumerable_thread_specific<T, my_alloc, ets_no_key> my_ets_type;
|
||||
my_ets_type my_ets;
|
||||
|
||||
public:
|
||||
|
||||
combinable() { }
|
||||
|
||||
template <typename finit>
|
||||
combinable( finit _finit) : my_ets(_finit) { }
|
||||
|
||||
//! destructor
|
||||
~combinable() {
|
||||
}
|
||||
|
||||
combinable(const combinable& other) : my_ets(other.my_ets) { }
|
||||
|
||||
combinable & operator=( const combinable & other) { my_ets = other.my_ets; return *this; }
|
||||
|
||||
void clear() { my_ets.clear(); }
|
||||
|
||||
T& local() { return my_ets.local(); }
|
||||
|
||||
T& local(bool & exists) { return my_ets.local(exists); }
|
||||
|
||||
template< typename FCombine>
|
||||
T combine(FCombine fcombine) { return my_ets.combine(fcombine); }
|
||||
|
||||
template<typename FCombine>
|
||||
void combine_each(FCombine fcombine) { my_ets.combine_each(fcombine); }
|
||||
|
||||
};
|
||||
} // namespace tbb
|
||||
#endif /* __TBB_combinable_H */
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_compat_ppl_H
|
||||
#define __TBB_compat_ppl_H
|
||||
|
||||
#include "../task_group.h"
|
||||
#include "../parallel_invoke.h"
|
||||
#include "../parallel_for_each.h"
|
||||
#include "../parallel_for.h"
|
||||
|
||||
namespace Concurrency {
|
||||
|
||||
using tbb::task_handle;
|
||||
using tbb::task_group_status;
|
||||
using tbb::task_group;
|
||||
using tbb::structured_task_group;
|
||||
using tbb::missing_wait;
|
||||
using tbb::make_task;
|
||||
|
||||
using tbb::not_complete;
|
||||
using tbb::complete;
|
||||
using tbb::canceled;
|
||||
|
||||
using tbb::is_current_task_group_canceling;
|
||||
|
||||
using tbb::parallel_invoke;
|
||||
using tbb::strict_ppl::parallel_for;
|
||||
using tbb::parallel_for_each;
|
||||
|
||||
} // namespace Concurrency
|
||||
|
||||
#endif /* __TBB_compat_ppl_H */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,409 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_concurrent_queue_H
|
||||
#define __TBB_concurrent_queue_H
|
||||
|
||||
#include "_concurrent_queue_internal.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
namespace strict_ppl {
|
||||
|
||||
//! A high-performance thread-safe non-blocking concurrent queue.
|
||||
/** Multiple threads may each push and pop concurrently.
|
||||
Assignment construction is not allowed.
|
||||
@ingroup containers */
|
||||
template<typename T, typename A = cache_aligned_allocator<T> >
|
||||
class concurrent_queue: public internal::concurrent_queue_base_v3<T> {
|
||||
template<typename Container, typename Value> friend class internal::concurrent_queue_iterator;
|
||||
|
||||
//! Allocator type
|
||||
typedef typename A::template rebind<char>::other page_allocator_type;
|
||||
page_allocator_type my_allocator;
|
||||
|
||||
//! Allocates a block of size n (bytes)
|
||||
/*overide*/ virtual void *allocate_block( size_t n ) {
|
||||
void *b = reinterpret_cast<void*>(my_allocator.allocate( n ));
|
||||
if( !b ) this->internal_throw_exception();
|
||||
return b;
|
||||
}
|
||||
|
||||
//! Returns a block of size n (bytes)
|
||||
/*override*/ virtual void deallocate_block( void *b, size_t n ) {
|
||||
my_allocator.deallocate( reinterpret_cast<char*>(b), n );
|
||||
}
|
||||
|
||||
public:
|
||||
//! Element type in the queue.
|
||||
typedef T value_type;
|
||||
|
||||
//! Reference type
|
||||
typedef T& reference;
|
||||
|
||||
//! Const reference type
|
||||
typedef const T& const_reference;
|
||||
|
||||
//! Integral type for representing size of the queue.
|
||||
typedef size_t size_type;
|
||||
|
||||
//! Difference type for iterator
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
//! Allocator type
|
||||
typedef A allocator_type;
|
||||
|
||||
//! Construct empty queue
|
||||
explicit concurrent_queue(const allocator_type& a = allocator_type()) :
|
||||
internal::concurrent_queue_base_v3<T>( sizeof(T) ), my_allocator( a )
|
||||
{
|
||||
}
|
||||
|
||||
//! [begin,end) constructor
|
||||
template<typename InputIterator>
|
||||
concurrent_queue( InputIterator begin, InputIterator end, const allocator_type& a = allocator_type()) :
|
||||
internal::concurrent_queue_base_v3<T>( sizeof(T) ), my_allocator( a )
|
||||
{
|
||||
for( ; begin != end; ++begin )
|
||||
internal_push(&*begin);
|
||||
}
|
||||
|
||||
//! Copy constructor
|
||||
concurrent_queue( const concurrent_queue& src, const allocator_type& a = allocator_type()) :
|
||||
internal::concurrent_queue_base_v3<T>( sizeof(T) ), my_allocator( a )
|
||||
{
|
||||
assign( src );
|
||||
}
|
||||
|
||||
//! Destroy queue
|
||||
~concurrent_queue();
|
||||
|
||||
//! Enqueue an item at tail of queue.
|
||||
void push( const T& source ) {
|
||||
internal_push( &source );
|
||||
}
|
||||
|
||||
//! Attempt to dequeue an item from head of queue.
|
||||
/** Does not wait for item to become available.
|
||||
Returns true if successful; false otherwise. */
|
||||
bool try_pop( T& result ) {
|
||||
return internal_try_pop( &result );
|
||||
}
|
||||
|
||||
//! Return the number of items in the queue; thread unsafe
|
||||
size_type unsafe_size() const {return this->internal_size();}
|
||||
|
||||
//! Equivalent to size()==0.
|
||||
bool empty() const {return this->internal_empty();}
|
||||
|
||||
//! Clear the queue. not thread-safe.
|
||||
void clear() ;
|
||||
|
||||
//! Return allocator object
|
||||
allocator_type get_allocator() const { return this->my_allocator; }
|
||||
|
||||
typedef internal::concurrent_queue_iterator<concurrent_queue,T> iterator;
|
||||
typedef internal::concurrent_queue_iterator<concurrent_queue,const T> const_iterator;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// The iterators are intended only for debugging. They are slow and not thread safe.
|
||||
//------------------------------------------------------------------------
|
||||
iterator unsafe_begin() {return iterator(*this);}
|
||||
iterator unsafe_end() {return iterator();}
|
||||
const_iterator unsafe_begin() const {return const_iterator(*this);}
|
||||
const_iterator unsafe_end() const {return const_iterator();}
|
||||
} ;
|
||||
|
||||
template<typename T, class A>
|
||||
concurrent_queue<T,A>::~concurrent_queue() {
|
||||
clear();
|
||||
this->internal_finish_clear();
|
||||
}
|
||||
|
||||
template<typename T, class A>
|
||||
void concurrent_queue<T,A>::clear() {
|
||||
while( !empty() ) {
|
||||
T value;
|
||||
internal_try_pop(&value);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace strict_ppl
|
||||
|
||||
//! A high-performance thread-safe blocking concurrent bounded queue.
|
||||
/** This is the pre-PPL TBB concurrent queue which supports boundedness and blocking semantics.
|
||||
Note that method names agree with the PPL-style concurrent queue.
|
||||
Multiple threads may each push and pop concurrently.
|
||||
Assignment construction is not allowed.
|
||||
@ingroup containers */
|
||||
template<typename T, class A = cache_aligned_allocator<T> >
|
||||
class concurrent_bounded_queue: public internal::concurrent_queue_base_v3 {
|
||||
template<typename Container, typename Value> friend class internal::concurrent_queue_iterator;
|
||||
|
||||
//! Allocator type
|
||||
typedef typename A::template rebind<char>::other page_allocator_type;
|
||||
page_allocator_type my_allocator;
|
||||
|
||||
//! Class used to ensure exception-safety of method "pop"
|
||||
class destroyer: internal::no_copy {
|
||||
T& my_value;
|
||||
public:
|
||||
destroyer( T& value ) : my_value(value) {}
|
||||
~destroyer() {my_value.~T();}
|
||||
};
|
||||
|
||||
T& get_ref( page& page, size_t index ) {
|
||||
__TBB_ASSERT( index<items_per_page, NULL );
|
||||
return static_cast<T*>(static_cast<void*>(&page+1))[index];
|
||||
}
|
||||
|
||||
/*override*/ virtual void copy_item( page& dst, size_t index, const void* src ) {
|
||||
new( &get_ref(dst,index) ) T(*static_cast<const T*>(src));
|
||||
}
|
||||
|
||||
/*override*/ virtual void copy_page_item( page& dst, size_t dindex, const page& src, size_t sindex ) {
|
||||
new( &get_ref(dst,dindex) ) T( static_cast<const T*>(static_cast<const void*>(&src+1))[sindex] );
|
||||
}
|
||||
|
||||
/*override*/ virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) {
|
||||
T& from = get_ref(src,index);
|
||||
destroyer d(from);
|
||||
*static_cast<T*>(dst) = from;
|
||||
}
|
||||
|
||||
/*overide*/ virtual page *allocate_page() {
|
||||
size_t n = sizeof(page) + items_per_page*item_size;
|
||||
page *p = reinterpret_cast<page*>(my_allocator.allocate( n ));
|
||||
if( !p ) internal_throw_exception();
|
||||
return p;
|
||||
}
|
||||
|
||||
/*override*/ virtual void deallocate_page( page *p ) {
|
||||
size_t n = sizeof(page) + items_per_page*item_size;
|
||||
my_allocator.deallocate( reinterpret_cast<char*>(p), n );
|
||||
}
|
||||
|
||||
public:
|
||||
//! Element type in the queue.
|
||||
typedef T value_type;
|
||||
|
||||
//! Allocator type
|
||||
typedef A allocator_type;
|
||||
|
||||
//! Reference type
|
||||
typedef T& reference;
|
||||
|
||||
//! Const reference type
|
||||
typedef const T& const_reference;
|
||||
|
||||
//! Integral type for representing size of the queue.
|
||||
/** Notice that the size_type is a signed integral type.
|
||||
This is because the size can be negative if there are pending pops without corresponding pushes. */
|
||||
typedef std::ptrdiff_t size_type;
|
||||
|
||||
//! Difference type for iterator
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
//! Construct empty queue
|
||||
explicit concurrent_bounded_queue(const allocator_type& a = allocator_type()) :
|
||||
concurrent_queue_base_v3( sizeof(T) ), my_allocator( a )
|
||||
{
|
||||
}
|
||||
|
||||
//! Copy constructor
|
||||
concurrent_bounded_queue( const concurrent_bounded_queue& src, const allocator_type& a = allocator_type()) :
|
||||
concurrent_queue_base_v3( sizeof(T) ), my_allocator( a )
|
||||
{
|
||||
assign( src );
|
||||
}
|
||||
|
||||
//! [begin,end) constructor
|
||||
template<typename InputIterator>
|
||||
concurrent_bounded_queue( InputIterator begin, InputIterator end, const allocator_type& a = allocator_type()) :
|
||||
concurrent_queue_base_v3( sizeof(T) ), my_allocator( a )
|
||||
{
|
||||
for( ; begin != end; ++begin )
|
||||
internal_push_if_not_full(&*begin);
|
||||
}
|
||||
|
||||
//! Destroy queue
|
||||
~concurrent_bounded_queue();
|
||||
|
||||
//! Enqueue an item at tail of queue.
|
||||
void push( const T& source ) {
|
||||
internal_push( &source );
|
||||
}
|
||||
|
||||
//! Dequeue item from head of queue.
|
||||
/** Block until an item becomes available, and then dequeue it. */
|
||||
void pop( T& destination ) {
|
||||
internal_pop( &destination );
|
||||
}
|
||||
|
||||
//! Enqueue an item at tail of queue if queue is not already full.
|
||||
/** Does not wait for queue to become not full.
|
||||
Returns true if item is pushed; false if queue was already full. */
|
||||
bool try_push( const T& source ) {
|
||||
return internal_push_if_not_full( &source );
|
||||
}
|
||||
|
||||
//! Attempt to dequeue an item from head of queue.
|
||||
/** Does not wait for item to become available.
|
||||
Returns true if successful; false otherwise. */
|
||||
bool try_pop( T& destination ) {
|
||||
return internal_pop_if_present( &destination );
|
||||
}
|
||||
|
||||
//! Return number of pushes minus number of pops.
|
||||
/** Note that the result can be negative if there are pops waiting for the
|
||||
corresponding pushes. The result can also exceed capacity() if there
|
||||
are push operations in flight. */
|
||||
size_type size() const {return internal_size();}
|
||||
|
||||
//! Equivalent to size()<=0.
|
||||
bool empty() const {return internal_empty();}
|
||||
|
||||
//! Maximum number of allowed elements
|
||||
size_type capacity() const {
|
||||
return my_capacity;
|
||||
}
|
||||
|
||||
//! Set the capacity
|
||||
/** Setting the capacity to 0 causes subsequent try_push operations to always fail,
|
||||
and subsequent push operations to block forever. */
|
||||
void set_capacity( size_type capacity ) {
|
||||
internal_set_capacity( capacity, sizeof(T) );
|
||||
}
|
||||
|
||||
//! return allocator object
|
||||
allocator_type get_allocator() const { return this->my_allocator; }
|
||||
|
||||
//! clear the queue. not thread-safe.
|
||||
void clear() ;
|
||||
|
||||
typedef internal::concurrent_queue_iterator<concurrent_bounded_queue,T> iterator;
|
||||
typedef internal::concurrent_queue_iterator<concurrent_bounded_queue,const T> const_iterator;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// The iterators are intended only for debugging. They are slow and not thread safe.
|
||||
//------------------------------------------------------------------------
|
||||
iterator unsafe_begin() {return iterator(*this);}
|
||||
iterator unsafe_end() {return iterator();}
|
||||
const_iterator unsafe_begin() const {return const_iterator(*this);}
|
||||
const_iterator unsafe_end() const {return const_iterator();}
|
||||
|
||||
};
|
||||
|
||||
template<typename T, class A>
|
||||
concurrent_bounded_queue<T,A>::~concurrent_bounded_queue() {
|
||||
clear();
|
||||
internal_finish_clear();
|
||||
}
|
||||
|
||||
template<typename T, class A>
|
||||
void concurrent_bounded_queue<T,A>::clear() {
|
||||
while( !empty() ) {
|
||||
T value;
|
||||
internal_pop_if_present(&value);
|
||||
}
|
||||
}
|
||||
|
||||
namespace deprecated {
|
||||
|
||||
//! A high-performance thread-safe blocking concurrent bounded queue.
|
||||
/** This is the pre-PPL TBB concurrent queue which support boundedness and blocking semantics.
|
||||
Note that method names agree with the PPL-style concurrent queue.
|
||||
Multiple threads may each push and pop concurrently.
|
||||
Assignment construction is not allowed.
|
||||
@ingroup containers */
|
||||
template<typename T, class A = cache_aligned_allocator<T> >
|
||||
class concurrent_queue: public concurrent_bounded_queue<T,A> {
|
||||
#if !__TBB_TEMPLATE_FRIENDS_BROKEN
|
||||
template<typename Container, typename Value> friend class internal::concurrent_queue_iterator;
|
||||
#endif
|
||||
|
||||
public:
|
||||
//! Construct empty queue
|
||||
explicit concurrent_queue(const A& a = A()) :
|
||||
concurrent_bounded_queue<T,A>( a )
|
||||
{
|
||||
}
|
||||
|
||||
//! Copy constructor
|
||||
concurrent_queue( const concurrent_queue& src, const A& a = A()) :
|
||||
concurrent_bounded_queue<T,A>( src, a )
|
||||
{
|
||||
}
|
||||
|
||||
//! [begin,end) constructor
|
||||
template<typename InputIterator>
|
||||
concurrent_queue( InputIterator begin, InputIterator end, const A& a = A()) :
|
||||
concurrent_bounded_queue<T,A>( begin, end, a )
|
||||
{
|
||||
}
|
||||
|
||||
//! Enqueue an item at tail of queue if queue is not already full.
|
||||
/** Does not wait for queue to become not full.
|
||||
Returns true if item is pushed; false if queue was already full. */
|
||||
bool push_if_not_full( const T& source ) {
|
||||
return try_push( source );
|
||||
}
|
||||
|
||||
//! Attempt to dequeue an item from head of queue.
|
||||
/** Does not wait for item to become available.
|
||||
Returns true if successful; false otherwise.
|
||||
@deprecated Use try_pop()
|
||||
*/
|
||||
bool pop_if_present( T& destination ) {
|
||||
return try_pop( destination );
|
||||
}
|
||||
|
||||
typedef typename concurrent_bounded_queue<T,A>::iterator iterator;
|
||||
typedef typename concurrent_bounded_queue<T,A>::const_iterator const_iterator;
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
// The iterators are intended only for debugging. They are slow and not thread safe.
|
||||
//------------------------------------------------------------------------
|
||||
iterator begin() {return this->unsafe_begin();}
|
||||
iterator end() {return this->unsafe_end();}
|
||||
const_iterator begin() const {return this->unsafe_begin();}
|
||||
const_iterator end() const {return this->unsafe_end();}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if TBB_DEPRECATED
|
||||
using deprecated::concurrent_queue;
|
||||
#else
|
||||
using strict_ppl::concurrent_queue;
|
||||
#endif
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_concurrent_queue_H */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,880 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_enumerable_thread_specific_H
|
||||
#define __TBB_enumerable_thread_specific_H
|
||||
|
||||
#include "concurrent_vector.h"
|
||||
#include "tbb_thread.h"
|
||||
#include "concurrent_hash_map.h"
|
||||
#include "cache_aligned_allocator.h"
|
||||
#if __SUNPRO_CC
|
||||
#include <string.h> // for memcpy
|
||||
#endif
|
||||
|
||||
#if _WIN32||_WIN64
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! enum for selecting between single key and key-per-instance versions
|
||||
enum ets_key_usage_type { ets_key_per_instance, ets_no_key };
|
||||
|
||||
//! @cond
|
||||
namespace internal {
|
||||
|
||||
//! Random access iterator for traversing the thread local copies.
|
||||
template< typename Container, typename Value >
|
||||
class enumerable_thread_specific_iterator
|
||||
#if defined(_WIN64) && defined(_MSC_VER)
|
||||
// Ensure that Microsoft's internal template function _Val_type works correctly.
|
||||
: public std::iterator<std::random_access_iterator_tag,Value>
|
||||
#endif /* defined(_WIN64) && defined(_MSC_VER) */
|
||||
{
|
||||
//! current position in the concurrent_vector
|
||||
|
||||
Container *my_container;
|
||||
typename Container::size_type my_index;
|
||||
mutable Value *my_value;
|
||||
|
||||
template<typename C, typename T>
|
||||
friend enumerable_thread_specific_iterator<C,T> operator+( ptrdiff_t offset,
|
||||
const enumerable_thread_specific_iterator<C,T>& v );
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
friend bool operator==( const enumerable_thread_specific_iterator<C,T>& i,
|
||||
const enumerable_thread_specific_iterator<C,U>& j );
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
friend bool operator<( const enumerable_thread_specific_iterator<C,T>& i,
|
||||
const enumerable_thread_specific_iterator<C,U>& j );
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
friend ptrdiff_t operator-( const enumerable_thread_specific_iterator<C,T>& i, const enumerable_thread_specific_iterator<C,U>& j );
|
||||
|
||||
template<typename C, typename U>
|
||||
friend class enumerable_thread_specific_iterator;
|
||||
|
||||
public:
|
||||
|
||||
enumerable_thread_specific_iterator( const Container &container, typename Container::size_type index ) :
|
||||
my_container(&const_cast<Container &>(container)), my_index(index), my_value(NULL) {}
|
||||
|
||||
//! Default constructor
|
||||
enumerable_thread_specific_iterator() : my_container(NULL), my_index(0), my_value(NULL) {}
|
||||
|
||||
template<typename U>
|
||||
enumerable_thread_specific_iterator( const enumerable_thread_specific_iterator<Container, U>& other ) :
|
||||
my_container( other.my_container ), my_index( other.my_index), my_value( const_cast<Value *>(other.my_value) ) {}
|
||||
|
||||
enumerable_thread_specific_iterator operator+( ptrdiff_t offset ) const {
|
||||
return enumerable_thread_specific_iterator(*my_container, my_index + offset);
|
||||
}
|
||||
|
||||
enumerable_thread_specific_iterator &operator+=( ptrdiff_t offset ) {
|
||||
my_index += offset;
|
||||
my_value = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
enumerable_thread_specific_iterator operator-( ptrdiff_t offset ) const {
|
||||
return enumerable_thread_specific_iterator( *my_container, my_index-offset );
|
||||
}
|
||||
|
||||
enumerable_thread_specific_iterator &operator-=( ptrdiff_t offset ) {
|
||||
my_index -= offset;
|
||||
my_value = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Value& operator*() const {
|
||||
Value* value = my_value;
|
||||
if( !value ) {
|
||||
value = my_value = &(*my_container)[my_index].value;
|
||||
}
|
||||
__TBB_ASSERT( value==&(*my_container)[my_index].value, "corrupt cache" );
|
||||
return *value;
|
||||
}
|
||||
|
||||
Value& operator[]( ptrdiff_t k ) const {
|
||||
return (*my_container)[my_index + k].value;
|
||||
}
|
||||
|
||||
Value* operator->() const {return &operator*();}
|
||||
|
||||
enumerable_thread_specific_iterator& operator++() {
|
||||
++my_index;
|
||||
my_value = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
enumerable_thread_specific_iterator& operator--() {
|
||||
--my_index;
|
||||
my_value = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Post increment
|
||||
enumerable_thread_specific_iterator operator++(int) {
|
||||
enumerable_thread_specific_iterator result = *this;
|
||||
++my_index;
|
||||
my_value = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
//! Post decrement
|
||||
enumerable_thread_specific_iterator operator--(int) {
|
||||
enumerable_thread_specific_iterator result = *this;
|
||||
--my_index;
|
||||
my_value = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
// STL support
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef Value value_type;
|
||||
typedef Value* pointer;
|
||||
typedef Value& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<typename Container, typename T>
|
||||
enumerable_thread_specific_iterator<Container,T> operator+( ptrdiff_t offset,
|
||||
const enumerable_thread_specific_iterator<Container,T>& v ) {
|
||||
return enumerable_thread_specific_iterator<Container,T>( v.my_container, v.my_index + offset );
|
||||
}
|
||||
|
||||
template<typename Container, typename T, typename U>
|
||||
bool operator==( const enumerable_thread_specific_iterator<Container,T>& i,
|
||||
const enumerable_thread_specific_iterator<Container,U>& j ) {
|
||||
return i.my_index==j.my_index && i.my_container == j.my_container;
|
||||
}
|
||||
|
||||
template<typename Container, typename T, typename U>
|
||||
bool operator!=( const enumerable_thread_specific_iterator<Container,T>& i,
|
||||
const enumerable_thread_specific_iterator<Container,U>& j ) {
|
||||
return !(i==j);
|
||||
}
|
||||
|
||||
template<typename Container, typename T, typename U>
|
||||
bool operator<( const enumerable_thread_specific_iterator<Container,T>& i,
|
||||
const enumerable_thread_specific_iterator<Container,U>& j ) {
|
||||
return i.my_index<j.my_index;
|
||||
}
|
||||
|
||||
template<typename Container, typename T, typename U>
|
||||
bool operator>( const enumerable_thread_specific_iterator<Container,T>& i,
|
||||
const enumerable_thread_specific_iterator<Container,U>& j ) {
|
||||
return j<i;
|
||||
}
|
||||
|
||||
template<typename Container, typename T, typename U>
|
||||
bool operator>=( const enumerable_thread_specific_iterator<Container,T>& i,
|
||||
const enumerable_thread_specific_iterator<Container,U>& j ) {
|
||||
return !(i<j);
|
||||
}
|
||||
|
||||
template<typename Container, typename T, typename U>
|
||||
bool operator<=( const enumerable_thread_specific_iterator<Container,T>& i,
|
||||
const enumerable_thread_specific_iterator<Container,U>& j ) {
|
||||
return !(j<i);
|
||||
}
|
||||
|
||||
template<typename Container, typename T, typename U>
|
||||
ptrdiff_t operator-( const enumerable_thread_specific_iterator<Container,T>& i,
|
||||
const enumerable_thread_specific_iterator<Container,U>& j ) {
|
||||
return i.my_index-j.my_index;
|
||||
}
|
||||
|
||||
template<typename SegmentedContainer, typename Value >
|
||||
class segmented_iterator
|
||||
#if defined(_WIN64) && defined(_MSC_VER)
|
||||
: public std::iterator<std::input_iterator_tag, Value>
|
||||
#endif
|
||||
{
|
||||
template<typename C, typename T, typename U>
|
||||
friend bool operator==(const segmented_iterator<C,T>& i, const segmented_iterator<C,U>& j);
|
||||
|
||||
template<typename C, typename T, typename U>
|
||||
friend bool operator!=(const segmented_iterator<C,T>& i, const segmented_iterator<C,U>& j);
|
||||
|
||||
template<typename C, typename U>
|
||||
friend class segmented_iterator;
|
||||
|
||||
public:
|
||||
|
||||
segmented_iterator() {my_segcont = NULL;}
|
||||
|
||||
segmented_iterator( const SegmentedContainer& _segmented_container ) :
|
||||
my_segcont(const_cast<SegmentedContainer*>(&_segmented_container)),
|
||||
outer_iter(my_segcont->end()) { }
|
||||
|
||||
~segmented_iterator() {}
|
||||
|
||||
typedef typename SegmentedContainer::iterator outer_iterator;
|
||||
typedef typename SegmentedContainer::value_type InnerContainer;
|
||||
typedef typename InnerContainer::iterator inner_iterator;
|
||||
|
||||
// STL support
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef Value value_type;
|
||||
typedef typename SegmentedContainer::size_type size_type;
|
||||
typedef Value* pointer;
|
||||
typedef Value& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
// Copy Constructor
|
||||
template<typename U>
|
||||
segmented_iterator(const segmented_iterator<SegmentedContainer, U>& other) :
|
||||
my_segcont(other.my_segcont),
|
||||
outer_iter(other.outer_iter),
|
||||
// can we assign a default-constructed iterator to inner if we're at the end?
|
||||
inner_iter(other.inner_iter)
|
||||
{}
|
||||
|
||||
// assignment
|
||||
template<typename U>
|
||||
segmented_iterator& operator=( const segmented_iterator<SegmentedContainer, U>& other) {
|
||||
if(this != &other) {
|
||||
my_segcont = other.my_segcont;
|
||||
outer_iter = other.outer_iter;
|
||||
if(outer_iter != my_segcont->end()) inner_iter = other.inner_iter;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// allow assignment of outer iterator to segmented iterator. Once it is
|
||||
// assigned, move forward until a non-empty inner container is found or
|
||||
// the end of the outer container is reached.
|
||||
segmented_iterator& operator=(const outer_iterator& new_outer_iter) {
|
||||
__TBB_ASSERT(my_segcont != NULL, NULL);
|
||||
// check that this iterator points to something inside the segmented container
|
||||
for(outer_iter = new_outer_iter ;outer_iter!=my_segcont->end(); ++outer_iter) {
|
||||
if( !outer_iter->empty() ) {
|
||||
inner_iter = outer_iter->begin();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// pre-increment
|
||||
segmented_iterator& operator++() {
|
||||
advance_me();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// post-increment
|
||||
segmented_iterator operator++(int) {
|
||||
segmented_iterator tmp = *this;
|
||||
operator++();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(const outer_iterator& other_outer) const {
|
||||
__TBB_ASSERT(my_segcont != NULL, NULL);
|
||||
return (outer_iter == other_outer &&
|
||||
(outer_iter == my_segcont->end() || inner_iter == outer_iter->begin()));
|
||||
}
|
||||
|
||||
bool operator!=(const outer_iterator& other_outer) const {
|
||||
return !operator==(other_outer);
|
||||
|
||||
}
|
||||
|
||||
// (i)* RHS
|
||||
reference operator*() const {
|
||||
__TBB_ASSERT(my_segcont != NULL, NULL);
|
||||
__TBB_ASSERT(outer_iter != my_segcont->end(), "Dereferencing a pointer at end of container");
|
||||
__TBB_ASSERT(inner_iter != outer_iter->end(), NULL); // should never happen
|
||||
return *inner_iter;
|
||||
}
|
||||
|
||||
// i->
|
||||
pointer operator->() const { return &operator*();}
|
||||
|
||||
private:
|
||||
SegmentedContainer* my_segcont;
|
||||
outer_iterator outer_iter;
|
||||
inner_iterator inner_iter;
|
||||
|
||||
void advance_me() {
|
||||
__TBB_ASSERT(my_segcont != NULL, NULL);
|
||||
__TBB_ASSERT(outer_iter != my_segcont->end(), NULL); // not true if there are no inner containers
|
||||
__TBB_ASSERT(inner_iter != outer_iter->end(), NULL); // not true if the inner containers are all empty.
|
||||
++inner_iter;
|
||||
while(inner_iter == outer_iter->end() && ++outer_iter != my_segcont->end()) {
|
||||
inner_iter = outer_iter->begin();
|
||||
}
|
||||
}
|
||||
}; // segmented_iterator
|
||||
|
||||
template<typename SegmentedContainer, typename T, typename U>
|
||||
bool operator==( const segmented_iterator<SegmentedContainer,T>& i,
|
||||
const segmented_iterator<SegmentedContainer,U>& j ) {
|
||||
if(i.my_segcont != j.my_segcont) return false;
|
||||
if(i.my_segcont == NULL) return true;
|
||||
if(i.outer_iter != j.outer_iter) return false;
|
||||
if(i.outer_iter == i.my_segcont->end()) return true;
|
||||
return i.inner_iter == j.inner_iter;
|
||||
}
|
||||
|
||||
// !=
|
||||
template<typename SegmentedContainer, typename T, typename U>
|
||||
bool operator!=( const segmented_iterator<SegmentedContainer,T>& i,
|
||||
const segmented_iterator<SegmentedContainer,U>& j ) {
|
||||
return !(i==j);
|
||||
}
|
||||
|
||||
// empty template for following specializations
|
||||
template<ets_key_usage_type et>
|
||||
struct tls_manager {};
|
||||
|
||||
//! Struct that doesn't use a key
|
||||
template <>
|
||||
struct tls_manager<ets_no_key> {
|
||||
typedef size_t tls_key_t;
|
||||
static inline void create_key( tls_key_t &) { }
|
||||
static inline void destroy_key( tls_key_t & ) { }
|
||||
static inline void set_tls( tls_key_t &, void * ) { }
|
||||
static inline void * get_tls( tls_key_t & ) { return (size_t)0; }
|
||||
};
|
||||
|
||||
//! Struct to use native TLS support directly
|
||||
template <>
|
||||
struct tls_manager <ets_key_per_instance> {
|
||||
#if _WIN32||_WIN64
|
||||
typedef DWORD tls_key_t;
|
||||
static inline void create_key( tls_key_t &k) { k = TlsAlloc(); }
|
||||
static inline void destroy_key( tls_key_t &k) { TlsFree(k); }
|
||||
static inline void set_tls( tls_key_t &k, void * value) { TlsSetValue(k, (LPVOID)value); }
|
||||
static inline void * get_tls( tls_key_t &k ) { return (void *)TlsGetValue(k); }
|
||||
#else
|
||||
typedef pthread_key_t tls_key_t;
|
||||
static inline void create_key( tls_key_t &k) { pthread_key_create(&k, NULL); }
|
||||
static inline void destroy_key( tls_key_t &k) { pthread_key_delete(k); }
|
||||
static inline void set_tls( tls_key_t &k, void * value) { pthread_setspecific(k, value); }
|
||||
static inline void * get_tls( tls_key_t &k ) { return pthread_getspecific(k); }
|
||||
#endif
|
||||
};
|
||||
|
||||
class thread_hash_compare {
|
||||
public:
|
||||
// using hack suggested by Arch to get value for thread id for hashing...
|
||||
#if _WIN32||_WIN64
|
||||
typedef DWORD thread_key;
|
||||
#else
|
||||
typedef pthread_t thread_key;
|
||||
#endif
|
||||
static thread_key my_thread_key(const tbb_thread::id j) {
|
||||
thread_key key_val;
|
||||
memcpy(&key_val, &j, sizeof(thread_key));
|
||||
return key_val;
|
||||
}
|
||||
|
||||
bool equal( const thread_key j, const thread_key k) const {
|
||||
return j == k;
|
||||
}
|
||||
unsigned long hash(const thread_key k) const {
|
||||
return (unsigned long)k;
|
||||
}
|
||||
};
|
||||
|
||||
// storage for initialization function pointer
|
||||
template<typename T>
|
||||
struct callback_base {
|
||||
virtual T apply( ) = 0;
|
||||
virtual void destroy( ) = 0;
|
||||
// need to be able to create copies of callback_base for copy constructor
|
||||
virtual callback_base* make_copy() = 0;
|
||||
// need virtual destructor to satisfy GCC compiler warning
|
||||
virtual ~callback_base() { }
|
||||
};
|
||||
|
||||
template <typename T, typename Functor>
|
||||
struct callback_leaf : public callback_base<T> {
|
||||
typedef Functor my_callback_type;
|
||||
typedef callback_leaf<T,Functor> my_type;
|
||||
typedef my_type* callback_pointer;
|
||||
typedef typename tbb::tbb_allocator<my_type> my_allocator_type;
|
||||
Functor f;
|
||||
callback_leaf( const Functor& f_) : f(f_) {
|
||||
}
|
||||
|
||||
static callback_pointer new_callback(const Functor& f_ ) {
|
||||
void* new_void = my_allocator_type().allocate(1);
|
||||
callback_pointer new_cb = new (new_void) callback_leaf<T,Functor>(f_); // placement new
|
||||
return new_cb;
|
||||
}
|
||||
|
||||
/* override */ callback_pointer make_copy() {
|
||||
return new_callback( f );
|
||||
}
|
||||
|
||||
/* override */ void destroy( ) {
|
||||
callback_pointer my_ptr = this;
|
||||
my_allocator_type().destroy(my_ptr);
|
||||
my_allocator_type().deallocate(my_ptr,1);
|
||||
}
|
||||
/* override */ T apply() { return f(); } // does copy construction of returned value.
|
||||
};
|
||||
|
||||
template<typename Key, typename T, typename HC, typename A>
|
||||
class ets_concurrent_hash_map : public tbb::concurrent_hash_map<Key, T, HC, A> {
|
||||
public:
|
||||
typedef tbb::concurrent_hash_map<Key, T, HC, A> base_type;
|
||||
typedef typename base_type::const_pointer const_pointer;
|
||||
typedef typename base_type::key_type key_type;
|
||||
const_pointer find( const key_type &k ) {
|
||||
return internal_fast_find( k );
|
||||
} // make public
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
//! The thread local class template
|
||||
template <typename T,
|
||||
typename Allocator=cache_aligned_allocator<T>,
|
||||
ets_key_usage_type ETS_key_type=ets_no_key >
|
||||
class enumerable_thread_specific {
|
||||
|
||||
template<typename U, typename A, ets_key_usage_type C> friend class enumerable_thread_specific;
|
||||
|
||||
typedef internal::tls_manager< ETS_key_type > my_tls_manager;
|
||||
|
||||
//! The padded elements; padded to avoid false sharing
|
||||
template<typename U>
|
||||
struct padded_element {
|
||||
U value;
|
||||
char padding[ ( (sizeof(U) - 1) / internal::NFS_MaxLineSize + 1 ) * internal::NFS_MaxLineSize - sizeof(U) ];
|
||||
padded_element(const U &v) : value(v) {}
|
||||
padded_element() {}
|
||||
};
|
||||
|
||||
//! A generic range, used to create range objects from the iterators
|
||||
template<typename I>
|
||||
class generic_range_type: public blocked_range<I> {
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef I iterator;
|
||||
typedef ptrdiff_t difference_type;
|
||||
generic_range_type( I begin_, I end_, size_t grainsize = 1) : blocked_range<I>(begin_,end_,grainsize) {}
|
||||
template<typename U>
|
||||
generic_range_type( const generic_range_type<U>& r) : blocked_range<I>(r.begin(),r.end(),r.grainsize()) {}
|
||||
generic_range_type( generic_range_type& r, split ) : blocked_range<I>(r,split()) {}
|
||||
};
|
||||
|
||||
typedef typename Allocator::template rebind< padded_element<T> >::other padded_allocator_type;
|
||||
typedef tbb::concurrent_vector< padded_element<T>, padded_allocator_type > internal_collection_type;
|
||||
typedef typename internal_collection_type::size_type hash_table_index_type; // storing array indices rather than iterators to simplify
|
||||
// copying the hash table that correlates thread IDs with concurrent vector elements.
|
||||
|
||||
typedef typename Allocator::template rebind< std::pair< typename internal::thread_hash_compare::thread_key, hash_table_index_type > >::other hash_element_allocator;
|
||||
typedef internal::ets_concurrent_hash_map< typename internal::thread_hash_compare::thread_key, hash_table_index_type, internal::thread_hash_compare, hash_element_allocator > thread_to_index_type;
|
||||
|
||||
typename my_tls_manager::tls_key_t my_key;
|
||||
|
||||
void reset_key() {
|
||||
my_tls_manager::destroy_key(my_key);
|
||||
my_tls_manager::create_key(my_key);
|
||||
}
|
||||
|
||||
internal::callback_base<T> *my_finit_callback;
|
||||
|
||||
// need to use a pointed-to exemplar because T may not be assignable.
|
||||
// using tbb_allocator instead of padded_element_allocator because we may be
|
||||
// copying an exemplar from one instantiation of ETS to another with a different
|
||||
// allocator.
|
||||
typedef typename tbb::tbb_allocator<padded_element<T> > exemplar_allocator_type;
|
||||
static padded_element<T> * create_exemplar(const T& my_value) {
|
||||
padded_element<T> *new_exemplar = 0;
|
||||
// void *new_space = padded_allocator_type().allocate(1);
|
||||
void *new_space = exemplar_allocator_type().allocate(1);
|
||||
new_exemplar = new(new_space) padded_element<T>(my_value);
|
||||
return new_exemplar;
|
||||
}
|
||||
|
||||
static padded_element<T> *create_exemplar( ) {
|
||||
// void *new_space = padded_allocator_type().allocate(1);
|
||||
void *new_space = exemplar_allocator_type().allocate(1);
|
||||
padded_element<T> *new_exemplar = new(new_space) padded_element<T>( );
|
||||
return new_exemplar;
|
||||
}
|
||||
|
||||
static void free_exemplar(padded_element<T> *my_ptr) {
|
||||
// padded_allocator_type().destroy(my_ptr);
|
||||
// padded_allocator_type().deallocate(my_ptr,1);
|
||||
exemplar_allocator_type().destroy(my_ptr);
|
||||
exemplar_allocator_type().deallocate(my_ptr,1);
|
||||
}
|
||||
|
||||
padded_element<T>* my_exemplar_ptr;
|
||||
|
||||
internal_collection_type my_locals;
|
||||
thread_to_index_type my_hash_tbl;
|
||||
|
||||
public:
|
||||
|
||||
//! Basic types
|
||||
typedef Allocator allocator_type;
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef typename internal_collection_type::size_type size_type;
|
||||
typedef typename internal_collection_type::difference_type difference_type;
|
||||
|
||||
// Iterator types
|
||||
typedef typename internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > iterator;
|
||||
typedef typename internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > const_iterator;
|
||||
|
||||
// Parallel range types
|
||||
typedef generic_range_type< iterator > range_type;
|
||||
typedef generic_range_type< const_iterator > const_range_type;
|
||||
|
||||
//! Default constructor, which leads to default construction of local copies
|
||||
enumerable_thread_specific() : my_finit_callback(0) {
|
||||
my_exemplar_ptr = create_exemplar();
|
||||
my_tls_manager::create_key(my_key);
|
||||
}
|
||||
|
||||
//! construction with initializer method
|
||||
// Finit should be a function taking 0 parameters and returning a T
|
||||
template <typename Finit>
|
||||
enumerable_thread_specific( Finit _finit )
|
||||
{
|
||||
my_finit_callback = internal::callback_leaf<T,Finit>::new_callback( _finit );
|
||||
my_tls_manager::create_key(my_key);
|
||||
my_exemplar_ptr = 0; // don't need exemplar if function is provided
|
||||
}
|
||||
|
||||
//! Constuction with exemplar, which leads to copy construction of local copies
|
||||
enumerable_thread_specific(const T &_exemplar) : my_finit_callback(0) {
|
||||
my_exemplar_ptr = create_exemplar(_exemplar);
|
||||
my_tls_manager::create_key(my_key);
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
~enumerable_thread_specific() {
|
||||
my_tls_manager::destroy_key(my_key);
|
||||
if(my_finit_callback) {
|
||||
my_finit_callback->destroy();
|
||||
}
|
||||
if(my_exemplar_ptr)
|
||||
{
|
||||
free_exemplar(my_exemplar_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
//! returns reference to local, discarding exists
|
||||
reference local() {
|
||||
bool exists;
|
||||
return local(exists);
|
||||
}
|
||||
|
||||
//! Returns reference to calling thread's local copy, creating one if necessary
|
||||
reference local(bool& exists) {
|
||||
if ( pointer local_ptr = static_cast<pointer>(my_tls_manager::get_tls(my_key)) ) {
|
||||
exists = true;
|
||||
return *local_ptr;
|
||||
}
|
||||
hash_table_index_type local_index;
|
||||
typename internal::thread_hash_compare::thread_key my_t_key = internal::thread_hash_compare::my_thread_key(tbb::this_tbb_thread::get_id());
|
||||
{
|
||||
typename thread_to_index_type::const_pointer my_existing_entry;
|
||||
my_existing_entry = my_hash_tbl.find(my_t_key);
|
||||
if(my_existing_entry) {
|
||||
exists = true;
|
||||
local_index = my_existing_entry->second;
|
||||
}
|
||||
else {
|
||||
|
||||
// see if the table entry can be found by accessor
|
||||
typename thread_to_index_type::accessor a;
|
||||
if(!my_hash_tbl.insert(a, my_t_key)) {
|
||||
exists = true;
|
||||
local_index = a->second;
|
||||
}
|
||||
else {
|
||||
// create new entry
|
||||
exists = false;
|
||||
if(my_finit_callback) {
|
||||
// convert iterator to array index
|
||||
#if TBB_DEPRECATED
|
||||
local_index = my_locals.push_back(my_finit_callback->apply());
|
||||
#else
|
||||
local_index = my_locals.push_back(my_finit_callback->apply()) - my_locals.begin();
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// convert iterator to array index
|
||||
#if TBB_DEPRECATED
|
||||
local_index = my_locals.push_back(*my_exemplar_ptr);
|
||||
#else
|
||||
local_index = my_locals.push_back(*my_exemplar_ptr) - my_locals.begin();
|
||||
#endif
|
||||
}
|
||||
// insert into hash table
|
||||
a->second = local_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reference local_ref = (my_locals[local_index].value);
|
||||
my_tls_manager::set_tls( my_key, static_cast<void *>(&local_ref) );
|
||||
return local_ref;
|
||||
} // local
|
||||
|
||||
//! Get the number of local copies
|
||||
size_type size() const { return my_locals.size(); }
|
||||
|
||||
//! true if there have been no local copies created
|
||||
bool empty() const { return my_locals.empty(); }
|
||||
|
||||
//! begin iterator
|
||||
iterator begin() { return iterator( my_locals, 0 ); }
|
||||
//! end iterator
|
||||
iterator end() { return iterator(my_locals, my_locals.size() ); }
|
||||
|
||||
//! begin const iterator
|
||||
const_iterator begin() const { return const_iterator(my_locals, 0); }
|
||||
|
||||
//! end const iterator
|
||||
const_iterator end() const { return const_iterator(my_locals, my_locals.size()); }
|
||||
|
||||
//! Get range for parallel algorithms
|
||||
range_type range( size_t grainsize=1 ) { return range_type( begin(), end(), grainsize ); }
|
||||
|
||||
//! Get const range for parallel algorithms
|
||||
const_range_type range( size_t grainsize=1 ) const { return const_range_type( begin(), end(), grainsize ); }
|
||||
|
||||
//! Destroys local copies
|
||||
void clear() {
|
||||
my_locals.clear();
|
||||
my_hash_tbl.clear();
|
||||
reset_key();
|
||||
// callback is not destroyed
|
||||
// exemplar is not destroyed
|
||||
}
|
||||
|
||||
// STL container methods
|
||||
// copy constructor
|
||||
|
||||
private:
|
||||
|
||||
template<typename U, typename A2, ets_key_usage_type C2>
|
||||
void
|
||||
internal_copy_construct( const enumerable_thread_specific<U, A2, C2>& other) {
|
||||
typedef typename tbb::enumerable_thread_specific<U, A2, C2> other_type;
|
||||
for(typename other_type::const_iterator ci = other.begin(); ci != other.end(); ++ci) {
|
||||
my_locals.push_back(*ci);
|
||||
}
|
||||
if(other.my_finit_callback) {
|
||||
my_finit_callback = other.my_finit_callback->make_copy();
|
||||
}
|
||||
else {
|
||||
my_finit_callback = 0;
|
||||
}
|
||||
if(other.my_exemplar_ptr) {
|
||||
my_exemplar_ptr = create_exemplar(other.my_exemplar_ptr->value);
|
||||
}
|
||||
else {
|
||||
my_exemplar_ptr = 0;
|
||||
}
|
||||
my_tls_manager::create_key(my_key);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
template<typename U, typename Alloc, ets_key_usage_type Cachetype>
|
||||
enumerable_thread_specific( const enumerable_thread_specific<U, Alloc, Cachetype>& other ) : my_hash_tbl(other.my_hash_tbl)
|
||||
{ // Have to do push_back because the contained elements are not necessarily assignable.
|
||||
internal_copy_construct(other);
|
||||
}
|
||||
|
||||
// non-templatized version
|
||||
enumerable_thread_specific( const enumerable_thread_specific& other ) : my_hash_tbl(other.my_hash_tbl)
|
||||
{
|
||||
internal_copy_construct(other);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template<typename U, typename A2, ets_key_usage_type C2>
|
||||
enumerable_thread_specific &
|
||||
internal_assign(const enumerable_thread_specific<U, A2, C2>& other) {
|
||||
typedef typename tbb::enumerable_thread_specific<U, A2, C2> other_type;
|
||||
if(static_cast<void *>( this ) != static_cast<const void *>( &other )) {
|
||||
this->clear(); // resets TLS key
|
||||
my_hash_tbl = other.my_hash_tbl;
|
||||
// cannot use assign because T may not be assignable.
|
||||
for(typename other_type::const_iterator ci = other.begin(); ci != other.end(); ++ci) {
|
||||
my_locals.push_back(*ci);
|
||||
}
|
||||
|
||||
if(my_finit_callback) {
|
||||
my_finit_callback->destroy();
|
||||
my_finit_callback = 0;
|
||||
}
|
||||
if(my_exemplar_ptr) {
|
||||
free_exemplar(my_exemplar_ptr);
|
||||
my_exemplar_ptr = 0;
|
||||
}
|
||||
if(other.my_finit_callback) {
|
||||
my_finit_callback = other.my_finit_callback->make_copy();
|
||||
}
|
||||
|
||||
if(other.my_exemplar_ptr) {
|
||||
my_exemplar_ptr = create_exemplar(other.my_exemplar_ptr->value);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// assignment
|
||||
enumerable_thread_specific& operator=(const enumerable_thread_specific& other) {
|
||||
return internal_assign(other);
|
||||
}
|
||||
|
||||
template<typename U, typename Alloc, ets_key_usage_type Cachetype>
|
||||
enumerable_thread_specific& operator=(const enumerable_thread_specific<U, Alloc, Cachetype>& other)
|
||||
{
|
||||
return internal_assign(other);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// combine_func_t has signature T(T,T) or T(const T&, const T&)
|
||||
template <typename combine_func_t>
|
||||
T internal_combine(typename internal_collection_type::const_range_type r, combine_func_t f_combine) {
|
||||
if(r.is_divisible()) {
|
||||
typename internal_collection_type::const_range_type r2(r,split());
|
||||
return f_combine(internal_combine(r2, f_combine), internal_combine(r, f_combine));
|
||||
}
|
||||
if(r.size() == 1) {
|
||||
return r.begin()->value;
|
||||
}
|
||||
typename internal_collection_type::const_iterator i2 = r.begin();
|
||||
++i2;
|
||||
return f_combine(r.begin()->value, i2->value);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// combine_func_t has signature T(T,T) or T(const T&, const T&)
|
||||
template <typename combine_func_t>
|
||||
T combine(combine_func_t f_combine) {
|
||||
if(my_locals.begin() == my_locals.end()) {
|
||||
if(my_finit_callback) {
|
||||
return my_finit_callback->apply();
|
||||
}
|
||||
return (*my_exemplar_ptr).value;
|
||||
}
|
||||
typename internal_collection_type::const_range_type r(my_locals.begin(), my_locals.end(), (size_t)2);
|
||||
return internal_combine(r, f_combine);
|
||||
}
|
||||
|
||||
// combine_func_t has signature void(T) or void(const T&)
|
||||
template <typename combine_func_t>
|
||||
void combine_each(combine_func_t f_combine) {
|
||||
for(const_iterator ci = begin(); ci != end(); ++ci) {
|
||||
f_combine( *ci );
|
||||
}
|
||||
}
|
||||
}; // enumerable_thread_specific
|
||||
|
||||
template< typename Container >
|
||||
class flattened2d {
|
||||
|
||||
// This intermediate typedef is to address issues with VC7.1 compilers
|
||||
typedef typename Container::value_type conval_type;
|
||||
|
||||
public:
|
||||
|
||||
//! Basic types
|
||||
typedef typename conval_type::size_type size_type;
|
||||
typedef typename conval_type::difference_type difference_type;
|
||||
typedef typename conval_type::allocator_type allocator_type;
|
||||
typedef typename conval_type::value_type value_type;
|
||||
typedef typename conval_type::reference reference;
|
||||
typedef typename conval_type::const_reference const_reference;
|
||||
typedef typename conval_type::pointer pointer;
|
||||
typedef typename conval_type::const_pointer const_pointer;
|
||||
|
||||
typedef typename internal::segmented_iterator<Container, value_type> iterator;
|
||||
typedef typename internal::segmented_iterator<Container, const value_type> const_iterator;
|
||||
|
||||
flattened2d( const Container &c, typename Container::const_iterator b, typename Container::const_iterator e ) :
|
||||
my_container(const_cast<Container*>(&c)), my_begin(b), my_end(e) { }
|
||||
|
||||
flattened2d( const Container &c ) :
|
||||
my_container(const_cast<Container*>(&c)), my_begin(c.begin()), my_end(c.end()) { }
|
||||
|
||||
iterator begin() { return iterator(*my_container) = my_begin; }
|
||||
iterator end() { return iterator(*my_container) = my_end; }
|
||||
const_iterator begin() const { return const_iterator(*my_container) = my_begin; }
|
||||
const_iterator end() const { return const_iterator(*my_container) = my_end; }
|
||||
|
||||
size_type size() const {
|
||||
size_type tot_size = 0;
|
||||
for(typename Container::const_iterator i = my_begin; i != my_end; ++i) {
|
||||
tot_size += i->size();
|
||||
}
|
||||
return tot_size;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Container *my_container;
|
||||
typename Container::const_iterator my_begin;
|
||||
typename Container::const_iterator my_end;
|
||||
|
||||
};
|
||||
|
||||
template <typename Container>
|
||||
flattened2d<Container> flatten2d(const Container &c, const typename Container::const_iterator b, const typename Container::const_iterator e) {
|
||||
return flattened2d<Container>(c, b, e);
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
flattened2d<Container> flatten2d(const Container &c) {
|
||||
return flattened2d<Container>(c);
|
||||
}
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<H2>Overview</H2>
|
||||
Include files for Threading Building Blocks classes and functions.
|
||||
|
||||
<BR><A HREF=".">Click here</A> to see all files in the directory.
|
||||
|
||||
<H2>Directories</H2>
|
||||
<DL>
|
||||
<DT><A HREF="machine">machine</A>
|
||||
<DD>Include files for low-level architecture specific functionality.
|
||||
<DT><A HREF="compat">compat</A>
|
||||
<DD>Include files for source level compatibility with other frameworks.
|
||||
</DL>
|
||||
|
||||
<HR>
|
||||
<A HREF="../index.html">Up to parent directory</A>
|
||||
<p></p>
|
||||
Copyright © 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
<p></p>
|
||||
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
|
||||
registered trademarks or trademarks of Intel Corporation or its
|
||||
subsidiaries in the United States and other countries.
|
||||
<p></p>
|
||||
* Other names and brands may be claimed as the property of others.
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_machine_H
|
||||
#error Do not include this file directly; include tbb_machine.h instead
|
||||
#endif
|
||||
|
||||
#define __TBB_WORDSIZE 8
|
||||
#define __TBB_BIG_ENDIAN 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
int32_t __TBB_machine_cas_32 (volatile void* ptr, int32_t value, int32_t comparand);
|
||||
int64_t __TBB_machine_cas_64 (volatile void* ptr, int64_t value, int64_t comparand);
|
||||
#define __TBB_fence_for_acquire() __TBB_machine_flush ()
|
||||
#define __TBB_fence_for_release() __TBB_machine_flush ()
|
||||
|
||||
}
|
||||
|
||||
#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cas_32(P,V,C)
|
||||
#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cas_64(P,V,C)
|
||||
#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cas_64(P,V,C)
|
||||
#define __TBB_Yield() sched_yield()
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_machine_H
|
||||
#error Do not include this file directly; include tbb_machine.h instead
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
|
||||
// Definition of __TBB_Yield()
|
||||
#define __TBB_Yield() sched_yield()
|
||||
|
||||
/* Futex definitions */
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#if defined(SYS_futex)
|
||||
|
||||
#define __TBB_USE_FUTEX 1
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
// Unfortunately, some versions of Linux do not have a header that defines FUTEX_WAIT and FUTEX_WAKE.
|
||||
|
||||
#ifdef FUTEX_WAIT
|
||||
#define __TBB_FUTEX_WAIT FUTEX_WAIT
|
||||
#else
|
||||
#define __TBB_FUTEX_WAIT 0
|
||||
#endif
|
||||
|
||||
#ifdef FUTEX_WAKE
|
||||
#define __TBB_FUTEX_WAKE FUTEX_WAKE
|
||||
#else
|
||||
#define __TBB_FUTEX_WAKE 1
|
||||
#endif
|
||||
|
||||
#ifndef __TBB_ASSERT
|
||||
#error machine specific headers must be included after tbb_stddef.h
|
||||
#endif
|
||||
|
||||
namespace tbb {
|
||||
|
||||
namespace internal {
|
||||
|
||||
inline int futex_wait( void *futex, int comparand ) {
|
||||
int r = ::syscall( SYS_futex,futex,__TBB_FUTEX_WAIT,comparand,NULL,NULL,0 );
|
||||
#if TBB_USE_ASSERT
|
||||
int e = errno;
|
||||
__TBB_ASSERT( r==0||r==EWOULDBLOCK||(r==-1&&(e==EAGAIN||e==EINTR)), "futex_wait failed." );
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
return r;
|
||||
}
|
||||
|
||||
inline int futex_wakeup_one( void *futex ) {
|
||||
int r = ::syscall( SYS_futex,futex,__TBB_FUTEX_WAKE,1,NULL,NULL,0 );
|
||||
__TBB_ASSERT( r==0||r==1, "futex_wakeup_one: more than one thread woken up?" );
|
||||
return r;
|
||||
}
|
||||
|
||||
inline int futex_wakeup_all( void *futex ) {
|
||||
int r = ::syscall( SYS_futex,futex,__TBB_FUTEX_WAKE,INT_MAX,NULL,NULL,0 );
|
||||
__TBB_ASSERT( r>=0, "futex_wakeup_all: error in waking up threads" );
|
||||
return r;
|
||||
}
|
||||
|
||||
} /* namespace internal */
|
||||
|
||||
} /* namespace tbb */
|
||||
|
||||
#endif /* SYS_futex */
|
||||
|
|
@ -1,253 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_machine_H
|
||||
#error Do not include this file directly; include tbb_machine.h instead
|
||||
#endif
|
||||
|
||||
#if !__MINGW32__
|
||||
#include "linux_common.h"
|
||||
#endif
|
||||
|
||||
#define __TBB_WORDSIZE 4
|
||||
#define __TBB_BIG_ENDIAN 0
|
||||
|
||||
#define __TBB_release_consistency_helper() __asm__ __volatile__("": : :"memory")
|
||||
|
||||
inline void __TBB_rel_acq_fence() { __asm__ __volatile__("mfence": : :"memory"); }
|
||||
|
||||
#define __MACHINE_DECL_ATOMICS(S,T,X) \
|
||||
static inline T __TBB_machine_cmpswp##S (volatile void *ptr, T value, T comparand ) \
|
||||
{ \
|
||||
T result; \
|
||||
\
|
||||
__asm__ __volatile__("lock\ncmpxchg" X " %2,%1" \
|
||||
: "=a"(result), "=m"(*(T *)ptr) \
|
||||
: "q"(value), "0"(comparand), "m"(*(T *)ptr) \
|
||||
: "memory"); \
|
||||
return result; \
|
||||
} \
|
||||
\
|
||||
static inline T __TBB_machine_fetchadd##S(volatile void *ptr, T addend) \
|
||||
{ \
|
||||
T result; \
|
||||
__asm__ __volatile__("lock\nxadd" X " %0,%1" \
|
||||
: "=r"(result), "=m"(*(T *)ptr) \
|
||||
: "0"(addend), "m"(*(T *)ptr) \
|
||||
: "memory"); \
|
||||
return result; \
|
||||
} \
|
||||
\
|
||||
static inline T __TBB_machine_fetchstore##S(volatile void *ptr, T value) \
|
||||
{ \
|
||||
T result; \
|
||||
__asm__ __volatile__("lock\nxchg" X " %0,%1" \
|
||||
: "=r"(result), "=m"(*(T *)ptr) \
|
||||
: "0"(value), "m"(*(T *)ptr) \
|
||||
: "memory"); \
|
||||
return result; \
|
||||
} \
|
||||
|
||||
__MACHINE_DECL_ATOMICS(1,int8_t,"")
|
||||
__MACHINE_DECL_ATOMICS(2,int16_t,"")
|
||||
__MACHINE_DECL_ATOMICS(4,int32_t,"l")
|
||||
|
||||
static inline int64_t __TBB_machine_cmpswp8 (volatile void *ptr, int64_t value, int64_t comparand )
|
||||
{
|
||||
int64_t result;
|
||||
#if __PIC__
|
||||
/* compiling position-independent code */
|
||||
// EBX register preserved for compliancy with position-independent code rules on IA32
|
||||
__asm__ __volatile__ (
|
||||
"pushl %%ebx\n\t"
|
||||
"movl (%%ecx),%%ebx\n\t"
|
||||
"movl 4(%%ecx),%%ecx\n\t"
|
||||
"lock\n\t cmpxchg8b %1\n\t"
|
||||
"popl %%ebx"
|
||||
: "=A"(result), "=m"(*(int64_t *)ptr)
|
||||
: "m"(*(int64_t *)ptr)
|
||||
, "0"(comparand)
|
||||
, "c"(&value)
|
||||
: "memory", "esp"
|
||||
#if __INTEL_COMPILER
|
||||
,"ebx"
|
||||
#endif
|
||||
);
|
||||
#else /* !__PIC__ */
|
||||
union {
|
||||
int64_t i64;
|
||||
int32_t i32[2];
|
||||
};
|
||||
i64 = value;
|
||||
__asm__ __volatile__ (
|
||||
"lock\n\t cmpxchg8b %1\n\t"
|
||||
: "=A"(result), "=m"(*(int64_t *)ptr)
|
||||
: "m"(*(int64_t *)ptr)
|
||||
, "0"(comparand)
|
||||
, "b"(i32[0]), "c"(i32[1])
|
||||
: "memory"
|
||||
);
|
||||
#endif /* __PIC__ */
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline int32_t __TBB_machine_lg( uint32_t x ) {
|
||||
int32_t j;
|
||||
__asm__ ("bsr %1,%0" : "=r"(j) : "r"(x));
|
||||
return j;
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_or( volatile void *ptr, uint32_t addend ) {
|
||||
__asm__ __volatile__("lock\norl %1,%0" : "=m"(*(uint32_t *)ptr) : "r"(addend), "m"(*(uint32_t *)ptr) : "memory");
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_and( volatile void *ptr, uint32_t addend ) {
|
||||
__asm__ __volatile__("lock\nandl %1,%0" : "=m"(*(uint32_t *)ptr) : "r"(addend), "m"(*(uint32_t *)ptr) : "memory");
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_pause( int32_t delay ) {
|
||||
for (int32_t i = 0; i < delay; i++) {
|
||||
__asm__ __volatile__("pause;");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int64_t __TBB_machine_load8 (const volatile void *ptr) {
|
||||
int64_t result;
|
||||
if( ((uint32_t)ptr&7u)==0 ) {
|
||||
// Aligned load
|
||||
__asm__ __volatile__ ( "fildq %1\n\t"
|
||||
"fistpq %0" : "=m"(result) : "m"(*(uint64_t *)ptr) : "memory" );
|
||||
} else {
|
||||
// Unaligned load
|
||||
result = __TBB_machine_cmpswp8((void*)ptr,0,0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//! Handles misaligned 8-byte store
|
||||
/** Defined in tbb_misc.cpp */
|
||||
extern "C" void __TBB_machine_store8_slow( volatile void *ptr, int64_t value );
|
||||
extern "C" void __TBB_machine_store8_slow_perf_warning( volatile void *ptr );
|
||||
|
||||
static inline void __TBB_machine_store8(volatile void *ptr, int64_t value) {
|
||||
if( ((uint32_t)ptr&7u)==0 ) {
|
||||
// Aligned store
|
||||
__asm__ __volatile__ ( "fildq %1\n\t"
|
||||
"fistpq %0" : "=m"(*(int64_t *)ptr) : "m"(value) : "memory" );
|
||||
} else {
|
||||
// Unaligned store
|
||||
#if TBB_USE_PERFORMANCE_WARNINGS
|
||||
__TBB_machine_store8_slow_perf_warning(ptr);
|
||||
#endif /* TBB_USE_PERFORMANCE_WARNINGS */
|
||||
__TBB_machine_store8_slow(ptr,value);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, size_t S>
|
||||
struct __TBB_machine_load_store {
|
||||
static inline T load_with_acquire(const volatile T& location) {
|
||||
T to_return = location;
|
||||
__asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards
|
||||
return to_return;
|
||||
}
|
||||
|
||||
static inline void store_with_release(volatile T &location, T value) {
|
||||
__asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards
|
||||
location = value;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct __TBB_machine_load_store<T,8> {
|
||||
static inline T load_with_acquire(const volatile T& location) {
|
||||
T to_return = __TBB_machine_load8((volatile void *)&location);
|
||||
__asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards
|
||||
return to_return;
|
||||
}
|
||||
|
||||
static inline void store_with_release(volatile T &location, T value) {
|
||||
__asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating downwards
|
||||
__TBB_machine_store8((volatile void *)&location,(int64_t)value);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline T __TBB_machine_load_with_acquire(const volatile T &location) {
|
||||
return __TBB_machine_load_store<T,sizeof(T)>::load_with_acquire(location);
|
||||
}
|
||||
|
||||
template<typename T, typename V>
|
||||
inline void __TBB_machine_store_with_release(volatile T &location, V value) {
|
||||
__TBB_machine_load_store<T,sizeof(T)>::store_with_release(location,value);
|
||||
}
|
||||
|
||||
#define __TBB_load_with_acquire(L) __TBB_machine_load_with_acquire((L))
|
||||
#define __TBB_store_with_release(L,V) __TBB_machine_store_with_release((L),(V))
|
||||
|
||||
// Machine specific atomic operations
|
||||
|
||||
#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C)
|
||||
#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C)
|
||||
#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C)
|
||||
#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C)
|
||||
#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C)
|
||||
|
||||
#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V)
|
||||
#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V)
|
||||
#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4(P,V)
|
||||
#define __TBB_FetchAndAddW(P,V) __TBB_machine_fetchadd4(P,V)
|
||||
|
||||
#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V)
|
||||
#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V)
|
||||
#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4(P,V)
|
||||
#define __TBB_FetchAndStoreW(P,V) __TBB_machine_fetchstore4(P,V)
|
||||
|
||||
#define __TBB_Store8(P,V) __TBB_machine_store8(P,V)
|
||||
#define __TBB_Load8(P) __TBB_machine_load8(P)
|
||||
|
||||
#define __TBB_AtomicOR(P,V) __TBB_machine_or(P,V)
|
||||
#define __TBB_AtomicAND(P,V) __TBB_machine_and(P,V)
|
||||
|
||||
|
||||
// Those we chose not to implement (they will be implemented generically using CMPSWP8)
|
||||
#undef __TBB_FetchAndAdd8
|
||||
#undef __TBB_FetchAndStore8
|
||||
|
||||
// Definition of other functions
|
||||
#define __TBB_Pause(V) __TBB_machine_pause(V)
|
||||
#define __TBB_Log2(V) __TBB_machine_lg(V)
|
||||
|
||||
// Special atomic functions
|
||||
#define __TBB_FetchAndAddWrelease(P,V) __TBB_FetchAndAddW(P,V)
|
||||
#define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAddW(P,1)
|
||||
#define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAddW(P,-1)
|
||||
|
||||
// Use generic definitions from tbb_machine.h
|
||||
#undef __TBB_TryLockByte
|
||||
#undef __TBB_LockByte
|
||||
|
|
@ -1,169 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_machine_H
|
||||
#error Do not include this file directly; include tbb_machine.h instead
|
||||
#endif
|
||||
|
||||
#include "linux_common.h"
|
||||
#include <ia64intrin.h>
|
||||
|
||||
#define __TBB_WORDSIZE 8
|
||||
#define __TBB_BIG_ENDIAN 0
|
||||
#define __TBB_DECL_FENCED_ATOMICS 1
|
||||
|
||||
// Most of the functions will be in a .s file
|
||||
|
||||
extern "C" {
|
||||
int8_t __TBB_machine_cmpswp1__TBB_full_fence (volatile void *ptr, int8_t value, int8_t comparand);
|
||||
int8_t __TBB_machine_fetchadd1__TBB_full_fence (volatile void *ptr, int8_t addend);
|
||||
int8_t __TBB_machine_fetchadd1acquire(volatile void *ptr, int8_t addend);
|
||||
int8_t __TBB_machine_fetchadd1release(volatile void *ptr, int8_t addend);
|
||||
int8_t __TBB_machine_fetchstore1acquire(volatile void *ptr, int8_t value);
|
||||
int8_t __TBB_machine_fetchstore1release(volatile void *ptr, int8_t value);
|
||||
|
||||
int16_t __TBB_machine_cmpswp2__TBB_full_fence (volatile void *ptr, int16_t value, int16_t comparand);
|
||||
int16_t __TBB_machine_fetchadd2__TBB_full_fence (volatile void *ptr, int16_t addend);
|
||||
int16_t __TBB_machine_fetchadd2acquire(volatile void *ptr, int16_t addend);
|
||||
int16_t __TBB_machine_fetchadd2release(volatile void *ptr, int16_t addend);
|
||||
int16_t __TBB_machine_fetchstore2acquire(volatile void *ptr, int16_t value);
|
||||
int16_t __TBB_machine_fetchstore2release(volatile void *ptr, int16_t value);
|
||||
|
||||
int32_t __TBB_machine_fetchstore4__TBB_full_fence (volatile void *ptr, int32_t value);
|
||||
int32_t __TBB_machine_fetchstore4acquire(volatile void *ptr, int32_t value);
|
||||
int32_t __TBB_machine_fetchstore4release(volatile void *ptr, int32_t value);
|
||||
int32_t __TBB_machine_fetchadd4acquire(volatile void *ptr, int32_t addend);
|
||||
int32_t __TBB_machine_fetchadd4release(volatile void *ptr, int32_t addend);
|
||||
|
||||
int64_t __TBB_machine_cmpswp8__TBB_full_fence (volatile void *ptr, int64_t value, int64_t comparand);
|
||||
int64_t __TBB_machine_fetchstore8__TBB_full_fence (volatile void *ptr, int64_t value);
|
||||
int64_t __TBB_machine_fetchstore8acquire(volatile void *ptr, int64_t value);
|
||||
int64_t __TBB_machine_fetchstore8release(volatile void *ptr, int64_t value);
|
||||
int64_t __TBB_machine_fetchadd8acquire(volatile void *ptr, int64_t addend);
|
||||
int64_t __TBB_machine_fetchadd8release(volatile void *ptr, int64_t addend);
|
||||
|
||||
int8_t __TBB_machine_cmpswp1acquire(volatile void *ptr, int8_t value, int8_t comparand);
|
||||
int8_t __TBB_machine_cmpswp1release(volatile void *ptr, int8_t value, int8_t comparand);
|
||||
int8_t __TBB_machine_fetchstore1__TBB_full_fence (volatile void *ptr, int8_t value);
|
||||
|
||||
int16_t __TBB_machine_cmpswp2acquire(volatile void *ptr, int16_t value, int16_t comparand);
|
||||
int16_t __TBB_machine_cmpswp2release(volatile void *ptr, int16_t value, int16_t comparand);
|
||||
int16_t __TBB_machine_fetchstore2__TBB_full_fence (volatile void *ptr, int16_t value);
|
||||
|
||||
int32_t __TBB_machine_cmpswp4__TBB_full_fence (volatile void *ptr, int32_t value, int32_t comparand);
|
||||
int32_t __TBB_machine_cmpswp4acquire(volatile void *ptr, int32_t value, int32_t comparand);
|
||||
int32_t __TBB_machine_cmpswp4release(volatile void *ptr, int32_t value, int32_t comparand);
|
||||
int32_t __TBB_machine_fetchadd4__TBB_full_fence (volatile void *ptr, int32_t value);
|
||||
|
||||
int64_t __TBB_machine_cmpswp8acquire(volatile void *ptr, int64_t value, int64_t comparand);
|
||||
int64_t __TBB_machine_cmpswp8release(volatile void *ptr, int64_t value, int64_t comparand);
|
||||
int64_t __TBB_machine_fetchadd8__TBB_full_fence (volatile void *ptr, int64_t value);
|
||||
|
||||
int64_t __TBB_machine_lg(uint64_t value);
|
||||
void __TBB_machine_pause(int32_t delay);
|
||||
bool __TBB_machine_trylockbyte( volatile unsigned char &ptr );
|
||||
int64_t __TBB_machine_lockbyte( volatile unsigned char &ptr );
|
||||
|
||||
//! Retrieves the current RSE backing store pointer. IA64 specific.
|
||||
void* __TBB_get_bsp();
|
||||
}
|
||||
|
||||
#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1__TBB_full_fence(P,V,C)
|
||||
#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2__TBB_full_fence(P,V,C)
|
||||
|
||||
#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1__TBB_full_fence(P,V)
|
||||
#define __TBB_FetchAndAdd1acquire(P,V) __TBB_machine_fetchadd1acquire(P,V)
|
||||
#define __TBB_FetchAndAdd1release(P,V) __TBB_machine_fetchadd1release(P,V)
|
||||
#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2__TBB_full_fence(P,V)
|
||||
#define __TBB_FetchAndAdd2acquire(P,V) __TBB_machine_fetchadd2acquire(P,V)
|
||||
#define __TBB_FetchAndAdd2release(P,V) __TBB_machine_fetchadd2release(P,V)
|
||||
#define __TBB_FetchAndAdd4acquire(P,V) __TBB_machine_fetchadd4acquire(P,V)
|
||||
#define __TBB_FetchAndAdd4release(P,V) __TBB_machine_fetchadd4release(P,V)
|
||||
#define __TBB_FetchAndAdd8acquire(P,V) __TBB_machine_fetchadd8acquire(P,V)
|
||||
#define __TBB_FetchAndAdd8release(P,V) __TBB_machine_fetchadd8release(P,V)
|
||||
|
||||
#define __TBB_FetchAndStore1acquire(P,V) __TBB_machine_fetchstore1acquire(P,V)
|
||||
#define __TBB_FetchAndStore1release(P,V) __TBB_machine_fetchstore1release(P,V)
|
||||
#define __TBB_FetchAndStore2acquire(P,V) __TBB_machine_fetchstore2acquire(P,V)
|
||||
#define __TBB_FetchAndStore2release(P,V) __TBB_machine_fetchstore2release(P,V)
|
||||
#define __TBB_FetchAndStore4acquire(P,V) __TBB_machine_fetchstore4acquire(P,V)
|
||||
#define __TBB_FetchAndStore4release(P,V) __TBB_machine_fetchstore4release(P,V)
|
||||
#define __TBB_FetchAndStore8acquire(P,V) __TBB_machine_fetchstore8acquire(P,V)
|
||||
#define __TBB_FetchAndStore8release(P,V) __TBB_machine_fetchstore8release(P,V)
|
||||
|
||||
#define __TBB_CompareAndSwap1acquire(P,V,C) __TBB_machine_cmpswp1acquire(P,V,C)
|
||||
#define __TBB_CompareAndSwap1release(P,V,C) __TBB_machine_cmpswp1release(P,V,C)
|
||||
#define __TBB_CompareAndSwap2acquire(P,V,C) __TBB_machine_cmpswp2acquire(P,V,C)
|
||||
#define __TBB_CompareAndSwap2release(P,V,C) __TBB_machine_cmpswp2release(P,V,C)
|
||||
#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4__TBB_full_fence(P,V,C)
|
||||
#define __TBB_CompareAndSwap4acquire(P,V,C) __TBB_machine_cmpswp4acquire(P,V,C)
|
||||
#define __TBB_CompareAndSwap4release(P,V,C) __TBB_machine_cmpswp4release(P,V,C)
|
||||
#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8__TBB_full_fence(P,V,C)
|
||||
#define __TBB_CompareAndSwap8acquire(P,V,C) __TBB_machine_cmpswp8acquire(P,V,C)
|
||||
#define __TBB_CompareAndSwap8release(P,V,C) __TBB_machine_cmpswp8release(P,V,C)
|
||||
|
||||
#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4__TBB_full_fence(P,V)
|
||||
#define __TBB_FetchAndAdd8(P,V) __TBB_machine_fetchadd8__TBB_full_fence(P,V)
|
||||
|
||||
#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1__TBB_full_fence(P,V)
|
||||
#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2__TBB_full_fence(P,V)
|
||||
#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4__TBB_full_fence(P,V)
|
||||
#define __TBB_FetchAndStore8(P,V) __TBB_machine_fetchstore8__TBB_full_fence(P,V)
|
||||
|
||||
#define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAdd8acquire(P,1)
|
||||
#define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAdd8release(P,-1)
|
||||
|
||||
#ifndef __INTEL_COMPILER
|
||||
/* Even though GCC imbues volatile loads with acquire semantics,
|
||||
it sometimes moves loads over the acquire fence. The
|
||||
fences defined here stop such incorrect code motion. */
|
||||
#define __TBB_release_consistency_helper() __asm__ __volatile__("": : :"memory")
|
||||
#define __TBB_rel_acq_fence() __asm__ __volatile__("mf": : :"memory")
|
||||
#else
|
||||
#define __TBB_release_consistency_helper()
|
||||
#define __TBB_rel_acq_fence() __mf()
|
||||
#endif /* __INTEL_COMPILER */
|
||||
|
||||
// Special atomic functions
|
||||
#define __TBB_CompareAndSwapW(P,V,C) __TBB_CompareAndSwap8(P,V,C)
|
||||
#define __TBB_FetchAndStoreW(P,V) __TBB_FetchAndStore8(P,V)
|
||||
#define __TBB_FetchAndAddW(P,V) __TBB_FetchAndAdd8(P,V)
|
||||
#define __TBB_FetchAndAddWrelease(P,V) __TBB_FetchAndAdd8release(P,V)
|
||||
|
||||
// Not needed
|
||||
#undef __TBB_Store8
|
||||
#undef __TBB_Load8
|
||||
|
||||
// Definition of Lock functions
|
||||
#define __TBB_TryLockByte(P) __TBB_machine_trylockbyte(P)
|
||||
#define __TBB_LockByte(P) __TBB_machine_lockbyte(P)
|
||||
|
||||
// Definition of other utility functions
|
||||
#define __TBB_Pause(V) __TBB_machine_pause(V)
|
||||
#define __TBB_Log2(V) __TBB_machine_lg(V)
|
||||
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_machine_H
|
||||
#error Do not include this file directly; include tbb_machine.h instead
|
||||
#endif
|
||||
|
||||
#include "linux_common.h"
|
||||
|
||||
#define __TBB_WORDSIZE 8
|
||||
#define __TBB_BIG_ENDIAN 0
|
||||
|
||||
#define __TBB_release_consistency_helper() __asm__ __volatile__("": : :"memory")
|
||||
|
||||
#ifndef __TBB_rel_acq_fence
|
||||
inline void __TBB_rel_acq_fence() { __asm__ __volatile__("mfence": : :"memory"); }
|
||||
#endif
|
||||
|
||||
#define __MACHINE_DECL_ATOMICS(S,T,X) \
|
||||
static inline T __TBB_machine_cmpswp##S (volatile void *ptr, T value, T comparand ) \
|
||||
{ \
|
||||
T result; \
|
||||
\
|
||||
__asm__ __volatile__("lock\ncmpxchg" X " %2,%1" \
|
||||
: "=a"(result), "=m"(*(T *)ptr) \
|
||||
: "q"(value), "0"(comparand), "m"(*(T *)ptr) \
|
||||
: "memory"); \
|
||||
return result; \
|
||||
} \
|
||||
\
|
||||
static inline T __TBB_machine_fetchadd##S(volatile void *ptr, T addend) \
|
||||
{ \
|
||||
T result; \
|
||||
__asm__ __volatile__("lock\nxadd" X " %0,%1" \
|
||||
: "=r"(result),"=m"(*(T *)ptr) \
|
||||
: "0"(addend), "m"(*(T *)ptr) \
|
||||
: "memory"); \
|
||||
return result; \
|
||||
} \
|
||||
\
|
||||
static inline T __TBB_machine_fetchstore##S(volatile void *ptr, T value) \
|
||||
{ \
|
||||
T result; \
|
||||
__asm__ __volatile__("lock\nxchg" X " %0,%1" \
|
||||
: "=r"(result),"=m"(*(T *)ptr) \
|
||||
: "0"(value), "m"(*(T *)ptr) \
|
||||
: "memory"); \
|
||||
return result; \
|
||||
} \
|
||||
|
||||
__MACHINE_DECL_ATOMICS(1,int8_t,"")
|
||||
__MACHINE_DECL_ATOMICS(2,int16_t,"")
|
||||
__MACHINE_DECL_ATOMICS(4,int32_t,"")
|
||||
__MACHINE_DECL_ATOMICS(8,int64_t,"q")
|
||||
|
||||
static inline int64_t __TBB_machine_lg( uint64_t x ) {
|
||||
int64_t j;
|
||||
__asm__ ("bsr %1,%0" : "=r"(j) : "r"(x));
|
||||
return j;
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_or( volatile void *ptr, uint64_t addend ) {
|
||||
__asm__ __volatile__("lock\norq %1,%0" : "=m"(*(uint64_t *)ptr) : "r"(addend), "m"(*(uint64_t *)ptr) : "memory");
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_and( volatile void *ptr, uint64_t addend ) {
|
||||
__asm__ __volatile__("lock\nandq %1,%0" : "=m"(*(uint64_t *)ptr) : "r"(addend), "m"(*(uint64_t *)ptr) : "memory");
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_pause( int32_t delay ) {
|
||||
for (int32_t i = 0; i < delay; i++) {
|
||||
__asm__ __volatile__("pause;");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Machine specific atomic operations
|
||||
|
||||
#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C)
|
||||
#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C)
|
||||
#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C)
|
||||
#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C)
|
||||
#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp8(P,V,C)
|
||||
|
||||
#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V)
|
||||
#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V)
|
||||
#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4(P,V)
|
||||
#define __TBB_FetchAndAdd8(P,V) __TBB_machine_fetchadd8(P,V)
|
||||
#define __TBB_FetchAndAddW(P,V) __TBB_machine_fetchadd8(P,V)
|
||||
|
||||
#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V)
|
||||
#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V)
|
||||
#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4(P,V)
|
||||
#define __TBB_FetchAndStore8(P,V) __TBB_machine_fetchstore8(P,V)
|
||||
#define __TBB_FetchAndStoreW(P,V) __TBB_machine_fetchstore8(P,V)
|
||||
|
||||
#define __TBB_Store8(P,V) (*P = V)
|
||||
#define __TBB_Load8(P) (*P)
|
||||
|
||||
#define __TBB_AtomicOR(P,V) __TBB_machine_or(P,V)
|
||||
#define __TBB_AtomicAND(P,V) __TBB_machine_and(P,V)
|
||||
|
||||
// Definition of other functions
|
||||
#define __TBB_Pause(V) __TBB_machine_pause(V)
|
||||
#define __TBB_Log2(V) __TBB_machine_lg(V)
|
||||
|
||||
// Special atomic functions
|
||||
#define __TBB_FetchAndAddWrelease(P,V) __TBB_FetchAndAddW(P,V)
|
||||
#define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAddW(P,1)
|
||||
#define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAddW(P,-1)
|
||||
|
||||
// Use generic definitions from tbb_machine.h
|
||||
#undef __TBB_TryLockByte
|
||||
#undef __TBB_LockByte
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_machine_H
|
||||
#error Do not include this file directly; include tbb_machine.h instead
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sched.h> // sched_yield
|
||||
|
||||
inline int32_t __TBB_machine_cmpswp4 (volatile void *ptr, int32_t value, int32_t comparand )
|
||||
{
|
||||
int32_t result;
|
||||
|
||||
__asm__ __volatile__("sync\n"
|
||||
"0: lwarx %0,0,%2\n\t" /* load w/ reservation */
|
||||
"cmpw %0,%4\n\t" /* compare against comparand */
|
||||
"bne- 1f\n\t" /* exit if not same */
|
||||
"stwcx. %3,0,%2\n\t" /* store new_value */
|
||||
"bne- 0b\n" /* retry if reservation lost */
|
||||
"1: sync" /* the exit */
|
||||
: "=&r"(result), "=m"(* (int32_t*) ptr)
|
||||
: "r"(ptr), "r"(value), "r"(comparand), "m"(* (int32_t*) ptr)
|
||||
: "cr0");
|
||||
return result;
|
||||
}
|
||||
|
||||
inline int64_t __TBB_machine_cmpswp8 (volatile void *ptr, int64_t value, int64_t comparand )
|
||||
{
|
||||
int64_t result;
|
||||
__asm__ __volatile__("sync\n"
|
||||
"0: ldarx %0,0,%2\n\t" /* load w/ reservation */
|
||||
"cmpd %0,%4\n\t" /* compare against comparand */
|
||||
"bne- 1f\n\t" /* exit if not same */
|
||||
"stdcx. %3,0,%2\n\t" /* store new_value */
|
||||
"bne- 0b\n" /* retry if reservation lost */
|
||||
"1: sync" /* the exit */
|
||||
: "=&b"(result), "=m"(* (int64_t*) ptr)
|
||||
: "r"(ptr), "r"(value), "r"(comparand), "m"(* (int64_t*) ptr)
|
||||
: "cr0");
|
||||
return result;
|
||||
}
|
||||
|
||||
#define __TBB_BIG_ENDIAN 1
|
||||
|
||||
#if defined(powerpc64) || defined(__powerpc64__) || defined(__ppc64__)
|
||||
#define __TBB_WORDSIZE 8
|
||||
#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp8(P,V,C)
|
||||
#else
|
||||
#define __TBB_WORDSIZE 4
|
||||
#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C)
|
||||
#endif
|
||||
|
||||
#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C)
|
||||
#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C)
|
||||
#define __TBB_Yield() sched_yield()
|
||||
#define __TBB_rel_acq_fence() __asm__ __volatile__("lwsync": : :"memory")
|
||||
#define __TBB_release_consistency_helper() __TBB_rel_acq_fence()
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_machine_H
|
||||
#error Do not include this file directly; include tbb_machine.h instead
|
||||
#endif
|
||||
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define __TBB_release_consistency_helper() __asm { __asm nop }
|
||||
#elif _MSC_VER >= 1300
|
||||
extern "C" void _ReadWriteBarrier();
|
||||
#pragma intrinsic(_ReadWriteBarrier)
|
||||
#define __TBB_release_consistency_helper() _ReadWriteBarrier()
|
||||
#else
|
||||
#error Unsupported compiler - need to define __TBB_release_consistency_helper to support it
|
||||
#endif
|
||||
|
||||
inline void __TBB_rel_acq_fence() { __asm { __asm mfence } }
|
||||
|
||||
#define __TBB_WORDSIZE 4
|
||||
#define __TBB_BIG_ENDIAN 0
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||
// Workaround for overzealous compiler warnings in /Wp64 mode
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4244 4267)
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
__int64 __TBB_EXPORTED_FUNC __TBB_machine_cmpswp8 (volatile void *ptr, __int64 value, __int64 comparand );
|
||||
__int64 __TBB_EXPORTED_FUNC __TBB_machine_fetchadd8 (volatile void *ptr, __int64 addend );
|
||||
__int64 __TBB_EXPORTED_FUNC __TBB_machine_fetchstore8 (volatile void *ptr, __int64 value );
|
||||
void __TBB_EXPORTED_FUNC __TBB_machine_store8 (volatile void *ptr, __int64 value );
|
||||
__int64 __TBB_EXPORTED_FUNC __TBB_machine_load8 (const volatile void *ptr);
|
||||
}
|
||||
|
||||
template <typename T, size_t S>
|
||||
struct __TBB_machine_load_store {
|
||||
static inline T load_with_acquire(const volatile T& location) {
|
||||
T to_return = location;
|
||||
__TBB_release_consistency_helper();
|
||||
return to_return;
|
||||
}
|
||||
|
||||
static inline void store_with_release(volatile T &location, T value) {
|
||||
__TBB_release_consistency_helper();
|
||||
location = value;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct __TBB_machine_load_store<T,8> {
|
||||
static inline T load_with_acquire(const volatile T& location) {
|
||||
return __TBB_machine_load8((volatile void *)&location);
|
||||
}
|
||||
|
||||
static inline void store_with_release(T &location, T value) {
|
||||
__TBB_machine_store8((volatile void *)&location,(__int64)value);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline T __TBB_machine_load_with_acquire(const volatile T &location) {
|
||||
return __TBB_machine_load_store<T,sizeof(T)>::load_with_acquire(location);
|
||||
}
|
||||
|
||||
template<typename T, typename V>
|
||||
inline void __TBB_machine_store_with_release(T& location, V value) {
|
||||
__TBB_machine_load_store<T,sizeof(T)>::store_with_release(location,value);
|
||||
}
|
||||
|
||||
//! Overload that exists solely to avoid /Wp64 warnings.
|
||||
inline void __TBB_machine_store_with_release(size_t& location, size_t value) {
|
||||
__TBB_machine_load_store<size_t,sizeof(size_t)>::store_with_release(location,value);
|
||||
}
|
||||
|
||||
#define __TBB_load_with_acquire(L) __TBB_machine_load_with_acquire((L))
|
||||
#define __TBB_store_with_release(L,V) __TBB_machine_store_with_release((L),(V))
|
||||
|
||||
#define __TBB_DEFINE_ATOMICS(S,T,U,A,C) \
|
||||
static inline T __TBB_machine_cmpswp##S ( volatile void * ptr, U value, U comparand ) { \
|
||||
T result; \
|
||||
volatile T *p = (T *)ptr; \
|
||||
__TBB_release_consistency_helper(); \
|
||||
__asm \
|
||||
{ \
|
||||
__asm mov edx, p \
|
||||
__asm mov C , value \
|
||||
__asm mov A , comparand \
|
||||
__asm lock cmpxchg [edx], C \
|
||||
__asm mov result, A \
|
||||
} \
|
||||
__TBB_release_consistency_helper(); \
|
||||
return result; \
|
||||
} \
|
||||
\
|
||||
static inline T __TBB_machine_fetchadd##S ( volatile void * ptr, U addend ) { \
|
||||
T result; \
|
||||
volatile T *p = (T *)ptr; \
|
||||
__TBB_release_consistency_helper(); \
|
||||
__asm \
|
||||
{ \
|
||||
__asm mov edx, p \
|
||||
__asm mov A, addend \
|
||||
__asm lock xadd [edx], A \
|
||||
__asm mov result, A \
|
||||
} \
|
||||
__TBB_release_consistency_helper(); \
|
||||
return result; \
|
||||
}\
|
||||
\
|
||||
static inline T __TBB_machine_fetchstore##S ( volatile void * ptr, U value ) { \
|
||||
T result; \
|
||||
volatile T *p = (T *)ptr; \
|
||||
__TBB_release_consistency_helper(); \
|
||||
__asm \
|
||||
{ \
|
||||
__asm mov edx, p \
|
||||
__asm mov A, value \
|
||||
__asm lock xchg [edx], A \
|
||||
__asm mov result, A \
|
||||
} \
|
||||
__TBB_release_consistency_helper(); \
|
||||
return result; \
|
||||
}
|
||||
|
||||
__TBB_DEFINE_ATOMICS(1, __int8, __int8, al, cl)
|
||||
__TBB_DEFINE_ATOMICS(2, __int16, __int16, ax, cx)
|
||||
__TBB_DEFINE_ATOMICS(4, __int32, ptrdiff_t, eax, ecx)
|
||||
|
||||
static inline __int32 __TBB_machine_lg( unsigned __int64 i ) {
|
||||
unsigned __int32 j;
|
||||
__asm
|
||||
{
|
||||
bsr eax, i
|
||||
mov j, eax
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_OR( volatile void *operand, __int32 addend ) {
|
||||
__asm
|
||||
{
|
||||
mov eax, addend
|
||||
mov edx, [operand]
|
||||
lock or [edx], eax
|
||||
}
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_AND( volatile void *operand, __int32 addend ) {
|
||||
__asm
|
||||
{
|
||||
mov eax, addend
|
||||
mov edx, [operand]
|
||||
lock and [edx], eax
|
||||
}
|
||||
}
|
||||
|
||||
static inline void __TBB_machine_pause (__int32 delay ) {
|
||||
_asm
|
||||
{
|
||||
mov eax, delay
|
||||
L1:
|
||||
pause
|
||||
add eax, -1
|
||||
jne L1
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C)
|
||||
#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C)
|
||||
#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C)
|
||||
#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C)
|
||||
#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C)
|
||||
|
||||
#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V)
|
||||
#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V)
|
||||
#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4(P,V)
|
||||
#define __TBB_FetchAndAdd8(P,V) __TBB_machine_fetchadd8(P,V)
|
||||
#define __TBB_FetchAndAddW(P,V) __TBB_machine_fetchadd4(P,V)
|
||||
|
||||
#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V)
|
||||
#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V)
|
||||
#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4(P,V)
|
||||
#define __TBB_FetchAndStore8(P,V) __TBB_machine_fetchstore8(P,V)
|
||||
#define __TBB_FetchAndStoreW(P,V) __TBB_machine_fetchstore4(P,V)
|
||||
|
||||
// Should define this:
|
||||
#define __TBB_Store8(P,V) __TBB_machine_store8(P,V)
|
||||
#define __TBB_Load8(P) __TBB_machine_load8(P)
|
||||
#define __TBB_AtomicOR(P,V) __TBB_machine_OR(P,V)
|
||||
#define __TBB_AtomicAND(P,V) __TBB_machine_AND(P,V)
|
||||
|
||||
// Definition of other functions
|
||||
extern "C" __declspec(dllimport) int __stdcall SwitchToThread( void );
|
||||
#define __TBB_Yield() SwitchToThread()
|
||||
#define __TBB_Pause(V) __TBB_machine_pause(V)
|
||||
#define __TBB_Log2(V) __TBB_machine_lg(V)
|
||||
|
||||
// Use generic definitions from tbb_machine.h
|
||||
#undef __TBB_TryLockByte
|
||||
#undef __TBB_LockByte
|
||||
|
||||
#if defined(_MSC_VER)&&_MSC_VER<1400
|
||||
static inline void* __TBB_machine_get_current_teb () {
|
||||
void* pteb;
|
||||
__asm mov eax, fs:[0x18]
|
||||
__asm mov pteb, eax
|
||||
return pteb;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||
#pragma warning (pop)
|
||||
#endif // warnings 4244, 4267 are back
|
||||
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_machine_H
|
||||
#error Do not include this file directly; include tbb_machine.h instead
|
||||
#endif
|
||||
|
||||
#include <intrin.h>
|
||||
#if !defined(__INTEL_COMPILER)
|
||||
#pragma intrinsic(_InterlockedOr64)
|
||||
#pragma intrinsic(_InterlockedAnd64)
|
||||
#pragma intrinsic(_InterlockedCompareExchange)
|
||||
#pragma intrinsic(_InterlockedCompareExchange64)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd64)
|
||||
#pragma intrinsic(_InterlockedExchange)
|
||||
#pragma intrinsic(_InterlockedExchange64)
|
||||
#endif /* !defined(__INTEL_COMPILER) */
|
||||
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define __TBB_release_consistency_helper() __asm { __asm nop }
|
||||
inline void __TBB_rel_acq_fence() { __asm { __asm mfence } }
|
||||
#elif _MSC_VER >= 1300
|
||||
extern "C" void _ReadWriteBarrier();
|
||||
#pragma intrinsic(_ReadWriteBarrier)
|
||||
#define __TBB_release_consistency_helper() _ReadWriteBarrier()
|
||||
#pragma intrinsic(_mm_mfence)
|
||||
inline void __TBB_rel_acq_fence() { _mm_mfence(); }
|
||||
#endif
|
||||
|
||||
#define __TBB_WORDSIZE 8
|
||||
#define __TBB_BIG_ENDIAN 0
|
||||
|
||||
// ATTENTION: if you ever change argument types in machine-specific primitives,
|
||||
// please take care of atomic_word<> specializations in tbb/atomic.h
|
||||
extern "C" {
|
||||
__int8 __TBB_EXPORTED_FUNC __TBB_machine_cmpswp1 (volatile void *ptr, __int8 value, __int8 comparand );
|
||||
__int8 __TBB_EXPORTED_FUNC __TBB_machine_fetchadd1 (volatile void *ptr, __int8 addend );
|
||||
__int8 __TBB_EXPORTED_FUNC __TBB_machine_fetchstore1 (volatile void *ptr, __int8 value );
|
||||
__int16 __TBB_EXPORTED_FUNC __TBB_machine_cmpswp2 (volatile void *ptr, __int16 value, __int16 comparand );
|
||||
__int16 __TBB_EXPORTED_FUNC __TBB_machine_fetchadd2 (volatile void *ptr, __int16 addend );
|
||||
__int16 __TBB_EXPORTED_FUNC __TBB_machine_fetchstore2 (volatile void *ptr, __int16 value );
|
||||
void __TBB_EXPORTED_FUNC __TBB_machine_pause (__int32 delay );
|
||||
}
|
||||
|
||||
|
||||
#if !__INTEL_COMPILER
|
||||
extern "C" unsigned char _BitScanReverse64( unsigned long* i, unsigned __int64 w );
|
||||
#pragma intrinsic(_BitScanReverse64)
|
||||
#endif
|
||||
|
||||
inline __int64 __TBB_machine_lg( unsigned __int64 i ) {
|
||||
#if __INTEL_COMPILER
|
||||
unsigned __int64 j;
|
||||
__asm
|
||||
{
|
||||
bsr rax, i
|
||||
mov j, rax
|
||||
}
|
||||
#else
|
||||
unsigned long j;
|
||||
_BitScanReverse64( &j, i );
|
||||
#endif
|
||||
return j;
|
||||
}
|
||||
|
||||
inline void __TBB_machine_OR( volatile void *operand, intptr_t addend ) {
|
||||
_InterlockedOr64((__int64*)operand, addend);
|
||||
}
|
||||
|
||||
inline void __TBB_machine_AND( volatile void *operand, intptr_t addend ) {
|
||||
_InterlockedAnd64((__int64*)operand, addend);
|
||||
}
|
||||
|
||||
#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C)
|
||||
#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C)
|
||||
#define __TBB_CompareAndSwap4(P,V,C) _InterlockedCompareExchange( (long*) P , V , C )
|
||||
#define __TBB_CompareAndSwap8(P,V,C) _InterlockedCompareExchange64( (__int64*) P , V , C )
|
||||
#define __TBB_CompareAndSwapW(P,V,C) _InterlockedCompareExchange64( (__int64*) P , V , C )
|
||||
|
||||
#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V)
|
||||
#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V)
|
||||
#define __TBB_FetchAndAdd4(P,V) _InterlockedExchangeAdd((long*) P , V )
|
||||
#define __TBB_FetchAndAdd8(P,V) _InterlockedExchangeAdd64((__int64*) P , V )
|
||||
#define __TBB_FetchAndAddW(P,V) _InterlockedExchangeAdd64((__int64*) P , V )
|
||||
|
||||
#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V)
|
||||
#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V)
|
||||
#define __TBB_FetchAndStore4(P,V) _InterlockedExchange((long*) P , V )
|
||||
#define __TBB_FetchAndStore8(P,V) _InterlockedExchange64((__int64*) P , V )
|
||||
#define __TBB_FetchAndStoreW(P,V) _InterlockedExchange64((__int64*) P , V )
|
||||
|
||||
// Not used if wordsize == 8
|
||||
#undef __TBB_Store8
|
||||
#undef __TBB_Load8
|
||||
|
||||
#define __TBB_AtomicOR(P,V) __TBB_machine_OR(P,V)
|
||||
#define __TBB_AtomicAND(P,V) __TBB_machine_AND(P,V)
|
||||
|
||||
extern "C" __declspec(dllimport) int __stdcall SwitchToThread( void );
|
||||
#define __TBB_Yield() SwitchToThread()
|
||||
#define __TBB_Pause(V) __TBB_machine_pause(V)
|
||||
#define __TBB_Log2(V) __TBB_machine_lg(V)
|
||||
|
||||
// Use generic definitions from tbb_machine.h
|
||||
#undef __TBB_TryLockByte
|
||||
#undef __TBB_LockByte
|
||||
|
|
@ -1,236 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_mutex_H
|
||||
#define __TBB_mutex_H
|
||||
|
||||
#if _WIN32||_WIN64
|
||||
#include <windows.h>
|
||||
#if !defined(_WIN32_WINNT)
|
||||
// The following Windows API function is declared explicitly;
|
||||
// otherwise any user would have to specify /D_WIN32_WINNT=0x0400
|
||||
extern "C" BOOL WINAPI TryEnterCriticalSection( LPCRITICAL_SECTION );
|
||||
#endif
|
||||
|
||||
#else /* if not _WIN32||_WIN64 */
|
||||
#include <pthread.h>
|
||||
namespace tbb { namespace internal {
|
||||
// Use this internal TBB function to throw an exception
|
||||
extern void handle_perror( int error_code, const char* what );
|
||||
} } //namespaces
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
|
||||
#include <new>
|
||||
#include "aligned_space.h"
|
||||
#include "tbb_stddef.h"
|
||||
#include "tbb_profiling.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! Wrapper around the platform's native reader-writer lock.
|
||||
/** For testing purposes only.
|
||||
@ingroup synchronization */
|
||||
class mutex {
|
||||
public:
|
||||
//! Construct unacquired mutex.
|
||||
mutex() {
|
||||
#if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS
|
||||
internal_construct();
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
InitializeCriticalSection(&impl);
|
||||
#else
|
||||
int error_code = pthread_mutex_init(&impl,NULL);
|
||||
if( error_code )
|
||||
tbb::internal::handle_perror(error_code,"mutex: pthread_mutex_init failed");
|
||||
#endif /* _WIN32||_WIN64*/
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
};
|
||||
|
||||
~mutex() {
|
||||
#if TBB_USE_ASSERT
|
||||
internal_destroy();
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
DeleteCriticalSection(&impl);
|
||||
#else
|
||||
pthread_mutex_destroy(&impl);
|
||||
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
};
|
||||
|
||||
class scoped_lock;
|
||||
friend class scoped_lock;
|
||||
|
||||
//! The scoped locking pattern
|
||||
/** It helps to avoid the common problem of forgetting to release lock.
|
||||
It also nicely provides the "node" for queuing locks. */
|
||||
class scoped_lock : internal::no_copy {
|
||||
public:
|
||||
//! Construct lock that has not acquired a mutex.
|
||||
scoped_lock() : my_mutex(NULL) {};
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
/** Upon entry, *this should not be in the "have acquired a mutex" state. */
|
||||
scoped_lock( mutex& mutex ) {
|
||||
acquire( mutex );
|
||||
}
|
||||
|
||||
//! Release lock (if lock is held).
|
||||
~scoped_lock() {
|
||||
if( my_mutex )
|
||||
release();
|
||||
}
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
void acquire( mutex& mutex ) {
|
||||
#if TBB_USE_ASSERT
|
||||
internal_acquire(mutex);
|
||||
#else
|
||||
mutex.lock();
|
||||
my_mutex = &mutex;
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Try acquire lock on given mutex.
|
||||
bool try_acquire( mutex& mutex ) {
|
||||
#if TBB_USE_ASSERT
|
||||
return internal_try_acquire (mutex);
|
||||
#else
|
||||
bool result = mutex.try_lock();
|
||||
if( result )
|
||||
my_mutex = &mutex;
|
||||
return result;
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Release lock
|
||||
void release() {
|
||||
#if TBB_USE_ASSERT
|
||||
internal_release ();
|
||||
#else
|
||||
my_mutex->unlock();
|
||||
my_mutex = NULL;
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
private:
|
||||
//! The pointer to the current mutex to work
|
||||
mutex* my_mutex;
|
||||
|
||||
//! All checks from acquire using mutex.state were moved here
|
||||
void __TBB_EXPORTED_METHOD internal_acquire( mutex& m );
|
||||
|
||||
//! All checks from try_acquire using mutex.state were moved here
|
||||
bool __TBB_EXPORTED_METHOD internal_try_acquire( mutex& m );
|
||||
|
||||
//! All checks from release using mutex.state were moved here
|
||||
void __TBB_EXPORTED_METHOD internal_release();
|
||||
|
||||
friend class mutex;
|
||||
};
|
||||
|
||||
// Mutex traits
|
||||
static const bool is_rw_mutex = false;
|
||||
static const bool is_recursive_mutex = false;
|
||||
static const bool is_fair_mutex = false;
|
||||
|
||||
// ISO C++0x compatibility methods
|
||||
|
||||
//! Acquire lock
|
||||
void lock() {
|
||||
#if TBB_USE_ASSERT
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
new(tmp.begin()) scoped_lock(*this);
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
EnterCriticalSection(&impl);
|
||||
#else
|
||||
pthread_mutex_lock(&impl);
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Try acquiring lock (non-blocking)
|
||||
/** Return true if lock acquired; false otherwise. */
|
||||
bool try_lock() {
|
||||
#if TBB_USE_ASSERT
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
scoped_lock& s = *tmp.begin();
|
||||
s.my_mutex = NULL;
|
||||
return s.internal_try_acquire(*this);
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
return TryEnterCriticalSection(&impl)!=0;
|
||||
#else
|
||||
return pthread_mutex_trylock(&impl)==0;
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Release lock
|
||||
void unlock() {
|
||||
#if TBB_USE_ASSERT
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
scoped_lock& s = *tmp.begin();
|
||||
s.my_mutex = this;
|
||||
s.internal_release();
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
LeaveCriticalSection(&impl);
|
||||
#else
|
||||
pthread_mutex_unlock(&impl);
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
private:
|
||||
#if _WIN32||_WIN64
|
||||
CRITICAL_SECTION impl;
|
||||
enum state_t {
|
||||
INITIALIZED=0x1234,
|
||||
DESTROYED=0x789A,
|
||||
HELD=0x56CD
|
||||
} state;
|
||||
#else
|
||||
pthread_mutex_t impl;
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
|
||||
//! All checks from mutex constructor using mutex.state were moved here
|
||||
void __TBB_EXPORTED_METHOD internal_construct();
|
||||
|
||||
//! All checks from mutex destructor using mutex.state were moved here
|
||||
void __TBB_EXPORTED_METHOD internal_destroy();
|
||||
};
|
||||
|
||||
__TBB_DEFINE_PROFILING_SET_NAME(mutex)
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_mutex_H */
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_null_mutex_H
|
||||
#define __TBB_null_mutex_H
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! A mutex which does nothing
|
||||
/** A null_mutex does no operation and simulates success.
|
||||
@ingroup synchronization */
|
||||
class null_mutex {
|
||||
//! Deny assignment and copy construction
|
||||
null_mutex( const null_mutex& );
|
||||
void operator=( const null_mutex& );
|
||||
public:
|
||||
//! Represents acquisition of a mutex.
|
||||
class scoped_lock {
|
||||
public:
|
||||
scoped_lock() {}
|
||||
scoped_lock( null_mutex& ) {}
|
||||
~scoped_lock() {}
|
||||
void acquire( null_mutex& ) {}
|
||||
bool try_acquire( null_mutex& ) { return true; }
|
||||
void release() {}
|
||||
};
|
||||
|
||||
null_mutex() {}
|
||||
|
||||
// Mutex traits
|
||||
static const bool is_rw_mutex = false;
|
||||
static const bool is_recursive_mutex = true;
|
||||
static const bool is_fair_mutex = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* __TBB_null_mutex_H */
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_null_rw_mutex_H
|
||||
#define __TBB_null_rw_mutex_H
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! A rw mutex which does nothing
|
||||
/** A null_rw_mutex is a rw mutex that does nothing and simulates successful operation.
|
||||
@ingroup synchronization */
|
||||
class null_rw_mutex {
|
||||
//! Deny assignment and copy construction
|
||||
null_rw_mutex( const null_rw_mutex& );
|
||||
void operator=( const null_rw_mutex& );
|
||||
public:
|
||||
//! Represents acquisition of a mutex.
|
||||
class scoped_lock {
|
||||
public:
|
||||
scoped_lock() {}
|
||||
scoped_lock( null_rw_mutex& , bool = true ) {}
|
||||
~scoped_lock() {}
|
||||
void acquire( null_rw_mutex& , bool = true ) {}
|
||||
bool upgrade_to_writer() { return true; }
|
||||
bool downgrade_to_reader() { return true; }
|
||||
bool try_acquire( null_rw_mutex& , bool = true ) { return true; }
|
||||
void release() {}
|
||||
};
|
||||
|
||||
null_rw_mutex() {}
|
||||
|
||||
// Mutex traits
|
||||
static const bool is_rw_mutex = true;
|
||||
static const bool is_recursive_mutex = true;
|
||||
static const bool is_fair_mutex = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* __TBB_null_rw_mutex_H */
|
||||
|
|
@ -1,508 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_parallel_do_H
|
||||
#define __TBB_parallel_do_H
|
||||
|
||||
#include "task.h"
|
||||
#include "aligned_space.h"
|
||||
#include <iterator>
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
template<typename Body, typename Item> class parallel_do_feeder_impl;
|
||||
template<typename Body> class do_group_task;
|
||||
|
||||
//! Strips its template type argument from 'cv' and '&' qualifiers
|
||||
template<typename T>
|
||||
struct strip { typedef T type; };
|
||||
template<typename T>
|
||||
struct strip<T&> { typedef T type; };
|
||||
template<typename T>
|
||||
struct strip<const T&> { typedef T type; };
|
||||
template<typename T>
|
||||
struct strip<volatile T&> { typedef T type; };
|
||||
template<typename T>
|
||||
struct strip<const volatile T&> { typedef T type; };
|
||||
// Most of the compilers remove cv-qualifiers from non-reference function argument types.
|
||||
// But unfortunately there are those that don't.
|
||||
template<typename T>
|
||||
struct strip<const T> { typedef T type; };
|
||||
template<typename T>
|
||||
struct strip<volatile T> { typedef T type; };
|
||||
template<typename T>
|
||||
struct strip<const volatile T> { typedef T type; };
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
//! Class the user supplied algorithm body uses to add new tasks
|
||||
/** \param Item Work item type **/
|
||||
template<typename Item>
|
||||
class parallel_do_feeder: internal::no_copy
|
||||
{
|
||||
parallel_do_feeder() {}
|
||||
virtual ~parallel_do_feeder () {}
|
||||
virtual void internal_add( const Item& item ) = 0;
|
||||
template<typename Body_, typename Item_> friend class internal::parallel_do_feeder_impl;
|
||||
public:
|
||||
//! Add a work item to a running parallel_do.
|
||||
void add( const Item& item ) {internal_add(item);}
|
||||
};
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
//! For internal use only.
|
||||
/** Selects one of the two possible forms of function call member operator.
|
||||
@ingroup algorithms **/
|
||||
template<class Body, typename Item>
|
||||
class parallel_do_operator_selector
|
||||
{
|
||||
typedef parallel_do_feeder<Item> Feeder;
|
||||
template<typename A1, typename A2, typename CvItem >
|
||||
static void internal_call( const Body& obj, A1& arg1, A2&, void (Body::*)(CvItem) const ) {
|
||||
obj(arg1);
|
||||
}
|
||||
template<typename A1, typename A2, typename CvItem >
|
||||
static void internal_call( const Body& obj, A1& arg1, A2& arg2, void (Body::*)(CvItem, parallel_do_feeder<Item>&) const ) {
|
||||
obj(arg1, arg2);
|
||||
}
|
||||
|
||||
public:
|
||||
template<typename A1, typename A2 >
|
||||
static void call( const Body& obj, A1& arg1, A2& arg2 )
|
||||
{
|
||||
internal_call( obj, arg1, arg2, &Body::operator() );
|
||||
}
|
||||
};
|
||||
|
||||
//! For internal use only.
|
||||
/** Executes one iteration of a do.
|
||||
@ingroup algorithms */
|
||||
template<typename Body, typename Item>
|
||||
class do_iteration_task: public task
|
||||
{
|
||||
typedef parallel_do_feeder_impl<Body, Item> feeder_type;
|
||||
|
||||
Item my_value;
|
||||
feeder_type& my_feeder;
|
||||
|
||||
do_iteration_task( const Item& value, feeder_type& feeder ) :
|
||||
my_value(value), my_feeder(feeder)
|
||||
{}
|
||||
|
||||
/*override*/
|
||||
task* execute()
|
||||
{
|
||||
parallel_do_operator_selector<Body, Item>::call(*my_feeder.my_body, my_value, my_feeder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template<typename Body_, typename Item_> friend class parallel_do_feeder_impl;
|
||||
}; // class do_iteration_task
|
||||
|
||||
template<typename Iterator, typename Body, typename Item>
|
||||
class do_iteration_task_iter: public task
|
||||
{
|
||||
typedef parallel_do_feeder_impl<Body, Item> feeder_type;
|
||||
|
||||
Iterator my_iter;
|
||||
feeder_type& my_feeder;
|
||||
|
||||
do_iteration_task_iter( const Iterator& iter, feeder_type& feeder ) :
|
||||
my_iter(iter), my_feeder(feeder)
|
||||
{}
|
||||
|
||||
/*override*/
|
||||
task* execute()
|
||||
{
|
||||
parallel_do_operator_selector<Body, Item>::call(*my_feeder.my_body, *my_iter, my_feeder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template<typename Iterator_, typename Body_, typename Item_> friend class do_group_task_forward;
|
||||
template<typename Body_, typename Item_> friend class do_group_task_input;
|
||||
template<typename Iterator_, typename Body_, typename Item_> friend class do_task_iter;
|
||||
}; // class do_iteration_task_iter
|
||||
|
||||
//! For internal use only.
|
||||
/** Implements new task adding procedure.
|
||||
@ingroup algorithms **/
|
||||
template<class Body, typename Item>
|
||||
class parallel_do_feeder_impl : public parallel_do_feeder<Item>
|
||||
{
|
||||
/*override*/
|
||||
void internal_add( const Item& item )
|
||||
{
|
||||
typedef do_iteration_task<Body, Item> iteration_type;
|
||||
|
||||
iteration_type& t = *new (task::self().allocate_additional_child_of(*my_barrier)) iteration_type(item, *this);
|
||||
|
||||
t.spawn( t );
|
||||
}
|
||||
public:
|
||||
const Body* my_body;
|
||||
empty_task* my_barrier;
|
||||
|
||||
parallel_do_feeder_impl()
|
||||
{
|
||||
my_barrier = new( task::allocate_root() ) empty_task();
|
||||
__TBB_ASSERT(my_barrier, "root task allocation failed");
|
||||
}
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
parallel_do_feeder_impl(tbb::task_group_context &context)
|
||||
{
|
||||
my_barrier = new( task::allocate_root(context) ) empty_task();
|
||||
__TBB_ASSERT(my_barrier, "root task allocation failed");
|
||||
}
|
||||
#endif
|
||||
|
||||
~parallel_do_feeder_impl()
|
||||
{
|
||||
my_barrier->destroy(*my_barrier);
|
||||
}
|
||||
}; // class parallel_do_feeder_impl
|
||||
|
||||
|
||||
//! For internal use only
|
||||
/** Unpacks a block of iterations.
|
||||
@ingroup algorithms */
|
||||
|
||||
template<typename Iterator, typename Body, typename Item>
|
||||
class do_group_task_forward: public task
|
||||
{
|
||||
static const size_t max_arg_size = 4;
|
||||
|
||||
typedef parallel_do_feeder_impl<Body, Item> feeder_type;
|
||||
|
||||
feeder_type& my_feeder;
|
||||
Iterator my_first;
|
||||
size_t my_size;
|
||||
|
||||
do_group_task_forward( Iterator first, size_t size, feeder_type& feeder )
|
||||
: my_feeder(feeder), my_first(first), my_size(size)
|
||||
{}
|
||||
|
||||
/*override*/ task* execute()
|
||||
{
|
||||
typedef do_iteration_task_iter<Iterator, Body, Item> iteration_type;
|
||||
__TBB_ASSERT( my_size>0, NULL );
|
||||
task_list list;
|
||||
task* t;
|
||||
size_t k=0;
|
||||
for(;;) {
|
||||
t = new( allocate_child() ) iteration_type( my_first, my_feeder );
|
||||
++my_first;
|
||||
if( ++k==my_size ) break;
|
||||
list.push_back(*t);
|
||||
}
|
||||
set_ref_count(int(k+1));
|
||||
spawn(list);
|
||||
spawn_and_wait_for_all(*t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template<typename Iterator_, typename Body_, typename _Item> friend class do_task_iter;
|
||||
}; // class do_group_task_forward
|
||||
|
||||
template<typename Body, typename Item>
|
||||
class do_group_task_input: public task
|
||||
{
|
||||
static const size_t max_arg_size = 4;
|
||||
|
||||
typedef parallel_do_feeder_impl<Body, Item> feeder_type;
|
||||
|
||||
feeder_type& my_feeder;
|
||||
size_t my_size;
|
||||
aligned_space<Item, max_arg_size> my_arg;
|
||||
|
||||
do_group_task_input( feeder_type& feeder )
|
||||
: my_feeder(feeder), my_size(0)
|
||||
{}
|
||||
|
||||
/*override*/ task* execute()
|
||||
{
|
||||
typedef do_iteration_task_iter<Item*, Body, Item> iteration_type;
|
||||
__TBB_ASSERT( my_size>0, NULL );
|
||||
task_list list;
|
||||
task* t;
|
||||
size_t k=0;
|
||||
for(;;) {
|
||||
t = new( allocate_child() ) iteration_type( my_arg.begin() + k, my_feeder );
|
||||
if( ++k==my_size ) break;
|
||||
list.push_back(*t);
|
||||
}
|
||||
set_ref_count(int(k+1));
|
||||
spawn(list);
|
||||
spawn_and_wait_for_all(*t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
~do_group_task_input(){
|
||||
for( size_t k=0; k<my_size; ++k)
|
||||
(my_arg.begin() + k)->~Item();
|
||||
}
|
||||
|
||||
template<typename Iterator_, typename Body_, typename Item_> friend class do_task_iter;
|
||||
}; // class do_group_task_input
|
||||
|
||||
//! For internal use only.
|
||||
/** Gets block of iterations and packages them into a do_group_task.
|
||||
@ingroup algorithms */
|
||||
template<typename Iterator, typename Body, typename Item>
|
||||
class do_task_iter: public task
|
||||
{
|
||||
typedef parallel_do_feeder_impl<Body, Item> feeder_type;
|
||||
|
||||
public:
|
||||
do_task_iter( Iterator first, Iterator last , feeder_type& feeder ) :
|
||||
my_first(first), my_last(last), my_feeder(feeder)
|
||||
{}
|
||||
|
||||
private:
|
||||
Iterator my_first;
|
||||
Iterator my_last;
|
||||
feeder_type& my_feeder;
|
||||
|
||||
/* Do not merge run(xxx) and run_xxx() methods. They are separated in order
|
||||
to make sure that compilers will eliminate unused argument of type xxx
|
||||
(that is will not put it on stack). The sole purpose of this argument
|
||||
is overload resolution.
|
||||
|
||||
An alternative could be using template functions, but explicit specialization
|
||||
of member function templates is not supported for non specialized class
|
||||
templates. Besides template functions would always fall back to the least
|
||||
efficient variant (the one for input iterators) in case of iterators having
|
||||
custom tags derived from basic ones. */
|
||||
/*override*/ task* execute()
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::iterator_category iterator_tag;
|
||||
return run( (iterator_tag*)NULL );
|
||||
}
|
||||
|
||||
/** This is the most restricted variant that operates on input iterators or
|
||||
iterators with unknown tags (tags not derived from the standard ones). **/
|
||||
inline task* run( void* ) { return run_for_input_iterator(); }
|
||||
|
||||
task* run_for_input_iterator() {
|
||||
typedef do_group_task_input<Body, Item> block_type;
|
||||
|
||||
block_type& t = *new( allocate_additional_child_of(*my_feeder.my_barrier) ) block_type(my_feeder);
|
||||
size_t k=0;
|
||||
while( !(my_first == my_last) ) {
|
||||
new (t.my_arg.begin() + k) Item(*my_first);
|
||||
++my_first;
|
||||
if( ++k==block_type::max_arg_size ) {
|
||||
if ( !(my_first == my_last) )
|
||||
recycle_to_reexecute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( k==0 ) {
|
||||
destroy(t);
|
||||
return NULL;
|
||||
} else {
|
||||
t.my_size = k;
|
||||
return &t;
|
||||
}
|
||||
}
|
||||
|
||||
inline task* run( std::forward_iterator_tag* ) { return run_for_forward_iterator(); }
|
||||
|
||||
task* run_for_forward_iterator() {
|
||||
typedef do_group_task_forward<Iterator, Body, Item> block_type;
|
||||
|
||||
Iterator first = my_first;
|
||||
size_t k=0;
|
||||
while( !(my_first==my_last) ) {
|
||||
++my_first;
|
||||
if( ++k==block_type::max_arg_size ) {
|
||||
if ( !(my_first==my_last) )
|
||||
recycle_to_reexecute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return k==0 ? NULL : new( allocate_additional_child_of(*my_feeder.my_barrier) ) block_type(first, k, my_feeder);
|
||||
}
|
||||
|
||||
inline task* run( std::random_access_iterator_tag* ) { return run_for_random_access_iterator(); }
|
||||
|
||||
task* run_for_random_access_iterator() {
|
||||
typedef do_group_task_forward<Iterator, Body, Item> block_type;
|
||||
typedef do_iteration_task_iter<Iterator, Body, Item> iteration_type;
|
||||
|
||||
size_t k = static_cast<size_t>(my_last-my_first);
|
||||
if( k > block_type::max_arg_size ) {
|
||||
Iterator middle = my_first + k/2;
|
||||
|
||||
empty_task& c = *new( allocate_continuation() ) empty_task;
|
||||
do_task_iter& b = *new( c.allocate_child() ) do_task_iter(middle, my_last, my_feeder);
|
||||
recycle_as_child_of(c);
|
||||
|
||||
my_last = middle;
|
||||
c.set_ref_count(2);
|
||||
c.spawn(b);
|
||||
return this;
|
||||
}else if( k != 0 ) {
|
||||
task_list list;
|
||||
task* t;
|
||||
size_t k1=0;
|
||||
for(;;) {
|
||||
t = new( allocate_child() ) iteration_type(my_first, my_feeder);
|
||||
++my_first;
|
||||
if( ++k1==k ) break;
|
||||
list.push_back(*t);
|
||||
}
|
||||
set_ref_count(int(k+1));
|
||||
spawn(list);
|
||||
spawn_and_wait_for_all(*t);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}; // class do_task_iter
|
||||
|
||||
//! For internal use only.
|
||||
/** Implements parallel iteration over a range.
|
||||
@ingroup algorithms */
|
||||
template<typename Iterator, typename Body, typename Item>
|
||||
void run_parallel_do( Iterator first, Iterator last, const Body& body
|
||||
#if __TBB_EXCEPTIONS
|
||||
, task_group_context& context
|
||||
#endif
|
||||
)
|
||||
{
|
||||
typedef do_task_iter<Iterator, Body, Item> root_iteration_task;
|
||||
#if __TBB_EXCEPTIONS
|
||||
parallel_do_feeder_impl<Body, Item> feeder(context);
|
||||
#else
|
||||
parallel_do_feeder_impl<Body, Item> feeder;
|
||||
#endif
|
||||
feeder.my_body = &body;
|
||||
|
||||
root_iteration_task &t = *new( feeder.my_barrier->allocate_child() ) root_iteration_task(first, last, feeder);
|
||||
|
||||
feeder.my_barrier->set_ref_count(2);
|
||||
feeder.my_barrier->spawn_and_wait_for_all(t);
|
||||
}
|
||||
|
||||
//! For internal use only.
|
||||
/** Detects types of Body's operator function arguments.
|
||||
@ingroup algorithms **/
|
||||
template<typename Iterator, typename Body, typename Item>
|
||||
void select_parallel_do( Iterator first, Iterator last, const Body& body, void (Body::*)(Item) const
|
||||
#if __TBB_EXCEPTIONS
|
||||
, task_group_context& context
|
||||
#endif // __TBB_EXCEPTIONS
|
||||
)
|
||||
{
|
||||
run_parallel_do<Iterator, Body, typename strip<Item>::type>( first, last, body
|
||||
#if __TBB_EXCEPTIONS
|
||||
, context
|
||||
#endif // __TBB_EXCEPTIONS
|
||||
);
|
||||
}
|
||||
|
||||
//! For internal use only.
|
||||
/** Detects types of Body's operator function arguments.
|
||||
@ingroup algorithms **/
|
||||
template<typename Iterator, typename Body, typename Item, typename _Item>
|
||||
void select_parallel_do( Iterator first, Iterator last, const Body& body, void (Body::*)(Item, parallel_do_feeder<_Item>&) const
|
||||
#if __TBB_EXCEPTIONS
|
||||
, task_group_context& context
|
||||
#endif // __TBB_EXCEPTIONS
|
||||
)
|
||||
{
|
||||
run_parallel_do<Iterator, Body, typename strip<Item>::type>( first, last, body
|
||||
#if __TBB_EXCEPTIONS
|
||||
, context
|
||||
#endif // __TBB_EXCEPTIONS
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
|
||||
/** \page parallel_do_body_req Requirements on parallel_do body
|
||||
Class \c Body implementing the concept of parallel_do body must define:
|
||||
- \code
|
||||
B::operator()(
|
||||
cv_item_type item,
|
||||
parallel_do_feeder<item_type>& feeder
|
||||
) const
|
||||
|
||||
OR
|
||||
|
||||
B::operator()( cv_item_type& item ) const
|
||||
\endcode Process item.
|
||||
May be invoked concurrently for the same \c this but different \c item.
|
||||
|
||||
- \code item_type( const item_type& ) \endcode
|
||||
Copy a work item.
|
||||
- \code ~item_type() \endcode Destroy a work item
|
||||
**/
|
||||
|
||||
/** \name parallel_do
|
||||
See also requirements on \ref parallel_do_body_req "parallel_do Body". **/
|
||||
//@{
|
||||
//! Parallel iteration over a range, with optional addition of more work.
|
||||
/** @ingroup algorithms */
|
||||
template<typename Iterator, typename Body>
|
||||
void parallel_do( Iterator first, Iterator last, const Body& body )
|
||||
{
|
||||
if ( first == last )
|
||||
return;
|
||||
#if __TBB_EXCEPTIONS
|
||||
task_group_context context;
|
||||
#endif // __TBB_EXCEPTIONS
|
||||
internal::select_parallel_do( first, last, body, &Body::operator()
|
||||
#if __TBB_EXCEPTIONS
|
||||
, context
|
||||
#endif // __TBB_EXCEPTIONS
|
||||
);
|
||||
}
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Parallel iteration over a range, with optional addition of more work and user-supplied context
|
||||
/** @ingroup algorithms */
|
||||
template<typename Iterator, typename Body>
|
||||
void parallel_do( Iterator first, Iterator last, const Body& body, task_group_context& context )
|
||||
{
|
||||
if ( first == last )
|
||||
return;
|
||||
internal::select_parallel_do( first, last, body, &Body::operator(), context );
|
||||
}
|
||||
#endif // __TBB_EXCEPTIONS
|
||||
|
||||
//@}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif /* __TBB_parallel_do_H */
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_parallel_for_H
|
||||
#define __TBB_parallel_for_H
|
||||
|
||||
#include "task.h"
|
||||
#include "partitioner.h"
|
||||
#include "blocked_range.h"
|
||||
#include <new>
|
||||
#include <stdexcept> // std::invalid_argument
|
||||
#include <string> // std::invalid_argument text
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
//! Task type used in parallel_for
|
||||
/** @ingroup algorithms */
|
||||
template<typename Range, typename Body, typename Partitioner>
|
||||
class start_for: public task {
|
||||
Range my_range;
|
||||
const Body my_body;
|
||||
typename Partitioner::partition_type my_partition;
|
||||
/*override*/ task* execute();
|
||||
|
||||
//! Constructor for root task.
|
||||
start_for( const Range& range, const Body& body, Partitioner& partitioner ) :
|
||||
my_range(range),
|
||||
my_body(body),
|
||||
my_partition(partitioner)
|
||||
{
|
||||
}
|
||||
//! Splitting constructor used to generate children.
|
||||
/** this becomes left child. Newly constructed object is right child. */
|
||||
start_for( start_for& parent, split ) :
|
||||
my_range(parent.my_range,split()),
|
||||
my_body(parent.my_body),
|
||||
my_partition(parent.my_partition,split())
|
||||
{
|
||||
my_partition.set_affinity(*this);
|
||||
}
|
||||
//! Update affinity info, if any.
|
||||
/*override*/ void note_affinity( affinity_id id ) {
|
||||
my_partition.note_affinity( id );
|
||||
}
|
||||
public:
|
||||
static void run( const Range& range, const Body& body, const Partitioner& partitioner ) {
|
||||
if( !range.empty() ) {
|
||||
#if !__TBB_EXCEPTIONS || TBB_JOIN_OUTER_TASK_GROUP
|
||||
start_for& a = *new(task::allocate_root()) start_for(range,body,const_cast<Partitioner&>(partitioner));
|
||||
#else
|
||||
// Bound context prevents exceptions from body to affect nesting or sibling algorithms,
|
||||
// and allows users to handle exceptions safely by wrapping parallel_for in the try-block.
|
||||
task_group_context context;
|
||||
start_for& a = *new(task::allocate_root(context)) start_for(range,body,const_cast<Partitioner&>(partitioner));
|
||||
#endif /* __TBB_EXCEPTIONS && !TBB_JOIN_OUTER_TASK_GROUP */
|
||||
task::spawn_root_and_wait(a);
|
||||
}
|
||||
}
|
||||
#if __TBB_EXCEPTIONS
|
||||
static void run( const Range& range, const Body& body, const Partitioner& partitioner, task_group_context& context ) {
|
||||
if( !range.empty() ) {
|
||||
start_for& a = *new(task::allocate_root(context)) start_for(range,body,const_cast<Partitioner&>(partitioner));
|
||||
task::spawn_root_and_wait(a);
|
||||
}
|
||||
}
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
};
|
||||
|
||||
template<typename Range, typename Body, typename Partitioner>
|
||||
task* start_for<Range,Body,Partitioner>::execute() {
|
||||
if( !my_range.is_divisible() || my_partition.should_execute_range(*this) ) {
|
||||
my_body( my_range );
|
||||
return my_partition.continue_after_execute_range(*this);
|
||||
} else {
|
||||
empty_task& c = *new( this->allocate_continuation() ) empty_task;
|
||||
recycle_as_child_of(c);
|
||||
c.set_ref_count(2);
|
||||
bool delay = my_partition.decide_whether_to_delay();
|
||||
start_for& b = *new( c.allocate_child() ) start_for(*this,split());
|
||||
my_partition.spawn_or_delay(delay,*this,b);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
|
||||
// Requirements on Range concept are documented in blocked_range.h
|
||||
|
||||
/** \page parallel_for_body_req Requirements on parallel_for body
|
||||
Class \c Body implementing the concept of parallel_for body must define:
|
||||
- \code Body::Body( const Body& ); \endcode Copy constructor
|
||||
- \code Body::~Body(); \endcode Destructor
|
||||
- \code void Body::operator()( Range& r ) const; \endcode Function call operator applying the body to range \c r.
|
||||
**/
|
||||
|
||||
/** \name parallel_for
|
||||
See also requirements on \ref range_req "Range" and \ref parallel_for_body_req "parallel_for Body". **/
|
||||
//@{
|
||||
|
||||
//! Parallel iteration over range with default partitioner.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_for( const Range& range, const Body& body ) {
|
||||
internal::start_for<Range,Body,__TBB_DEFAULT_PARTITIONER>::run(range,body,__TBB_DEFAULT_PARTITIONER());
|
||||
}
|
||||
|
||||
//! Parallel iteration over range with simple partitioner.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_for( const Range& range, const Body& body, const simple_partitioner& partitioner ) {
|
||||
internal::start_for<Range,Body,simple_partitioner>::run(range,body,partitioner);
|
||||
}
|
||||
|
||||
//! Parallel iteration over range with auto_partitioner.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_for( const Range& range, const Body& body, const auto_partitioner& partitioner ) {
|
||||
internal::start_for<Range,Body,auto_partitioner>::run(range,body,partitioner);
|
||||
}
|
||||
|
||||
//! Parallel iteration over range with affinity_partitioner.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_for( const Range& range, const Body& body, affinity_partitioner& partitioner ) {
|
||||
internal::start_for<Range,Body,affinity_partitioner>::run(range,body,partitioner);
|
||||
}
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Parallel iteration over range with simple partitioner and user-supplied context.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_for( const Range& range, const Body& body, const simple_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::start_for<Range,Body,simple_partitioner>::run(range, body, partitioner, context);
|
||||
}
|
||||
|
||||
//! Parallel iteration over range with auto_partitioner and user-supplied context.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_for( const Range& range, const Body& body, const auto_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::start_for<Range,Body,auto_partitioner>::run(range, body, partitioner, context);
|
||||
}
|
||||
|
||||
//! Parallel iteration over range with affinity_partitioner and user-supplied context.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_for( const Range& range, const Body& body, affinity_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::start_for<Range,Body,affinity_partitioner>::run(range,body,partitioner, context);
|
||||
}
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
//@}
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
//! Calls the function with values from range [begin, end) with a step provided
|
||||
template<typename Function, typename Index>
|
||||
class parallel_for_body : internal::no_assign {
|
||||
const Function &my_func;
|
||||
const Index my_begin;
|
||||
const Index my_step;
|
||||
public:
|
||||
parallel_for_body( const Function& _func, Index& _begin, Index& _step)
|
||||
: my_func(_func), my_begin(_begin), my_step(_step) {}
|
||||
|
||||
void operator()( tbb::blocked_range<Index>& r ) const {
|
||||
for( Index i = r.begin(), k = my_begin + i * my_step; i < r.end(); i++, k = k + my_step)
|
||||
my_func( k );
|
||||
}
|
||||
};
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
namespace strict_ppl {
|
||||
|
||||
//@{
|
||||
//! Parallel iteration over a range of integers with a step provided
|
||||
template <typename Index, typename Function>
|
||||
void parallel_for(Index first, Index last, Index step, const Function& f) {
|
||||
tbb::task_group_context context;
|
||||
parallel_for(first, last, step, f, context);
|
||||
}
|
||||
template <typename Index, typename Function>
|
||||
void parallel_for(Index first, Index last, Index step, const Function& f, tbb::task_group_context &context) {
|
||||
if (step <= 0 ) throw std::invalid_argument("step should be positive");
|
||||
|
||||
if (last > first) {
|
||||
Index end = (last - first) / step;
|
||||
if (first + end * step < last) end++;
|
||||
tbb::blocked_range<Index> range(static_cast<Index>(0), end);
|
||||
internal::parallel_for_body<Function, Index> body(f, first, step);
|
||||
tbb::parallel_for(range, body, tbb::auto_partitioner(), context);
|
||||
}
|
||||
}
|
||||
//! Parallel iteration over a range of integers with a default step value
|
||||
template <typename Index, typename Function>
|
||||
void parallel_for(Index first, Index last, const Function& f) {
|
||||
tbb::task_group_context context;
|
||||
parallel_for(first, last, static_cast<Index>(1), f, context);
|
||||
}
|
||||
template <typename Index, typename Function>
|
||||
void parallel_for(Index first, Index last, const Function& f, tbb::task_group_context &context) {
|
||||
parallel_for(first, last, static_cast<Index>(1), f, context);
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
} // namespace strict_ppl
|
||||
|
||||
using strict_ppl::parallel_for;
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_parallel_for_H */
|
||||
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_parallel_for_each_H
|
||||
#define __TBB_parallel_for_each_H
|
||||
|
||||
#include "parallel_do.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
// The class calls user function in operator()
|
||||
template <typename Function, typename Iterator>
|
||||
class parallel_for_each_body : internal::no_assign {
|
||||
Function &my_func;
|
||||
public:
|
||||
parallel_for_each_body(Function &_func) : my_func(_func) {}
|
||||
parallel_for_each_body(const parallel_for_each_body<Function, Iterator> &_caller) : my_func(_caller.my_func) {}
|
||||
|
||||
void operator() ( typename std::iterator_traits<Iterator>::value_type value ) const {
|
||||
my_func(value);
|
||||
}
|
||||
};
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
/** \name parallel_for_each
|
||||
**/
|
||||
//@{
|
||||
//! Calls function f for all items from [first, last) interval using user-supplied context
|
||||
/** @ingroup algorithms */
|
||||
template<typename InputIterator, typename Function>
|
||||
Function parallel_for_each(InputIterator first, InputIterator last, Function f, task_group_context &context) {
|
||||
internal::parallel_for_each_body<Function, InputIterator> body(f);
|
||||
|
||||
tbb::parallel_do (first, last, body, context);
|
||||
return f;
|
||||
}
|
||||
|
||||
//! Uses default context
|
||||
template<typename InputIterator, typename Function>
|
||||
Function parallel_for_each(InputIterator first, InputIterator last, Function f) {
|
||||
internal::parallel_for_each_body<Function, InputIterator> body(f);
|
||||
|
||||
tbb::parallel_do (first, last, body);
|
||||
return f;
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif /* __TBB_parallel_for_each_H */
|
||||
|
|
@ -1,333 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_parallel_invoke_H
|
||||
#define __TBB_parallel_invoke_H
|
||||
|
||||
#include "task.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
// Simple task object, executing user method
|
||||
template<typename function>
|
||||
class function_invoker : public task{
|
||||
public:
|
||||
function_invoker(function& _function) : my_function(_function) {}
|
||||
private:
|
||||
function &my_function;
|
||||
/*override*/
|
||||
task* execute()
|
||||
{
|
||||
my_function();
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
// The class spawns two or three child tasks
|
||||
template <size_t N, typename function1, typename function2, typename function3>
|
||||
class spawner : public task {
|
||||
private:
|
||||
function1& my_func1;
|
||||
function2& my_func2;
|
||||
function3& my_func3;
|
||||
bool is_recycled;
|
||||
|
||||
task* execute (){
|
||||
if(is_recycled){
|
||||
return NULL;
|
||||
}else{
|
||||
__TBB_ASSERT(N==2 || N==3, "Number of arguments passed to spawner is wrong");
|
||||
set_ref_count(N);
|
||||
recycle_as_safe_continuation();
|
||||
internal::function_invoker<function2>* invoker2 = new (allocate_child()) internal::function_invoker<function2>(my_func2);
|
||||
__TBB_ASSERT(invoker2, "Child task allocation failed");
|
||||
spawn(*invoker2);
|
||||
size_t n = N; // To prevent compiler warnings
|
||||
if (n>2) {
|
||||
internal::function_invoker<function3>* invoker3 = new (allocate_child()) internal::function_invoker<function3>(my_func3);
|
||||
__TBB_ASSERT(invoker3, "Child task allocation failed");
|
||||
spawn(*invoker3);
|
||||
}
|
||||
my_func1();
|
||||
is_recycled = true;
|
||||
return NULL;
|
||||
}
|
||||
} // execute
|
||||
|
||||
public:
|
||||
spawner(function1& _func1, function2& _func2, function3& _func3) : my_func1(_func1), my_func2(_func2), my_func3(_func3), is_recycled(false) {}
|
||||
};
|
||||
|
||||
// Creates and spawns child tasks
|
||||
class parallel_invoke_helper : public empty_task {
|
||||
public:
|
||||
// Dummy functor class
|
||||
class parallel_invoke_noop {
|
||||
public:
|
||||
void operator() () const {}
|
||||
};
|
||||
// Creates a helper object with user-defined number of children expected
|
||||
parallel_invoke_helper(int number_of_children)
|
||||
{
|
||||
set_ref_count(number_of_children + 1);
|
||||
}
|
||||
// Adds child task and spawns it
|
||||
template <typename function>
|
||||
void add_child (function &_func)
|
||||
{
|
||||
internal::function_invoker<function>* invoker = new (allocate_child()) internal::function_invoker<function>(_func);
|
||||
__TBB_ASSERT(invoker, "Child task allocation failed");
|
||||
spawn(*invoker);
|
||||
}
|
||||
|
||||
// Adds a task with multiple child tasks and spawns it
|
||||
// two arguments
|
||||
template <typename function1, typename function2>
|
||||
void add_children (function1& _func1, function2& _func2)
|
||||
{
|
||||
// The third argument is dummy, it is ignored actually.
|
||||
parallel_invoke_noop noop;
|
||||
internal::spawner<2, function1, function2, parallel_invoke_noop>& sub_root = *new(allocate_child())internal::spawner<2, function1, function2, parallel_invoke_noop>(_func1, _func2, noop);
|
||||
spawn(sub_root);
|
||||
}
|
||||
// three arguments
|
||||
template <typename function1, typename function2, typename function3>
|
||||
void add_children (function1& _func1, function2& _func2, function3& _func3)
|
||||
{
|
||||
internal::spawner<3, function1, function2, function3>& sub_root = *new(allocate_child())internal::spawner<3, function1, function2, function3>(_func1, _func2, _func3);
|
||||
spawn(sub_root);
|
||||
}
|
||||
|
||||
// Waits for all child tasks
|
||||
template <typename F0>
|
||||
void run_and_finish(F0& f0)
|
||||
{
|
||||
internal::function_invoker<F0>* invoker = new (allocate_child()) internal::function_invoker<F0>(f0);
|
||||
__TBB_ASSERT(invoker, "Child task allocation failed");
|
||||
spawn_and_wait_for_all(*invoker);
|
||||
}
|
||||
};
|
||||
// The class destroys root if exception occured as well as in normal case
|
||||
class parallel_invoke_cleaner: internal::no_copy {
|
||||
public:
|
||||
parallel_invoke_cleaner(int number_of_children, tbb::task_group_context& context) : root(*new(task::allocate_root(context)) internal::parallel_invoke_helper(number_of_children))
|
||||
{}
|
||||
~parallel_invoke_cleaner(){
|
||||
root.destroy(root);
|
||||
}
|
||||
internal::parallel_invoke_helper& root;
|
||||
};
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
/** \name parallel_invoke
|
||||
**/
|
||||
//@{
|
||||
//! Executes a list of tasks in parallel and waits for all tasks to complete.
|
||||
/** @ingroup algorithms */
|
||||
|
||||
// parallel_invoke with user-defined context
|
||||
// two arguments
|
||||
template<typename F0, typename F1 >
|
||||
void parallel_invoke(F0 f0, F1 f1, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(2, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_child(f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// three arguments
|
||||
template<typename F0, typename F1, typename F2 >
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(3, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_child(f2);
|
||||
root.add_child(f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// four arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(4, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_child(f3);
|
||||
root.add_child(f2);
|
||||
root.add_child(f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// five arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4 >
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(3, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_children(f4, f3);
|
||||
root.add_children(f2, f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// six arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5 >
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(3, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_children(f5, f4, f3);
|
||||
root.add_children(f2, f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// seven arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6 >
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, F6 f6, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(3, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_children(f6, f5, f4);
|
||||
root.add_children(f3, f2, f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// eight arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
|
||||
typename F7>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, F6 f6, F7 f7, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(4, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_children(f7, f6, f5);
|
||||
root.add_children(f4, f3);
|
||||
root.add_children(f2, f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// nine arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
|
||||
typename F7, typename F8>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, F6 f6, F7 f7, F8 f8, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(4, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_children(f8, f7, f6);
|
||||
root.add_children(f5, f4, f3);
|
||||
root.add_children(f2, f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// ten arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
|
||||
typename F7, typename F8, typename F9>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, F6 f6, F7 f7, F8 f8, F9 f9, tbb::task_group_context& context) {
|
||||
internal::parallel_invoke_cleaner cleaner(4, context);
|
||||
internal::parallel_invoke_helper& root = cleaner.root;
|
||||
|
||||
root.add_children(f9, f8, f7);
|
||||
root.add_children(f6, f5, f4);
|
||||
root.add_children(f3, f2, f1);
|
||||
|
||||
root.run_and_finish(f0);
|
||||
}
|
||||
|
||||
// two arguments
|
||||
template<typename F0, typename F1>
|
||||
void parallel_invoke(F0 f0, F1 f1) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1>(f0, f1, context);
|
||||
}
|
||||
// three arguments
|
||||
template<typename F0, typename F1, typename F2>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1, F2>(f0, f1, f2, context);
|
||||
}
|
||||
// four arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3 >
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1, F2, F3>(f0, f1, f2, f3, context);
|
||||
}
|
||||
// five arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1, F2, F3, F4>(f0, f1, f2, f3, f4, context);
|
||||
}
|
||||
// six arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1, F2, F3, F4, F5>(f0, f1, f2, f3, f4, f5, context);
|
||||
}
|
||||
// seven arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, F6 f6) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1, F2, F3, F4, F5, F6>(f0, f1, f2, f3, f4, f5, f6, context);
|
||||
}
|
||||
// eigth arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
|
||||
typename F7>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, F6 f6, F7 f7) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7>(f0, f1, f2, f3, f4, f5, f6, f7, context);
|
||||
}
|
||||
// nine arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
|
||||
typename F7, typename F8>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, F6 f6, F7 f7, F8 f8) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7, F8>(f0, f1, f2, f3, f4, f5, f6, f7, f8, context);
|
||||
}
|
||||
// ten arguments
|
||||
template<typename F0, typename F1, typename F2, typename F3, typename F4, typename F5, typename F6,
|
||||
typename F7, typename F8, typename F9>
|
||||
void parallel_invoke(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, F6 f6, F7 f7, F8 f8, F9 f9) {
|
||||
task_group_context context;
|
||||
parallel_invoke<F0, F1, F2, F3, F4, F5, F6, F7, F8, F9>(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, context);
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif /* __TBB_parallel_invoke_H */
|
||||
|
|
@ -1,387 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_parallel_reduce_H
|
||||
#define __TBB_parallel_reduce_H
|
||||
|
||||
#include "task.h"
|
||||
#include "aligned_space.h"
|
||||
#include "partitioner.h"
|
||||
#include <new>
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
//! ITT instrumented routine that stores src into location pointed to by dst.
|
||||
void __TBB_EXPORTED_FUNC itt_store_pointer_with_release_v3( void* dst, void* src );
|
||||
|
||||
//! ITT instrumented routine that loads pointer from location pointed to by src.
|
||||
void* __TBB_EXPORTED_FUNC itt_load_pointer_with_acquire_v3( const void* src );
|
||||
|
||||
template<typename T> inline void parallel_reduce_store_body( T*& dst, T* src ) {
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
itt_store_pointer_with_release_v3(&dst,src);
|
||||
#else
|
||||
__TBB_store_with_release(dst,src);
|
||||
#endif /* TBB_USE_THREADING_TOOLS */
|
||||
}
|
||||
|
||||
template<typename T> inline T* parallel_reduce_load_body( T*& src ) {
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
return static_cast<T*>(itt_load_pointer_with_acquire_v3(&src));
|
||||
#else
|
||||
return __TBB_load_with_acquire(src);
|
||||
#endif /* TBB_USE_THREADING_TOOLS */
|
||||
}
|
||||
|
||||
//! 0 if root, 1 if a left child, 2 if a right child.
|
||||
/** Represented as a char, not enum, for compactness. */
|
||||
typedef char reduction_context;
|
||||
|
||||
//! Task type use to combine the partial results of parallel_reduce with affinity_partitioner.
|
||||
/** @ingroup algorithms */
|
||||
template<typename Body>
|
||||
class finish_reduce: public task {
|
||||
//! Pointer to body, or NULL if the left child has not yet finished.
|
||||
Body* my_body;
|
||||
bool has_right_zombie;
|
||||
const reduction_context my_context;
|
||||
aligned_space<Body,1> zombie_space;
|
||||
finish_reduce( char context ) :
|
||||
my_body(NULL),
|
||||
has_right_zombie(false),
|
||||
my_context(context)
|
||||
{
|
||||
}
|
||||
task* execute() {
|
||||
if( has_right_zombie ) {
|
||||
// Right child was stolen.
|
||||
Body* s = zombie_space.begin();
|
||||
my_body->join( *s );
|
||||
s->~Body();
|
||||
}
|
||||
if( my_context==1 )
|
||||
parallel_reduce_store_body( static_cast<finish_reduce*>(parent())->my_body, my_body );
|
||||
return NULL;
|
||||
}
|
||||
template<typename Range,typename Body_, typename Partitioner>
|
||||
friend class start_reduce;
|
||||
};
|
||||
|
||||
//! Task type used to split the work of parallel_reduce with affinity_partitioner.
|
||||
/** @ingroup algorithms */
|
||||
template<typename Range, typename Body, typename Partitioner>
|
||||
class start_reduce: public task {
|
||||
typedef finish_reduce<Body> finish_type;
|
||||
Body* my_body;
|
||||
Range my_range;
|
||||
typename Partitioner::partition_type my_partition;
|
||||
reduction_context my_context;
|
||||
/*override*/ task* execute();
|
||||
template<typename Body_>
|
||||
friend class finish_reduce;
|
||||
|
||||
//! Constructor used for root task
|
||||
start_reduce( const Range& range, Body* body, Partitioner& partitioner ) :
|
||||
my_body(body),
|
||||
my_range(range),
|
||||
my_partition(partitioner),
|
||||
my_context(0)
|
||||
{
|
||||
}
|
||||
//! Splitting constructor used to generate children.
|
||||
/** this becomes left child. Newly constructed object is right child. */
|
||||
start_reduce( start_reduce& parent, split ) :
|
||||
my_body(parent.my_body),
|
||||
my_range(parent.my_range,split()),
|
||||
my_partition(parent.my_partition,split()),
|
||||
my_context(2)
|
||||
{
|
||||
my_partition.set_affinity(*this);
|
||||
parent.my_context = 1;
|
||||
}
|
||||
//! Update affinity info, if any
|
||||
/*override*/ void note_affinity( affinity_id id ) {
|
||||
my_partition.note_affinity( id );
|
||||
}
|
||||
|
||||
public:
|
||||
static void run( const Range& range, Body& body, Partitioner& partitioner ) {
|
||||
if( !range.empty() ) {
|
||||
#if !__TBB_EXCEPTIONS || TBB_JOIN_OUTER_TASK_GROUP
|
||||
task::spawn_root_and_wait( *new(task::allocate_root()) start_reduce(range,&body,partitioner) );
|
||||
#else
|
||||
// Bound context prevents exceptions from body to affect nesting or sibling algorithms,
|
||||
// and allows users to handle exceptions safely by wrapping parallel_for in the try-block.
|
||||
task_group_context context;
|
||||
task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce(range,&body,partitioner) );
|
||||
#endif /* __TBB_EXCEPTIONS && !TBB_JOIN_OUTER_TASK_GROUP */
|
||||
}
|
||||
}
|
||||
#if __TBB_EXCEPTIONS
|
||||
static void run( const Range& range, Body& body, Partitioner& partitioner, task_group_context& context ) {
|
||||
if( !range.empty() )
|
||||
task::spawn_root_and_wait( *new(task::allocate_root(context)) start_reduce(range,&body,partitioner) );
|
||||
}
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
};
|
||||
|
||||
template<typename Range, typename Body, typename Partitioner>
|
||||
task* start_reduce<Range,Body,Partitioner>::execute() {
|
||||
if( my_context==2 ) {
|
||||
finish_type* p = static_cast<finish_type*>(parent() );
|
||||
if( !parallel_reduce_load_body(p->my_body) ) {
|
||||
my_body = new( p->zombie_space.begin() ) Body(*my_body,split());
|
||||
p->has_right_zombie = true;
|
||||
}
|
||||
}
|
||||
if( !my_range.is_divisible() || my_partition.should_execute_range(*this) ) {
|
||||
(*my_body)( my_range );
|
||||
if( my_context==1 )
|
||||
parallel_reduce_store_body(static_cast<finish_type*>(parent())->my_body, my_body );
|
||||
return my_partition.continue_after_execute_range(*this);
|
||||
} else {
|
||||
finish_type& c = *new( allocate_continuation()) finish_type(my_context);
|
||||
recycle_as_child_of(c);
|
||||
c.set_ref_count(2);
|
||||
bool delay = my_partition.decide_whether_to_delay();
|
||||
start_reduce& b = *new( c.allocate_child() ) start_reduce(*this,split());
|
||||
my_partition.spawn_or_delay(delay,*this,b);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
//! Auxiliary class for parallel_reduce; for internal use only.
|
||||
/** The adaptor class that implements \ref parallel_reduce_body_req "parallel_reduce Body"
|
||||
using given \ref parallel_reduce_lambda_req "anonymous function objects".
|
||||
**/
|
||||
/** @ingroup algorithms */
|
||||
template<typename Range, typename Value, typename RealBody, typename Reduction>
|
||||
class lambda_reduce_body {
|
||||
|
||||
//FIXME: decide if my_real_body, my_reduction, and identity_element should be copied or referenced
|
||||
// (might require some performance measurements)
|
||||
|
||||
const Value& identity_element;
|
||||
const RealBody& my_real_body;
|
||||
const Reduction& my_reduction;
|
||||
Value my_value;
|
||||
lambda_reduce_body& operator= ( const lambda_reduce_body& other );
|
||||
public:
|
||||
lambda_reduce_body( const Value& identity, const RealBody& body, const Reduction& reduction )
|
||||
: identity_element(identity)
|
||||
, my_real_body(body)
|
||||
, my_reduction(reduction)
|
||||
, my_value(identity)
|
||||
{ }
|
||||
lambda_reduce_body( const lambda_reduce_body& other )
|
||||
: identity_element(other.identity_element)
|
||||
, my_real_body(other.my_real_body)
|
||||
, my_reduction(other.my_reduction)
|
||||
, my_value(other.my_value)
|
||||
{ }
|
||||
lambda_reduce_body( lambda_reduce_body& other, tbb::split )
|
||||
: identity_element(other.identity_element)
|
||||
, my_real_body(other.my_real_body)
|
||||
, my_reduction(other.my_reduction)
|
||||
, my_value(other.identity_element)
|
||||
{ }
|
||||
void operator()(Range& range) {
|
||||
my_value = my_real_body(range, const_cast<const Value&>(my_value));
|
||||
}
|
||||
void join( lambda_reduce_body& rhs ) {
|
||||
my_value = my_reduction(const_cast<const Value&>(my_value), const_cast<const Value&>(rhs.my_value));
|
||||
}
|
||||
Value result() const {
|
||||
return my_value;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
// Requirements on Range concept are documented in blocked_range.h
|
||||
|
||||
/** \page parallel_reduce_body_req Requirements on parallel_reduce body
|
||||
Class \c Body implementing the concept of parallel_reduce body must define:
|
||||
- \code Body::Body( Body&, split ); \endcode Splitting constructor.
|
||||
Must be able to run concurrently with operator() and method \c join
|
||||
- \code Body::~Body(); \endcode Destructor
|
||||
- \code void Body::operator()( Range& r ); \endcode Function call operator applying body to range \c r
|
||||
and accumulating the result
|
||||
- \code void Body::join( Body& b ); \endcode Join results.
|
||||
The result in \c b should be merged into the result of \c this
|
||||
**/
|
||||
|
||||
/** \page parallel_reduce_lambda_req Requirements on parallel_reduce anonymous function objects (lambda functions)
|
||||
TO BE DOCUMENTED
|
||||
**/
|
||||
|
||||
/** \name parallel_reduce
|
||||
See also requirements on \ref range_req "Range" and \ref parallel_reduce_body_req "parallel_reduce Body". **/
|
||||
//@{
|
||||
|
||||
//! Parallel iteration with reduction and default partitioner.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_reduce( const Range& range, Body& body ) {
|
||||
internal::start_reduce<Range,Body, const __TBB_DEFAULT_PARTITIONER>::run( range, body, __TBB_DEFAULT_PARTITIONER() );
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction and simple_partitioner
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_reduce( const Range& range, Body& body, const simple_partitioner& partitioner ) {
|
||||
internal::start_reduce<Range,Body,const simple_partitioner>::run( range, body, partitioner );
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction and auto_partitioner
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_reduce( const Range& range, Body& body, const auto_partitioner& partitioner ) {
|
||||
internal::start_reduce<Range,Body,const auto_partitioner>::run( range, body, partitioner );
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction and affinity_partitioner
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_reduce( const Range& range, Body& body, affinity_partitioner& partitioner ) {
|
||||
internal::start_reduce<Range,Body,affinity_partitioner>::run( range, body, partitioner );
|
||||
}
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Parallel iteration with reduction, simple partitioner and user-supplied context.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_reduce( const Range& range, Body& body, const simple_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::start_reduce<Range,Body,const simple_partitioner>::run( range, body, partitioner, context );
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction, auto_partitioner and user-supplied context
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_reduce( const Range& range, Body& body, const auto_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::start_reduce<Range,Body,const auto_partitioner>::run( range, body, partitioner, context );
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction, affinity_partitioner and user-supplied context
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_reduce( const Range& range, Body& body, affinity_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::start_reduce<Range,Body,affinity_partitioner>::run( range, body, partitioner, context );
|
||||
}
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
/** parallel_reduce overloads that work with anonymous function objects
|
||||
(see also \ref parallel_reduce_lambda_req "requirements on parallel_reduce anonymous function objects"). **/
|
||||
|
||||
//! Parallel iteration with reduction and default partitioner.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Value, typename RealBody, typename Reduction>
|
||||
Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction ) {
|
||||
internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
|
||||
internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,const __TBB_DEFAULT_PARTITIONER>
|
||||
::run(range, body, __TBB_DEFAULT_PARTITIONER() );
|
||||
return body.result();
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction and simple_partitioner.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Value, typename RealBody, typename Reduction>
|
||||
Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
|
||||
const simple_partitioner& partitioner ) {
|
||||
internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
|
||||
internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,const simple_partitioner>
|
||||
::run(range, body, partitioner );
|
||||
return body.result();
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction and auto_partitioner
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Value, typename RealBody, typename Reduction>
|
||||
Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
|
||||
const auto_partitioner& partitioner ) {
|
||||
internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
|
||||
internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,const auto_partitioner>
|
||||
::run( range, body, partitioner );
|
||||
return body.result();
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction and affinity_partitioner
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Value, typename RealBody, typename Reduction>
|
||||
Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
|
||||
affinity_partitioner& partitioner ) {
|
||||
internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
|
||||
internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,affinity_partitioner>
|
||||
::run( range, body, partitioner );
|
||||
return body.result();
|
||||
}
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Parallel iteration with reduction, simple partitioner and user-supplied context.
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Value, typename RealBody, typename Reduction>
|
||||
Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
|
||||
const simple_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
|
||||
internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,const simple_partitioner>
|
||||
::run( range, body, partitioner, context );
|
||||
return body.result();
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction, auto_partitioner and user-supplied context
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Value, typename RealBody, typename Reduction>
|
||||
Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
|
||||
const auto_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
|
||||
internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,const auto_partitioner>
|
||||
::run( range, body, partitioner, context );
|
||||
return body.result();
|
||||
}
|
||||
|
||||
//! Parallel iteration with reduction, affinity_partitioner and user-supplied context
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Value, typename RealBody, typename Reduction>
|
||||
Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction,
|
||||
affinity_partitioner& partitioner, task_group_context& context ) {
|
||||
internal::lambda_reduce_body<Range,Value,RealBody,Reduction> body(identity, real_body, reduction);
|
||||
internal::start_reduce<Range,internal::lambda_reduce_body<Range,Value,RealBody,Reduction>,affinity_partitioner>
|
||||
::run( range, body, partitioner, context );
|
||||
return body.result();
|
||||
}
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
//@}
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_parallel_reduce_H */
|
||||
|
||||
|
|
@ -1,351 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_parallel_scan_H
|
||||
#define __TBB_parallel_scan_H
|
||||
|
||||
#include "task.h"
|
||||
#include "aligned_space.h"
|
||||
#include <new>
|
||||
#include "partitioner.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! Used to indicate that the initial scan is being performed.
|
||||
/** @ingroup algorithms */
|
||||
struct pre_scan_tag {
|
||||
static bool is_final_scan() {return false;}
|
||||
};
|
||||
|
||||
//! Used to indicate that the final scan is being performed.
|
||||
/** @ingroup algorithms */
|
||||
struct final_scan_tag {
|
||||
static bool is_final_scan() {return true;}
|
||||
};
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
//! Performs final scan for a leaf
|
||||
/** @ingroup algorithms */
|
||||
template<typename Range, typename Body>
|
||||
class final_sum: public task {
|
||||
public:
|
||||
Body body;
|
||||
private:
|
||||
aligned_space<Range,1> range;
|
||||
//! Where to put result of last subrange, or NULL if not last subrange.
|
||||
Body* stuff_last;
|
||||
public:
|
||||
final_sum( Body& body_ ) :
|
||||
body(body_,split())
|
||||
{
|
||||
poison_pointer(stuff_last);
|
||||
}
|
||||
~final_sum() {
|
||||
range.begin()->~Range();
|
||||
}
|
||||
void finish_construction( const Range& range_, Body* stuff_last_ ) {
|
||||
new( range.begin() ) Range(range_);
|
||||
stuff_last = stuff_last_;
|
||||
}
|
||||
private:
|
||||
/*override*/ task* execute() {
|
||||
body( *range.begin(), final_scan_tag() );
|
||||
if( stuff_last )
|
||||
stuff_last->assign(body);
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
//! Split work to be done in the scan.
|
||||
/** @ingroup algorithms */
|
||||
template<typename Range, typename Body>
|
||||
class sum_node: public task {
|
||||
typedef final_sum<Range,Body> final_sum_type;
|
||||
public:
|
||||
final_sum_type *incoming;
|
||||
final_sum_type *body;
|
||||
Body *stuff_last;
|
||||
private:
|
||||
final_sum_type *left_sum;
|
||||
sum_node *left;
|
||||
sum_node *right;
|
||||
bool left_is_final;
|
||||
Range range;
|
||||
sum_node( const Range range_, bool left_is_final_ ) :
|
||||
left_sum(NULL),
|
||||
left(NULL),
|
||||
right(NULL),
|
||||
left_is_final(left_is_final_),
|
||||
range(range_)
|
||||
{
|
||||
// Poison fields that will be set by second pass.
|
||||
poison_pointer(body);
|
||||
poison_pointer(incoming);
|
||||
}
|
||||
task* create_child( const Range& range, final_sum_type& f, sum_node* n, final_sum_type* incoming, Body* stuff_last ) {
|
||||
if( !n ) {
|
||||
f.recycle_as_child_of( *this );
|
||||
f.finish_construction( range, stuff_last );
|
||||
return &f;
|
||||
} else {
|
||||
n->body = &f;
|
||||
n->incoming = incoming;
|
||||
n->stuff_last = stuff_last;
|
||||
return n;
|
||||
}
|
||||
}
|
||||
/*override*/ task* execute() {
|
||||
if( body ) {
|
||||
if( incoming )
|
||||
left_sum->body.reverse_join( incoming->body );
|
||||
recycle_as_continuation();
|
||||
sum_node& c = *this;
|
||||
task* b = c.create_child(Range(range,split()),*left_sum,right,left_sum,stuff_last);
|
||||
task* a = left_is_final ? NULL : c.create_child(range,*body,left,incoming,NULL);
|
||||
set_ref_count( (a!=NULL)+(b!=NULL) );
|
||||
body = NULL;
|
||||
if( a ) spawn(*b);
|
||||
else a = b;
|
||||
return a;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
template<typename Range_,typename Body_,typename Partitioner_>
|
||||
friend class start_scan;
|
||||
|
||||
template<typename Range_,typename Body_>
|
||||
friend class finish_scan;
|
||||
};
|
||||
|
||||
//! Combine partial results
|
||||
/** @ingroup algorithms */
|
||||
template<typename Range, typename Body>
|
||||
class finish_scan: public task {
|
||||
typedef sum_node<Range,Body> sum_node_type;
|
||||
typedef final_sum<Range,Body> final_sum_type;
|
||||
final_sum_type** const sum;
|
||||
sum_node_type*& return_slot;
|
||||
public:
|
||||
final_sum_type* right_zombie;
|
||||
sum_node_type& result;
|
||||
|
||||
/*override*/ task* execute() {
|
||||
__TBB_ASSERT( result.ref_count()==(result.left!=NULL)+(result.right!=NULL), NULL );
|
||||
if( result.left )
|
||||
result.left_is_final = false;
|
||||
if( right_zombie && sum )
|
||||
((*sum)->body).reverse_join(result.left_sum->body);
|
||||
__TBB_ASSERT( !return_slot, NULL );
|
||||
if( right_zombie || result.right ) {
|
||||
return_slot = &result;
|
||||
} else {
|
||||
destroy( result );
|
||||
}
|
||||
if( right_zombie && !sum && !result.right ) destroy(*right_zombie);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
finish_scan( sum_node_type*& return_slot_, final_sum_type** sum_, sum_node_type& result_ ) :
|
||||
sum(sum_),
|
||||
return_slot(return_slot_),
|
||||
right_zombie(NULL),
|
||||
result(result_)
|
||||
{
|
||||
__TBB_ASSERT( !return_slot, NULL );
|
||||
}
|
||||
};
|
||||
|
||||
//! Initial task to split the work
|
||||
/** @ingroup algorithms */
|
||||
template<typename Range, typename Body, typename Partitioner=simple_partitioner>
|
||||
class start_scan: public task {
|
||||
typedef sum_node<Range,Body> sum_node_type;
|
||||
typedef final_sum<Range,Body> final_sum_type;
|
||||
final_sum_type* body;
|
||||
/** Non-null if caller is requesting total. */
|
||||
final_sum_type** sum;
|
||||
sum_node_type** return_slot;
|
||||
/** Null if computing root. */
|
||||
sum_node_type* parent_sum;
|
||||
bool is_final;
|
||||
bool is_right_child;
|
||||
Range range;
|
||||
typename Partitioner::partition_type partition;
|
||||
/*override*/ task* execute();
|
||||
public:
|
||||
start_scan( sum_node_type*& return_slot_, start_scan& parent, sum_node_type* parent_sum_ ) :
|
||||
body(parent.body),
|
||||
sum(parent.sum),
|
||||
return_slot(&return_slot_),
|
||||
parent_sum(parent_sum_),
|
||||
is_final(parent.is_final),
|
||||
is_right_child(false),
|
||||
range(parent.range,split()),
|
||||
partition(parent.partition,split())
|
||||
{
|
||||
__TBB_ASSERT( !*return_slot, NULL );
|
||||
}
|
||||
|
||||
start_scan( sum_node_type*& return_slot_, const Range& range_, final_sum_type& body_, const Partitioner& partitioner_) :
|
||||
body(&body_),
|
||||
sum(NULL),
|
||||
return_slot(&return_slot_),
|
||||
parent_sum(NULL),
|
||||
is_final(true),
|
||||
is_right_child(false),
|
||||
range(range_),
|
||||
partition(partitioner_)
|
||||
{
|
||||
__TBB_ASSERT( !*return_slot, NULL );
|
||||
}
|
||||
|
||||
static void run( const Range& range, Body& body, const Partitioner& partitioner ) {
|
||||
if( !range.empty() ) {
|
||||
typedef internal::start_scan<Range,Body,Partitioner> start_pass1_type;
|
||||
internal::sum_node<Range,Body>* root = NULL;
|
||||
typedef internal::final_sum<Range,Body> final_sum_type;
|
||||
final_sum_type* temp_body = new(task::allocate_root()) final_sum_type( body );
|
||||
start_pass1_type& pass1 = *new(task::allocate_root()) start_pass1_type(
|
||||
/*return_slot=*/root,
|
||||
range,
|
||||
*temp_body,
|
||||
partitioner );
|
||||
task::spawn_root_and_wait( pass1 );
|
||||
if( root ) {
|
||||
root->body = temp_body;
|
||||
root->incoming = NULL;
|
||||
root->stuff_last = &body;
|
||||
task::spawn_root_and_wait( *root );
|
||||
} else {
|
||||
body.assign(temp_body->body);
|
||||
temp_body->finish_construction( range, NULL );
|
||||
temp_body->destroy(*temp_body);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Range, typename Body, typename Partitioner>
|
||||
task* start_scan<Range,Body,Partitioner>::execute() {
|
||||
typedef internal::finish_scan<Range,Body> finish_pass1_type;
|
||||
finish_pass1_type* p = parent_sum ? static_cast<finish_pass1_type*>( parent() ) : NULL;
|
||||
// Inspecting p->result.left_sum would ordinarily be a race condition.
|
||||
// But we inspect it only if we are not a stolen task, in which case we
|
||||
// know that task assigning to p->result.left_sum has completed.
|
||||
bool treat_as_stolen = is_right_child && (is_stolen_task() || body!=p->result.left_sum);
|
||||
if( treat_as_stolen ) {
|
||||
// Invocation is for right child that has been really stolen or needs to be virtually stolen
|
||||
p->right_zombie = body = new( allocate_root() ) final_sum_type(body->body);
|
||||
is_final = false;
|
||||
}
|
||||
task* next_task = NULL;
|
||||
if( (is_right_child && !treat_as_stolen) || !range.is_divisible() || partition.should_execute_range(*this) ) {
|
||||
if( is_final )
|
||||
(body->body)( range, final_scan_tag() );
|
||||
else if( sum )
|
||||
(body->body)( range, pre_scan_tag() );
|
||||
if( sum )
|
||||
*sum = body;
|
||||
__TBB_ASSERT( !*return_slot, NULL );
|
||||
} else {
|
||||
sum_node_type* result;
|
||||
if( parent_sum )
|
||||
result = new(allocate_additional_child_of(*parent_sum)) sum_node_type(range,/*left_is_final=*/is_final);
|
||||
else
|
||||
result = new(task::allocate_root()) sum_node_type(range,/*left_is_final=*/is_final);
|
||||
finish_pass1_type& c = *new( allocate_continuation()) finish_pass1_type(*return_slot,sum,*result);
|
||||
// Split off right child
|
||||
start_scan& b = *new( c.allocate_child() ) start_scan( /*return_slot=*/result->right, *this, result );
|
||||
b.is_right_child = true;
|
||||
// Left child is recycling of *this. Must recycle this before spawning b,
|
||||
// otherwise b might complete and decrement c.ref_count() to zero, which
|
||||
// would cause c.execute() to run prematurely.
|
||||
recycle_as_child_of(c);
|
||||
c.set_ref_count(2);
|
||||
c.spawn(b);
|
||||
sum = &result->left_sum;
|
||||
return_slot = &result->left;
|
||||
is_right_child = false;
|
||||
next_task = this;
|
||||
parent_sum = result;
|
||||
__TBB_ASSERT( !*return_slot, NULL );
|
||||
}
|
||||
return next_task;
|
||||
}
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
// Requirements on Range concept are documented in blocked_range.h
|
||||
|
||||
/** \page parallel_scan_body_req Requirements on parallel_scan body
|
||||
Class \c Body implementing the concept of parallel_reduce body must define:
|
||||
- \code Body::Body( Body&, split ); \endcode Splitting constructor.
|
||||
Split \c b so that \c this and \c b can accumulate separately
|
||||
- \code Body::~Body(); \endcode Destructor
|
||||
- \code void Body::operator()( const Range& r, pre_scan_tag ); \endcode
|
||||
Preprocess iterations for range \c r
|
||||
- \code void Body::operator()( const Range& r, final_scan_tag ); \endcode
|
||||
Do final processing for iterations of range \c r
|
||||
- \code void Body::reverse_join( Body& a ); \endcode
|
||||
Merge preprocessing state of \c a into \c this, where \c a was
|
||||
created earlier from \c b by b's splitting constructor
|
||||
**/
|
||||
|
||||
/** \name parallel_scan
|
||||
See also requirements on \ref range_req "Range" and \ref parallel_scan_body_req "parallel_scan Body". **/
|
||||
//@{
|
||||
|
||||
//! Parallel prefix with default partitioner
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_scan( const Range& range, Body& body ) {
|
||||
internal::start_scan<Range,Body,__TBB_DEFAULT_PARTITIONER>::run(range,body,__TBB_DEFAULT_PARTITIONER());
|
||||
}
|
||||
|
||||
//! Parallel prefix with simple_partitioner
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_scan( const Range& range, Body& body, const simple_partitioner& partitioner ) {
|
||||
internal::start_scan<Range,Body,simple_partitioner>::run(range,body,partitioner);
|
||||
}
|
||||
|
||||
//! Parallel prefix with auto_partitioner
|
||||
/** @ingroup algorithms **/
|
||||
template<typename Range, typename Body>
|
||||
void parallel_scan( const Range& range, Body& body, const auto_partitioner& partitioner ) {
|
||||
internal::start_scan<Range,Body,auto_partitioner>::run(range,body,partitioner);
|
||||
}
|
||||
//@}
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_parallel_scan_H */
|
||||
|
||||
|
|
@ -1,227 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_parallel_sort_H
|
||||
#define __TBB_parallel_sort_H
|
||||
|
||||
#include "parallel_for.h"
|
||||
#include "blocked_range.h"
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
//! Range used in quicksort to split elements into subranges based on a value.
|
||||
/** The split operation selects a splitter and places all elements less than or equal
|
||||
to the value in the first range and the remaining elements in the second range.
|
||||
@ingroup algorithms */
|
||||
template<typename RandomAccessIterator, typename Compare>
|
||||
class quick_sort_range: private no_assign {
|
||||
|
||||
inline size_t median_of_three(const RandomAccessIterator &array, size_t l, size_t m, size_t r) const {
|
||||
return comp(array[l], array[m]) ? ( comp(array[m], array[r]) ? m : ( comp( array[l], array[r]) ? r : l ) )
|
||||
: ( comp(array[r], array[m]) ? m : ( comp( array[r], array[l] ) ? r : l ) );
|
||||
}
|
||||
|
||||
inline size_t pseudo_median_of_nine( const RandomAccessIterator &array, const quick_sort_range &range ) const {
|
||||
size_t offset = range.size/8u;
|
||||
return median_of_three(array,
|
||||
median_of_three(array, 0, offset, offset*2),
|
||||
median_of_three(array, offset*3, offset*4, offset*5),
|
||||
median_of_three(array, offset*6, offset*7, range.size - 1) );
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
static const size_t grainsize = 500;
|
||||
const Compare ∁
|
||||
RandomAccessIterator begin;
|
||||
size_t size;
|
||||
|
||||
quick_sort_range( RandomAccessIterator begin_, size_t size_, const Compare &comp_ ) :
|
||||
comp(comp_), begin(begin_), size(size_) {}
|
||||
|
||||
bool empty() const {return size==0;}
|
||||
bool is_divisible() const {return size>=grainsize;}
|
||||
|
||||
quick_sort_range( quick_sort_range& range, split ) : comp(range.comp) {
|
||||
RandomAccessIterator array = range.begin;
|
||||
RandomAccessIterator key0 = range.begin;
|
||||
size_t m = pseudo_median_of_nine(array, range);
|
||||
if (m) std::swap ( array[0], array[m] );
|
||||
|
||||
size_t i=0;
|
||||
size_t j=range.size;
|
||||
// Partition interval [i+1,j-1] with key *key0.
|
||||
for(;;) {
|
||||
__TBB_ASSERT( i<j, NULL );
|
||||
// Loop must terminate since array[l]==*key0.
|
||||
do {
|
||||
--j;
|
||||
__TBB_ASSERT( i<=j, "bad ordering relation?" );
|
||||
} while( comp( *key0, array[j] ));
|
||||
do {
|
||||
__TBB_ASSERT( i<=j, NULL );
|
||||
if( i==j ) goto partition;
|
||||
++i;
|
||||
} while( comp( array[i],*key0 ));
|
||||
if( i==j ) goto partition;
|
||||
std::swap( array[i], array[j] );
|
||||
}
|
||||
partition:
|
||||
// Put the partition key were it belongs
|
||||
std::swap( array[j], *key0 );
|
||||
// array[l..j) is less or equal to key.
|
||||
// array(j..r) is greater or equal to key.
|
||||
// array[j] is equal to key
|
||||
i=j+1;
|
||||
begin = array+i;
|
||||
size = range.size-i;
|
||||
range.size = j;
|
||||
}
|
||||
};
|
||||
|
||||
//! Body class used to test if elements in a range are presorted
|
||||
/** @ingroup algorithms */
|
||||
template<typename RandomAccessIterator, typename Compare>
|
||||
class quick_sort_pretest_body : internal::no_assign {
|
||||
const Compare ∁
|
||||
|
||||
public:
|
||||
quick_sort_pretest_body(const Compare &_comp) : comp(_comp) {}
|
||||
|
||||
void operator()( const blocked_range<RandomAccessIterator>& range ) const {
|
||||
task &my_task = task::self();
|
||||
RandomAccessIterator my_end = range.end();
|
||||
|
||||
int i = 0;
|
||||
for (RandomAccessIterator k = range.begin(); k != my_end; ++k, ++i) {
|
||||
if ( i%64 == 0 && my_task.is_cancelled() ) break;
|
||||
|
||||
// The k-1 is never out-of-range because the first chunk starts at begin+serial_cutoff+1
|
||||
if ( comp( *(k), *(k-1) ) ) {
|
||||
my_task.cancel_group_execution();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//! Body class used to sort elements in a range that is smaller than the grainsize.
|
||||
/** @ingroup algorithms */
|
||||
template<typename RandomAccessIterator, typename Compare>
|
||||
struct quick_sort_body {
|
||||
void operator()( const quick_sort_range<RandomAccessIterator,Compare>& range ) const {
|
||||
//SerialQuickSort( range.begin, range.size, range.comp );
|
||||
std::sort( range.begin, range.begin + range.size, range.comp );
|
||||
}
|
||||
};
|
||||
|
||||
//! Wrapper method to initiate the sort by calling parallel_for.
|
||||
/** @ingroup algorithms */
|
||||
template<typename RandomAccessIterator, typename Compare>
|
||||
void parallel_quick_sort( RandomAccessIterator begin, RandomAccessIterator end, const Compare& comp ) {
|
||||
task_group_context my_context;
|
||||
const int serial_cutoff = 9;
|
||||
|
||||
__TBB_ASSERT( begin + serial_cutoff < end, "min_parallel_size is smaller than serial cutoff?" );
|
||||
RandomAccessIterator k;
|
||||
for ( k = begin ; k != begin + serial_cutoff; ++k ) {
|
||||
if ( comp( *(k+1), *k ) ) {
|
||||
goto do_parallel_quick_sort;
|
||||
}
|
||||
}
|
||||
|
||||
parallel_for( blocked_range<RandomAccessIterator>(k+1, end),
|
||||
quick_sort_pretest_body<RandomAccessIterator,Compare>(comp),
|
||||
auto_partitioner(),
|
||||
my_context);
|
||||
|
||||
if (my_context.is_group_execution_cancelled())
|
||||
do_parallel_quick_sort:
|
||||
parallel_for( quick_sort_range<RandomAccessIterator,Compare>(begin, end-begin, comp ),
|
||||
quick_sort_body<RandomAccessIterator,Compare>(),
|
||||
auto_partitioner() );
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
/** \page parallel_sort_iter_req Requirements on iterators for parallel_sort
|
||||
Requirements on value type \c T of \c RandomAccessIterator for \c parallel_sort:
|
||||
- \code void swap( T& x, T& y ) \endcode Swaps \c x and \c y
|
||||
- \code bool Compare::operator()( const T& x, const T& y ) \endcode
|
||||
True if x comes before y;
|
||||
**/
|
||||
|
||||
/** \name parallel_sort
|
||||
See also requirements on \ref parallel_sort_iter_req "iterators for parallel_sort". **/
|
||||
//@{
|
||||
|
||||
//! Sorts the data in [begin,end) using the given comparator
|
||||
/** The compare function object is used for all comparisons between elements during sorting.
|
||||
The compare object must define a bool operator() function.
|
||||
@ingroup algorithms **/
|
||||
template<typename RandomAccessIterator, typename Compare>
|
||||
void parallel_sort( RandomAccessIterator begin, RandomAccessIterator end, const Compare& comp) {
|
||||
const int min_parallel_size = 500;
|
||||
if( end > begin ) {
|
||||
if (end - begin < min_parallel_size) {
|
||||
std::sort(begin, end, comp);
|
||||
} else {
|
||||
internal::parallel_quick_sort(begin, end, comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! Sorts the data in [begin,end) with a default comparator \c std::less<RandomAccessIterator>
|
||||
/** @ingroup algorithms **/
|
||||
template<typename RandomAccessIterator>
|
||||
inline void parallel_sort( RandomAccessIterator begin, RandomAccessIterator end ) {
|
||||
parallel_sort( begin, end, std::less< typename std::iterator_traits<RandomAccessIterator>::value_type >() );
|
||||
}
|
||||
|
||||
//! Sorts the data in the range \c [begin,end) with a default comparator \c std::less<T>
|
||||
/** @ingroup algorithms **/
|
||||
template<typename T>
|
||||
inline void parallel_sort( T * begin, T * end ) {
|
||||
parallel_sort( begin, end, std::less< T >() );
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_parallel_while
|
||||
#define __TBB_parallel_while
|
||||
|
||||
#include "task.h"
|
||||
#include <new>
|
||||
|
||||
namespace tbb {
|
||||
|
||||
template<typename Body>
|
||||
class parallel_while;
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
template<typename Stream, typename Body> class while_task;
|
||||
|
||||
//! For internal use only.
|
||||
/** Executes one iteration of a while.
|
||||
@ingroup algorithms */
|
||||
template<typename Body>
|
||||
class while_iteration_task: public task {
|
||||
const Body& my_body;
|
||||
typename Body::argument_type my_value;
|
||||
/*override*/ task* execute() {
|
||||
my_body(my_value);
|
||||
return NULL;
|
||||
}
|
||||
while_iteration_task( const typename Body::argument_type& value, const Body& body ) :
|
||||
my_body(body), my_value(value)
|
||||
{}
|
||||
template<typename Body_> friend class while_group_task;
|
||||
friend class tbb::parallel_while<Body>;
|
||||
};
|
||||
|
||||
//! For internal use only
|
||||
/** Unpacks a block of iterations.
|
||||
@ingroup algorithms */
|
||||
template<typename Body>
|
||||
class while_group_task: public task {
|
||||
static const size_t max_arg_size = 4;
|
||||
const Body& my_body;
|
||||
size_t size;
|
||||
typename Body::argument_type my_arg[max_arg_size];
|
||||
while_group_task( const Body& body ) : my_body(body), size(0) {}
|
||||
/*override*/ task* execute() {
|
||||
typedef while_iteration_task<Body> iteration_type;
|
||||
__TBB_ASSERT( size>0, NULL );
|
||||
task_list list;
|
||||
task* t;
|
||||
size_t k=0;
|
||||
for(;;) {
|
||||
t = new( allocate_child() ) iteration_type(my_arg[k],my_body);
|
||||
if( ++k==size ) break;
|
||||
list.push_back(*t);
|
||||
}
|
||||
set_ref_count(int(k+1));
|
||||
spawn(list);
|
||||
spawn_and_wait_for_all(*t);
|
||||
return NULL;
|
||||
}
|
||||
template<typename Stream, typename Body_> friend class while_task;
|
||||
};
|
||||
|
||||
//! For internal use only.
|
||||
/** Gets block of iterations from a stream and packages them into a while_group_task.
|
||||
@ingroup algorithms */
|
||||
template<typename Stream, typename Body>
|
||||
class while_task: public task {
|
||||
Stream& my_stream;
|
||||
const Body& my_body;
|
||||
empty_task& my_barrier;
|
||||
/*override*/ task* execute() {
|
||||
typedef while_group_task<Body> block_type;
|
||||
block_type& t = *new( allocate_additional_child_of(my_barrier) ) block_type(my_body);
|
||||
size_t k=0;
|
||||
while( my_stream.pop_if_present(t.my_arg[k]) ) {
|
||||
if( ++k==block_type::max_arg_size ) {
|
||||
// There might be more iterations.
|
||||
recycle_to_reexecute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( k==0 ) {
|
||||
destroy(t);
|
||||
return NULL;
|
||||
} else {
|
||||
t.size = k;
|
||||
return &t;
|
||||
}
|
||||
}
|
||||
while_task( Stream& stream, const Body& body, empty_task& barrier ) :
|
||||
my_stream(stream),
|
||||
my_body(body),
|
||||
my_barrier(barrier)
|
||||
{}
|
||||
friend class tbb::parallel_while<Body>;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
//! Parallel iteration over a stream, with optional addition of more work.
|
||||
/** The Body b has the requirement: \n
|
||||
"b(v)" \n
|
||||
"b.argument_type" \n
|
||||
where v is an argument_type
|
||||
@ingroup algorithms */
|
||||
template<typename Body>
|
||||
class parallel_while: internal::no_copy {
|
||||
public:
|
||||
//! Construct empty non-running parallel while.
|
||||
parallel_while() : my_body(NULL), my_barrier(NULL) {}
|
||||
|
||||
//! Destructor cleans up data members before returning.
|
||||
~parallel_while() {
|
||||
if( my_barrier ) {
|
||||
my_barrier->destroy(*my_barrier);
|
||||
my_barrier = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//! Type of items
|
||||
typedef typename Body::argument_type value_type;
|
||||
|
||||
//! Apply body.apply to each item in the stream.
|
||||
/** A Stream s has the requirements \n
|
||||
"S::value_type" \n
|
||||
"s.pop_if_present(value) is convertible to bool */
|
||||
template<typename Stream>
|
||||
void run( Stream& stream, const Body& body );
|
||||
|
||||
//! Add a work item while running.
|
||||
/** Should be executed only by body.apply or a thread spawned therefrom. */
|
||||
void add( const value_type& item );
|
||||
|
||||
private:
|
||||
const Body* my_body;
|
||||
empty_task* my_barrier;
|
||||
};
|
||||
|
||||
template<typename Body>
|
||||
template<typename Stream>
|
||||
void parallel_while<Body>::run( Stream& stream, const Body& body ) {
|
||||
using namespace internal;
|
||||
empty_task& barrier = *new( task::allocate_root() ) empty_task();
|
||||
my_body = &body;
|
||||
my_barrier = &barrier;
|
||||
my_barrier->set_ref_count(2);
|
||||
while_task<Stream,Body>& w = *new( my_barrier->allocate_child() ) while_task<Stream,Body>( stream, body, barrier );
|
||||
my_barrier->spawn_and_wait_for_all(w);
|
||||
my_barrier->destroy(*my_barrier);
|
||||
my_barrier = NULL;
|
||||
my_body = NULL;
|
||||
}
|
||||
|
||||
template<typename Body>
|
||||
void parallel_while<Body>::add( const value_type& item ) {
|
||||
__TBB_ASSERT(my_barrier,"attempt to add to parallel_while that is not running");
|
||||
typedef internal::while_iteration_task<Body> iteration_type;
|
||||
iteration_type& i = *new( task::self().allocate_additional_child_of(*my_barrier) ) iteration_type(item,*my_body);
|
||||
task::self().spawn( i );
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif /* __TBB_parallel_while */
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_partitioner_H
|
||||
#define __TBB_partitioner_H
|
||||
|
||||
#include "task.h"
|
||||
|
||||
namespace tbb {
|
||||
class affinity_partitioner;
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
size_t __TBB_EXPORTED_FUNC get_initial_auto_partitioner_divisor();
|
||||
|
||||
//! Defines entry points into tbb run-time library;
|
||||
/** The entry points are the constructor and destructor. */
|
||||
class affinity_partitioner_base_v3: no_copy {
|
||||
friend class tbb::affinity_partitioner;
|
||||
//! Array that remembers affinities of tree positions to affinity_id.
|
||||
/** NULL if my_size==0. */
|
||||
affinity_id* my_array;
|
||||
//! Number of elements in my_array.
|
||||
size_t my_size;
|
||||
//! Zeros the fields.
|
||||
affinity_partitioner_base_v3() : my_array(NULL), my_size(0) {}
|
||||
//! Deallocates my_array.
|
||||
~affinity_partitioner_base_v3() {resize(0);}
|
||||
//! Resize my_array.
|
||||
/** Retains values if resulting size is the same. */
|
||||
void __TBB_EXPORTED_METHOD resize( unsigned factor );
|
||||
friend class affinity_partition_type;
|
||||
};
|
||||
|
||||
//! Provides default methods for partition objects without affinity.
|
||||
class partition_type_base {
|
||||
public:
|
||||
void set_affinity( task & ) {}
|
||||
void note_affinity( task::affinity_id ) {}
|
||||
task* continue_after_execute_range( task& ) {return NULL;}
|
||||
bool decide_whether_to_delay() {return false;}
|
||||
void spawn_or_delay( bool, task& a, task& b ) {
|
||||
a.spawn(b);
|
||||
}
|
||||
};
|
||||
|
||||
class affinity_partition_type;
|
||||
|
||||
template<typename Range, typename Body, typename Partitioner> class start_for;
|
||||
template<typename Range, typename Body, typename Partitioner> class start_reduce;
|
||||
template<typename Range, typename Body> class start_reduce_with_affinity;
|
||||
template<typename Range, typename Body, typename Partitioner> class start_scan;
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
//! A simple partitioner
|
||||
/** Divides the range until the range is not divisible.
|
||||
@ingroup algorithms */
|
||||
class simple_partitioner {
|
||||
public:
|
||||
simple_partitioner() {}
|
||||
private:
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_for;
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_reduce;
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_scan;
|
||||
|
||||
class partition_type: public internal::partition_type_base {
|
||||
public:
|
||||
bool should_execute_range(const task& ) {return false;}
|
||||
partition_type( const simple_partitioner& ) {}
|
||||
partition_type( const partition_type&, split ) {}
|
||||
};
|
||||
};
|
||||
|
||||
//! An auto partitioner
|
||||
/** The range is initial divided into several large chunks.
|
||||
Chunks are further subdivided into VICTIM_CHUNKS pieces if they are stolen and divisible.
|
||||
@ingroup algorithms */
|
||||
class auto_partitioner {
|
||||
public:
|
||||
auto_partitioner() {}
|
||||
|
||||
private:
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_for;
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_reduce;
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_scan;
|
||||
|
||||
class partition_type: public internal::partition_type_base {
|
||||
size_t num_chunks;
|
||||
static const size_t VICTIM_CHUNKS = 4;
|
||||
public:
|
||||
bool should_execute_range(const task &t) {
|
||||
if( num_chunks<VICTIM_CHUNKS && t.is_stolen_task() )
|
||||
num_chunks = VICTIM_CHUNKS;
|
||||
return num_chunks==1;
|
||||
}
|
||||
partition_type( const auto_partitioner& ) : num_chunks(internal::get_initial_auto_partitioner_divisor()) {}
|
||||
partition_type( partition_type& pt, split ) {
|
||||
num_chunks = pt.num_chunks /= 2u;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//! An affinity partitioner
|
||||
class affinity_partitioner: internal::affinity_partitioner_base_v3 {
|
||||
public:
|
||||
affinity_partitioner() {}
|
||||
|
||||
private:
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_for;
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_reduce;
|
||||
template<typename Range, typename Body> friend class internal::start_reduce_with_affinity;
|
||||
template<typename Range, typename Body, typename Partitioner> friend class internal::start_scan;
|
||||
|
||||
typedef internal::affinity_partition_type partition_type;
|
||||
friend class internal::affinity_partition_type;
|
||||
};
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
class affinity_partition_type: public no_copy {
|
||||
//! Must be power of two
|
||||
static const unsigned factor = 16;
|
||||
static const size_t VICTIM_CHUNKS = 4;
|
||||
|
||||
internal::affinity_id* my_array;
|
||||
task_list delay_list;
|
||||
unsigned map_begin, map_end;
|
||||
size_t num_chunks;
|
||||
public:
|
||||
affinity_partition_type( affinity_partitioner& ap ) {
|
||||
__TBB_ASSERT( (factor&(factor-1))==0, "factor must be power of two" );
|
||||
ap.resize(factor);
|
||||
my_array = ap.my_array;
|
||||
map_begin = 0;
|
||||
map_end = unsigned(ap.my_size);
|
||||
num_chunks = internal::get_initial_auto_partitioner_divisor();
|
||||
}
|
||||
affinity_partition_type(affinity_partition_type& p, split) : my_array(p.my_array) {
|
||||
__TBB_ASSERT( p.map_end-p.map_begin<factor || (p.map_end-p.map_begin)%factor==0, NULL );
|
||||
num_chunks = p.num_chunks /= 2;
|
||||
unsigned e = p.map_end;
|
||||
unsigned d = (e - p.map_begin)/2;
|
||||
if( d>factor )
|
||||
d &= 0u-factor;
|
||||
map_end = e;
|
||||
map_begin = p.map_end = e-d;
|
||||
}
|
||||
|
||||
bool should_execute_range(const task &t) {
|
||||
if( num_chunks < VICTIM_CHUNKS && t.is_stolen_task() )
|
||||
num_chunks = VICTIM_CHUNKS;
|
||||
return num_chunks == 1;
|
||||
}
|
||||
|
||||
void set_affinity( task &t ) {
|
||||
if( map_begin<map_end )
|
||||
t.set_affinity( my_array[map_begin] );
|
||||
}
|
||||
void note_affinity( task::affinity_id id ) {
|
||||
if( map_begin<map_end )
|
||||
my_array[map_begin] = id;
|
||||
}
|
||||
task* continue_after_execute_range( task& t ) {
|
||||
task* first = NULL;
|
||||
if( !delay_list.empty() ) {
|
||||
first = &delay_list.pop_front();
|
||||
while( !delay_list.empty() ) {
|
||||
t.spawn(*first);
|
||||
first = &delay_list.pop_front();
|
||||
}
|
||||
}
|
||||
return first;
|
||||
}
|
||||
bool decide_whether_to_delay() {
|
||||
// The possible underflow caused by "-1u" is deliberate
|
||||
return (map_begin&(factor-1))==0 && map_end-map_begin-1u<factor;
|
||||
}
|
||||
void spawn_or_delay( bool delay, task& a, task& b ) {
|
||||
if( delay )
|
||||
delay_list.push_back(b);
|
||||
else
|
||||
a.spawn(b);
|
||||
}
|
||||
|
||||
~affinity_partition_type() {
|
||||
// The delay_list can be non-empty if an exception is thrown.
|
||||
while( !delay_list.empty() ) {
|
||||
task& t = delay_list.pop_front();
|
||||
t.destroy(t);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_partitioner_H */
|
||||
|
|
@ -1,269 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_pipeline_H
|
||||
#define __TBB_pipeline_H
|
||||
|
||||
#include "atomic.h"
|
||||
#include "task.h"
|
||||
#include <cstddef>
|
||||
|
||||
namespace tbb {
|
||||
|
||||
class pipeline;
|
||||
class filter;
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
// The argument for PIPELINE_VERSION should be an integer between 2 and 9
|
||||
#define __TBB_PIPELINE_VERSION(x) (unsigned char)(x-2)<<1
|
||||
|
||||
typedef unsigned long Token;
|
||||
typedef long tokendiff_t;
|
||||
class stage_task;
|
||||
class input_buffer;
|
||||
class pipeline_root_task;
|
||||
class pipeline_cleaner;
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
//! A stage in a pipeline.
|
||||
/** @ingroup algorithms */
|
||||
class filter: internal::no_copy {
|
||||
private:
|
||||
//! Value used to mark "not in pipeline"
|
||||
static filter* not_in_pipeline() {return reinterpret_cast<filter*>(internal::intptr(-1));}
|
||||
|
||||
//! The lowest bit 0 is for parallel vs. serial
|
||||
static const unsigned char filter_is_serial = 0x1;
|
||||
|
||||
//! 4th bit distinguishes ordered vs unordered filters.
|
||||
/** The bit was not set for parallel filters in TBB 2.1 and earlier,
|
||||
but is_ordered() function always treats parallel filters as out of order. */
|
||||
static const unsigned char filter_is_out_of_order = 0x1<<4;
|
||||
|
||||
//! 5th bit distinguishes thread-bound and regular filters.
|
||||
static const unsigned char filter_is_bound = 0x1<<5;
|
||||
|
||||
static const unsigned char current_version = __TBB_PIPELINE_VERSION(5);
|
||||
static const unsigned char version_mask = 0x7<<1; // bits 1-3 are for version
|
||||
public:
|
||||
enum mode {
|
||||
//! processes multiple items in parallel and in no particular order
|
||||
parallel = current_version | filter_is_out_of_order,
|
||||
//! processes items one at a time; all such filters process items in the same order
|
||||
serial_in_order = current_version | filter_is_serial,
|
||||
//! processes items one at a time and in no particular order
|
||||
serial_out_of_order = current_version | filter_is_serial | filter_is_out_of_order,
|
||||
//! @deprecated use serial_in_order instead
|
||||
serial = serial_in_order
|
||||
};
|
||||
protected:
|
||||
filter( bool is_serial_ ) :
|
||||
next_filter_in_pipeline(not_in_pipeline()),
|
||||
my_input_buffer(NULL),
|
||||
my_filter_mode(static_cast<unsigned char>(is_serial_ ? serial : parallel)),
|
||||
prev_filter_in_pipeline(not_in_pipeline()),
|
||||
my_pipeline(NULL),
|
||||
next_segment(NULL)
|
||||
{}
|
||||
|
||||
filter( mode filter_mode ) :
|
||||
next_filter_in_pipeline(not_in_pipeline()),
|
||||
my_input_buffer(NULL),
|
||||
my_filter_mode(static_cast<unsigned char>(filter_mode)),
|
||||
prev_filter_in_pipeline(not_in_pipeline()),
|
||||
my_pipeline(NULL),
|
||||
next_segment(NULL)
|
||||
{}
|
||||
|
||||
public:
|
||||
//! True if filter is serial.
|
||||
bool is_serial() const {
|
||||
return bool( my_filter_mode & filter_is_serial );
|
||||
}
|
||||
|
||||
//! True if filter must receive stream in order.
|
||||
bool is_ordered() const {
|
||||
return (my_filter_mode & (filter_is_out_of_order|filter_is_serial))==filter_is_serial;
|
||||
}
|
||||
|
||||
//! True if filter is thread-bound.
|
||||
bool is_bound() const {
|
||||
return ( my_filter_mode & filter_is_bound )==filter_is_bound;
|
||||
}
|
||||
|
||||
//! Operate on an item from the input stream, and return item for output stream.
|
||||
/** Returns NULL if filter is a sink. */
|
||||
virtual void* operator()( void* item ) = 0;
|
||||
|
||||
//! Destroy filter.
|
||||
/** If the filter was added to a pipeline, the pipeline must be destroyed first. */
|
||||
virtual __TBB_EXPORTED_METHOD ~filter();
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Destroys item if pipeline was cancelled.
|
||||
/** Required to prevent memory leaks.
|
||||
Note it can be called concurrently even for serial filters.*/
|
||||
virtual void finalize( void* /*item*/ ) {};
|
||||
#endif
|
||||
|
||||
private:
|
||||
//! Pointer to next filter in the pipeline.
|
||||
filter* next_filter_in_pipeline;
|
||||
|
||||
//! Buffer for incoming tokens, or NULL if not required.
|
||||
/** The buffer is required if the filter is serial or follows a thread-bound one. */
|
||||
internal::input_buffer* my_input_buffer;
|
||||
|
||||
friend class internal::stage_task;
|
||||
friend class internal::pipeline_root_task;
|
||||
friend class pipeline;
|
||||
friend class thread_bound_filter;
|
||||
|
||||
//! Storage for filter mode and dynamically checked implementation version.
|
||||
const unsigned char my_filter_mode;
|
||||
|
||||
//! Pointer to previous filter in the pipeline.
|
||||
filter* prev_filter_in_pipeline;
|
||||
|
||||
//! Pointer to the pipeline.
|
||||
pipeline* my_pipeline;
|
||||
|
||||
//! Pointer to the next "segment" of filters, or NULL if not required.
|
||||
/** In each segment, the first filter is not thread-bound but follows a thread-bound one. */
|
||||
filter* next_segment;
|
||||
};
|
||||
|
||||
//! A stage in a pipeline served by a user thread.
|
||||
/** @ingroup algorithms */
|
||||
class thread_bound_filter: public filter {
|
||||
public:
|
||||
enum result_type {
|
||||
// item was processed
|
||||
success,
|
||||
// item is currently not available
|
||||
item_not_available,
|
||||
// there are no more items to process
|
||||
end_of_stream
|
||||
};
|
||||
protected:
|
||||
thread_bound_filter(mode filter_mode):
|
||||
filter(static_cast<mode>(filter_mode | filter::filter_is_bound))
|
||||
{}
|
||||
public:
|
||||
//! If a data item is available, invoke operator() on that item.
|
||||
/** This interface is non-blocking.
|
||||
Returns 'success' if an item was processed.
|
||||
Returns 'item_not_available' if no item can be processed now
|
||||
but more may arrive in the future, or if token limit is reached.
|
||||
Returns 'end_of_stream' if there are no more items to process. */
|
||||
result_type __TBB_EXPORTED_METHOD try_process_item();
|
||||
|
||||
//! Wait until a data item becomes available, and invoke operator() on that item.
|
||||
/** This interface is blocking.
|
||||
Returns 'success' if an item was processed.
|
||||
Returns 'end_of_stream' if there are no more items to process.
|
||||
Never returns 'item_not_available', as it blocks until another return condition applies. */
|
||||
result_type __TBB_EXPORTED_METHOD process_item();
|
||||
|
||||
private:
|
||||
//! Internal routine for item processing
|
||||
result_type internal_process_item(bool is_blocking);
|
||||
};
|
||||
|
||||
//! A processing pipeling that applies filters to items.
|
||||
/** @ingroup algorithms */
|
||||
class pipeline {
|
||||
public:
|
||||
//! Construct empty pipeline.
|
||||
__TBB_EXPORTED_METHOD pipeline();
|
||||
|
||||
/** Though the current implementation declares the destructor virtual, do not rely on this
|
||||
detail. The virtualness is deprecated and may disappear in future versions of TBB. */
|
||||
virtual __TBB_EXPORTED_METHOD ~pipeline();
|
||||
|
||||
//! Add filter to end of pipeline.
|
||||
void __TBB_EXPORTED_METHOD add_filter( filter& filter_ );
|
||||
|
||||
//! Run the pipeline to completion.
|
||||
void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens );
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Run the pipeline to completion with user-supplied context.
|
||||
void __TBB_EXPORTED_METHOD run( size_t max_number_of_live_tokens, tbb::task_group_context& context );
|
||||
#endif
|
||||
|
||||
//! Remove all filters from the pipeline.
|
||||
void __TBB_EXPORTED_METHOD clear();
|
||||
|
||||
private:
|
||||
friend class internal::stage_task;
|
||||
friend class internal::pipeline_root_task;
|
||||
friend class filter;
|
||||
friend class thread_bound_filter;
|
||||
friend class internal::pipeline_cleaner;
|
||||
|
||||
//! Pointer to first filter in the pipeline.
|
||||
filter* filter_list;
|
||||
|
||||
//! Pointer to location where address of next filter to be added should be stored.
|
||||
filter* filter_end;
|
||||
|
||||
//! task who's reference count is used to determine when all stages are done.
|
||||
task* end_counter;
|
||||
|
||||
//! Number of idle tokens waiting for input stage.
|
||||
atomic<internal::Token> input_tokens;
|
||||
|
||||
//! Global counter of tokens
|
||||
atomic<internal::Token> token_counter;
|
||||
|
||||
//! False until fetch_input returns NULL.
|
||||
bool end_of_input;
|
||||
|
||||
//! True if the pipeline contains a thread-bound filter; false otherwise.
|
||||
bool has_thread_bound_filters;
|
||||
|
||||
//! Remove filter from pipeline.
|
||||
void remove_filter( filter& filter_ );
|
||||
|
||||
//! Not used, but retained to satisfy old export files.
|
||||
void __TBB_EXPORTED_METHOD inject_token( task& self );
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Does clean up if pipeline is cancelled or exception occured
|
||||
void clear_filters();
|
||||
#endif
|
||||
};
|
||||
|
||||
} // tbb
|
||||
|
||||
#endif /* __TBB_pipeline_H */
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_queuing_mutex_H
|
||||
#define __TBB_queuing_mutex_H
|
||||
|
||||
#include <cstring>
|
||||
#include "atomic.h"
|
||||
#include "tbb_profiling.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! Queuing lock with local-only spinning.
|
||||
/** @ingroup synchronization */
|
||||
class queuing_mutex {
|
||||
public:
|
||||
//! Construct unacquired mutex.
|
||||
queuing_mutex() {
|
||||
q_tail = NULL;
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
internal_construct();
|
||||
#endif
|
||||
}
|
||||
|
||||
//! The scoped locking pattern
|
||||
/** It helps to avoid the common problem of forgetting to release lock.
|
||||
It also nicely provides the "node" for queuing locks. */
|
||||
class scoped_lock: internal::no_copy {
|
||||
//! Initialize fields to mean "no lock held".
|
||||
void initialize() {
|
||||
mutex = NULL;
|
||||
#if TBB_USE_ASSERT
|
||||
internal::poison_pointer(next);
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
public:
|
||||
//! Construct lock that has not acquired a mutex.
|
||||
/** Equivalent to zero-initialization of *this. */
|
||||
scoped_lock() {initialize();}
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
/** Upon entry, *this should not be in the "have acquired a mutex" state. */
|
||||
scoped_lock( queuing_mutex& m ) {
|
||||
initialize();
|
||||
acquire(m);
|
||||
}
|
||||
|
||||
//! Release lock (if lock is held).
|
||||
~scoped_lock() {
|
||||
if( mutex ) release();
|
||||
}
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
void __TBB_EXPORTED_METHOD acquire( queuing_mutex& m );
|
||||
|
||||
//! Acquire lock on given mutex if free (i.e. non-blocking)
|
||||
bool __TBB_EXPORTED_METHOD try_acquire( queuing_mutex& m );
|
||||
|
||||
//! Release lock.
|
||||
void __TBB_EXPORTED_METHOD release();
|
||||
|
||||
private:
|
||||
//! The pointer to the mutex owned, or NULL if not holding a mutex.
|
||||
queuing_mutex* mutex;
|
||||
|
||||
//! The pointer to the next competitor for a mutex
|
||||
scoped_lock *next;
|
||||
|
||||
//! The local spin-wait variable
|
||||
/** Inverted (0 - blocked, 1 - acquired the mutex) for the sake of
|
||||
zero-initialization. Defining it as an entire word instead of
|
||||
a byte seems to help performance slightly. */
|
||||
internal::uintptr going;
|
||||
};
|
||||
|
||||
void __TBB_EXPORTED_METHOD internal_construct();
|
||||
|
||||
// Mutex traits
|
||||
static const bool is_rw_mutex = false;
|
||||
static const bool is_recursive_mutex = false;
|
||||
static const bool is_fair_mutex = true;
|
||||
|
||||
friend class scoped_lock;
|
||||
private:
|
||||
//! The last competitor requesting the lock
|
||||
atomic<scoped_lock*> q_tail;
|
||||
|
||||
};
|
||||
|
||||
__TBB_DEFINE_PROFILING_SET_NAME(queuing_mutex)
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_queuing_mutex_H */
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_queuing_rw_mutex_H
|
||||
#define __TBB_queuing_rw_mutex_H
|
||||
|
||||
#include <cstring>
|
||||
#include "atomic.h"
|
||||
#include "tbb_profiling.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! Reader-writer lock with local-only spinning.
|
||||
/** Adapted from Krieger, Stumm, et al. pseudocode at
|
||||
http://www.eecg.toronto.edu/parallel/pubs_abs.html#Krieger_etal_ICPP93
|
||||
@ingroup synchronization */
|
||||
class queuing_rw_mutex {
|
||||
public:
|
||||
//! Construct unacquired mutex.
|
||||
queuing_rw_mutex() {
|
||||
q_tail = NULL;
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
internal_construct();
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destructor asserts if the mutex is acquired, i.e. q_tail is non-NULL
|
||||
~queuing_rw_mutex() {
|
||||
#if TBB_USE_ASSERT
|
||||
__TBB_ASSERT( !q_tail, "destruction of an acquired mutex");
|
||||
#endif
|
||||
}
|
||||
|
||||
class scoped_lock;
|
||||
friend class scoped_lock;
|
||||
|
||||
//! The scoped locking pattern
|
||||
/** It helps to avoid the common problem of forgetting to release lock.
|
||||
It also nicely provides the "node" for queuing locks. */
|
||||
class scoped_lock: internal::no_copy {
|
||||
//! Initialize fields
|
||||
void initialize() {
|
||||
mutex = NULL;
|
||||
#if TBB_USE_ASSERT
|
||||
state = 0xFF; // Set to invalid state
|
||||
internal::poison_pointer(next);
|
||||
internal::poison_pointer(prev);
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
public:
|
||||
//! Construct lock that has not acquired a mutex.
|
||||
/** Equivalent to zero-initialization of *this. */
|
||||
scoped_lock() {initialize();}
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
/** Upon entry, *this should not be in the "have acquired a mutex" state. */
|
||||
scoped_lock( queuing_rw_mutex& m, bool write=true ) {
|
||||
initialize();
|
||||
acquire(m,write);
|
||||
}
|
||||
|
||||
//! Release lock (if lock is held).
|
||||
~scoped_lock() {
|
||||
if( mutex ) release();
|
||||
}
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
void acquire( queuing_rw_mutex& m, bool write=true );
|
||||
|
||||
//! Try acquire lock on given mutex.
|
||||
bool try_acquire( queuing_rw_mutex& m, bool write=true );
|
||||
|
||||
//! Release lock.
|
||||
void release();
|
||||
|
||||
//! Upgrade reader to become a writer.
|
||||
/** Returns true if the upgrade happened without re-acquiring the lock and false if opposite */
|
||||
bool upgrade_to_writer();
|
||||
|
||||
//! Downgrade writer to become a reader.
|
||||
bool downgrade_to_reader();
|
||||
|
||||
private:
|
||||
//! The pointer to the current mutex to work
|
||||
queuing_rw_mutex* mutex;
|
||||
|
||||
//! The pointer to the previous and next competitors for a mutex
|
||||
scoped_lock * prev, * next;
|
||||
|
||||
typedef unsigned char state_t;
|
||||
|
||||
//! State of the request: reader, writer, active reader, other service states
|
||||
atomic<state_t> state;
|
||||
|
||||
//! The local spin-wait variable
|
||||
/** Corresponds to "spin" in the pseudocode but inverted for the sake of zero-initialization */
|
||||
unsigned char going;
|
||||
|
||||
//! A tiny internal lock
|
||||
unsigned char internal_lock;
|
||||
|
||||
//! Acquire the internal lock
|
||||
void acquire_internal_lock();
|
||||
|
||||
//! Try to acquire the internal lock
|
||||
/** Returns true if lock was successfully acquired. */
|
||||
bool try_acquire_internal_lock();
|
||||
|
||||
//! Release the internal lock
|
||||
void release_internal_lock();
|
||||
|
||||
//! Wait for internal lock to be released
|
||||
void wait_for_release_of_internal_lock();
|
||||
|
||||
//! A helper function
|
||||
void unblock_or_wait_on_internal_lock( uintptr_t );
|
||||
};
|
||||
|
||||
void __TBB_EXPORTED_METHOD internal_construct();
|
||||
|
||||
// Mutex traits
|
||||
static const bool is_rw_mutex = true;
|
||||
static const bool is_recursive_mutex = false;
|
||||
static const bool is_fair_mutex = true;
|
||||
|
||||
private:
|
||||
//! The last competitor requesting the lock
|
||||
atomic<scoped_lock*> q_tail;
|
||||
|
||||
};
|
||||
|
||||
__TBB_DEFINE_PROFILING_SET_NAME(queuing_rw_mutex)
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_queuing_rw_mutex_H */
|
||||
|
|
@ -1,245 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_recursive_mutex_H
|
||||
#define __TBB_recursive_mutex_H
|
||||
|
||||
#if _WIN32||_WIN64
|
||||
|
||||
#include <windows.h>
|
||||
#if !defined(_WIN32_WINNT)
|
||||
// The following Windows API function is declared explicitly;
|
||||
// otherwise any user would have to specify /D_WIN32_WINNT=0x0400
|
||||
extern "C" BOOL WINAPI TryEnterCriticalSection( LPCRITICAL_SECTION );
|
||||
#endif
|
||||
|
||||
#else /* if not _WIN32||_WIN64 */
|
||||
|
||||
#include <pthread.h>
|
||||
namespace tbb { namespace internal {
|
||||
// Use this internal TBB function to throw an exception
|
||||
extern void handle_perror( int error_code, const char* what );
|
||||
} } //namespaces
|
||||
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
|
||||
#include <new>
|
||||
#include "aligned_space.h"
|
||||
#include "tbb_stddef.h"
|
||||
#include "tbb_profiling.h"
|
||||
|
||||
namespace tbb {
|
||||
//! Mutex that allows recursive mutex acquisition.
|
||||
/** Mutex that allows recursive mutex acquisition.
|
||||
@ingroup synchronization */
|
||||
class recursive_mutex {
|
||||
public:
|
||||
//! Construct unacquired recursive_mutex.
|
||||
recursive_mutex() {
|
||||
#if TBB_USE_ASSERT || TBB_USE_THREADING_TOOLS
|
||||
internal_construct();
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
InitializeCriticalSection(&impl);
|
||||
#else
|
||||
pthread_mutexattr_t mtx_attr;
|
||||
int error_code = pthread_mutexattr_init( &mtx_attr );
|
||||
if( error_code )
|
||||
tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutexattr_init failed");
|
||||
|
||||
pthread_mutexattr_settype( &mtx_attr, PTHREAD_MUTEX_RECURSIVE );
|
||||
error_code = pthread_mutex_init( &impl, &mtx_attr );
|
||||
if( error_code )
|
||||
tbb::internal::handle_perror(error_code,"recursive_mutex: pthread_mutex_init failed");
|
||||
|
||||
pthread_mutexattr_destroy( &mtx_attr );
|
||||
#endif /* _WIN32||_WIN64*/
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
};
|
||||
|
||||
~recursive_mutex() {
|
||||
#if TBB_USE_ASSERT
|
||||
internal_destroy();
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
DeleteCriticalSection(&impl);
|
||||
#else
|
||||
pthread_mutex_destroy(&impl);
|
||||
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
};
|
||||
|
||||
class scoped_lock;
|
||||
friend class scoped_lock;
|
||||
|
||||
//! The scoped locking pattern
|
||||
/** It helps to avoid the common problem of forgetting to release lock.
|
||||
It also nicely provides the "node" for queuing locks. */
|
||||
class scoped_lock: internal::no_copy {
|
||||
public:
|
||||
//! Construct lock that has not acquired a recursive_mutex.
|
||||
scoped_lock() : my_mutex(NULL) {};
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
scoped_lock( recursive_mutex& mutex ) {
|
||||
#if TBB_USE_ASSERT
|
||||
my_mutex = &mutex;
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
acquire( mutex );
|
||||
}
|
||||
|
||||
//! Release lock (if lock is held).
|
||||
~scoped_lock() {
|
||||
if( my_mutex )
|
||||
release();
|
||||
}
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
void acquire( recursive_mutex& mutex ) {
|
||||
#if TBB_USE_ASSERT
|
||||
internal_acquire( mutex );
|
||||
#else
|
||||
my_mutex = &mutex;
|
||||
mutex.lock();
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Try acquire lock on given recursive_mutex.
|
||||
bool try_acquire( recursive_mutex& mutex ) {
|
||||
#if TBB_USE_ASSERT
|
||||
return internal_try_acquire( mutex );
|
||||
#else
|
||||
bool result = mutex.try_lock();
|
||||
if( result )
|
||||
my_mutex = &mutex;
|
||||
return result;
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Release lock
|
||||
void release() {
|
||||
#if TBB_USE_ASSERT
|
||||
internal_release();
|
||||
#else
|
||||
my_mutex->unlock();
|
||||
my_mutex = NULL;
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
private:
|
||||
//! The pointer to the current recursive_mutex to work
|
||||
recursive_mutex* my_mutex;
|
||||
|
||||
//! All checks from acquire using mutex.state were moved here
|
||||
void __TBB_EXPORTED_METHOD internal_acquire( recursive_mutex& m );
|
||||
|
||||
//! All checks from try_acquire using mutex.state were moved here
|
||||
bool __TBB_EXPORTED_METHOD internal_try_acquire( recursive_mutex& m );
|
||||
|
||||
//! All checks from release using mutex.state were moved here
|
||||
void __TBB_EXPORTED_METHOD internal_release();
|
||||
|
||||
friend class recursive_mutex;
|
||||
};
|
||||
|
||||
// Mutex traits
|
||||
static const bool is_rw_mutex = false;
|
||||
static const bool is_recursive_mutex = true;
|
||||
static const bool is_fair_mutex = false;
|
||||
|
||||
// C++0x compatibility interface
|
||||
|
||||
//! Acquire lock
|
||||
void lock() {
|
||||
#if TBB_USE_ASSERT
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
new(tmp.begin()) scoped_lock(*this);
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
EnterCriticalSection(&impl);
|
||||
#else
|
||||
pthread_mutex_lock(&impl);
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Try acquiring lock (non-blocking)
|
||||
/** Return true if lock acquired; false otherwise. */
|
||||
bool try_lock() {
|
||||
#if TBB_USE_ASSERT
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
return (new(tmp.begin()) scoped_lock)->internal_try_acquire(*this);
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
return TryEnterCriticalSection(&impl)!=0;
|
||||
#else
|
||||
return pthread_mutex_trylock(&impl)==0;
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Release lock
|
||||
void unlock() {
|
||||
#if TBB_USE_ASSERT
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
scoped_lock& s = *tmp.begin();
|
||||
s.my_mutex = this;
|
||||
s.internal_release();
|
||||
#else
|
||||
#if _WIN32||_WIN64
|
||||
LeaveCriticalSection(&impl);
|
||||
#else
|
||||
pthread_mutex_unlock(&impl);
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
private:
|
||||
#if _WIN32||_WIN64
|
||||
CRITICAL_SECTION impl;
|
||||
enum state_t {
|
||||
INITIALIZED=0x1234,
|
||||
DESTROYED=0x789A,
|
||||
} state;
|
||||
#else
|
||||
pthread_mutex_t impl;
|
||||
#endif /* _WIN32||_WIN64 */
|
||||
|
||||
//! All checks from mutex constructor using mutex.state were moved here
|
||||
void __TBB_EXPORTED_METHOD internal_construct();
|
||||
|
||||
//! All checks from mutex destructor using mutex.state were moved here
|
||||
void __TBB_EXPORTED_METHOD internal_destroy();
|
||||
};
|
||||
|
||||
__TBB_DEFINE_PROFILING_SET_NAME(recursive_mutex)
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_recursive_mutex_H */
|
||||
|
|
@ -1,205 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_scalable_allocator_H
|
||||
#define __TBB_scalable_allocator_H
|
||||
/** @file */
|
||||
|
||||
#include <stddef.h> /* Need ptrdiff_t and size_t from here. */
|
||||
|
||||
#if !defined(__cplusplus) && __ICC==1100
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 991)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if _MSC_VER >= 1400
|
||||
#define __TBB_EXPORTED_FUNC __cdecl
|
||||
#else
|
||||
#define __TBB_EXPORTED_FUNC
|
||||
#endif
|
||||
|
||||
/** The "malloc" analogue to allocate block of memory of size bytes.
|
||||
* @ingroup memory_allocation */
|
||||
void * __TBB_EXPORTED_FUNC scalable_malloc (size_t size);
|
||||
|
||||
/** The "free" analogue to discard a previously allocated piece of memory.
|
||||
@ingroup memory_allocation */
|
||||
void __TBB_EXPORTED_FUNC scalable_free (void* ptr);
|
||||
|
||||
/** The "realloc" analogue complementing scalable_malloc.
|
||||
@ingroup memory_allocation */
|
||||
void * __TBB_EXPORTED_FUNC scalable_realloc (void* ptr, size_t size);
|
||||
|
||||
/** The "calloc" analogue complementing scalable_malloc.
|
||||
@ingroup memory_allocation */
|
||||
void * __TBB_EXPORTED_FUNC scalable_calloc (size_t nobj, size_t size);
|
||||
|
||||
/** The "posix_memalign" analogue.
|
||||
@ingroup memory_allocation */
|
||||
int __TBB_EXPORTED_FUNC scalable_posix_memalign (void** memptr, size_t alignment, size_t size);
|
||||
|
||||
/** The "_aligned_malloc" analogue.
|
||||
@ingroup memory_allocation */
|
||||
void * __TBB_EXPORTED_FUNC scalable_aligned_malloc (size_t size, size_t alignment);
|
||||
|
||||
/** The "_aligned_realloc" analogue.
|
||||
@ingroup memory_allocation */
|
||||
void * __TBB_EXPORTED_FUNC scalable_aligned_realloc (void* ptr, size_t size, size_t alignment);
|
||||
|
||||
/** The "_aligned_free" analogue.
|
||||
@ingroup memory_allocation */
|
||||
void __TBB_EXPORTED_FUNC scalable_aligned_free (void* ptr);
|
||||
|
||||
/** The analogue of _msize/malloc_size/malloc_usable_size.
|
||||
Returns the usable size of a memory block previously allocated by scalable_*,
|
||||
or 0 (zero) if ptr does not point to such a block.
|
||||
@ingroup memory_allocation */
|
||||
size_t __TBB_EXPORTED_FUNC scalable_msize (void* ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <new> /* To use new with the placement argument */
|
||||
|
||||
/* Ensure that including this header does not cause implicit linkage with TBB */
|
||||
#ifndef __TBB_NO_IMPLICIT_LINKAGE
|
||||
#define __TBB_NO_IMPLICIT_LINKAGE 1
|
||||
#include "tbb_stddef.h"
|
||||
#undef __TBB_NO_IMPLICIT_LINKAGE
|
||||
#else
|
||||
#include "tbb_stddef.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace tbb {
|
||||
|
||||
#if _MSC_VER && !defined(__INTEL_COMPILER)
|
||||
// Workaround for erroneous "unreferenced parameter" warning in method destroy.
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4100)
|
||||
#endif
|
||||
|
||||
//! Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5
|
||||
/** The members are ordered the same way they are in section 20.4.1
|
||||
of the ISO C++ standard.
|
||||
@ingroup memory_allocation */
|
||||
template<typename T>
|
||||
class scalable_allocator {
|
||||
public:
|
||||
typedef typename internal::allocator_type<T>::value_type value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
template<class U> struct rebind {
|
||||
typedef scalable_allocator<U> other;
|
||||
};
|
||||
|
||||
scalable_allocator() throw() {}
|
||||
scalable_allocator( const scalable_allocator& ) throw() {}
|
||||
template<typename U> scalable_allocator(const scalable_allocator<U>&) throw() {}
|
||||
|
||||
pointer address(reference x) const {return &x;}
|
||||
const_pointer address(const_reference x) const {return &x;}
|
||||
|
||||
//! Allocate space for n objects.
|
||||
pointer allocate( size_type n, const void* /*hint*/ =0 ) {
|
||||
return static_cast<pointer>( scalable_malloc( n * sizeof(value_type) ) );
|
||||
}
|
||||
|
||||
//! Free previously allocated block of memory
|
||||
void deallocate( pointer p, size_type ) {
|
||||
scalable_free( p );
|
||||
}
|
||||
|
||||
//! Largest value for which method allocate might succeed.
|
||||
size_type max_size() const throw() {
|
||||
size_type absolutemax = static_cast<size_type>(-1) / sizeof (value_type);
|
||||
return (absolutemax > 0 ? absolutemax : 1);
|
||||
}
|
||||
void construct( pointer p, const value_type& val ) { new(static_cast<void*>(p)) value_type(val); }
|
||||
void destroy( pointer p ) {p->~value_type();}
|
||||
};
|
||||
|
||||
#if _MSC_VER && !defined(__INTEL_COMPILER)
|
||||
#pragma warning (pop)
|
||||
#endif // warning 4100 is back
|
||||
|
||||
//! Analogous to std::allocator<void>, as defined in ISO C++ Standard, Section 20.4.1
|
||||
/** @ingroup memory_allocation */
|
||||
template<>
|
||||
class scalable_allocator<void> {
|
||||
public:
|
||||
typedef void* pointer;
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
template<class U> struct rebind {
|
||||
typedef scalable_allocator<U> other;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
inline bool operator==( const scalable_allocator<T>&, const scalable_allocator<U>& ) {return true;}
|
||||
|
||||
template<typename T, typename U>
|
||||
inline bool operator!=( const scalable_allocator<T>&, const scalable_allocator<U>& ) {return false;}
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#if _MSC_VER
|
||||
#if __TBB_BUILD && !defined(__TBBMALLOC_NO_IMPLICIT_LINKAGE)
|
||||
#define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
|
||||
#endif
|
||||
|
||||
#if !__TBBMALLOC_NO_IMPLICIT_LINKAGE
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "tbbmalloc_debug.lib")
|
||||
#else
|
||||
#pragma comment(lib, "tbbmalloc.lib")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if !defined(__cplusplus) && __ICC==1100
|
||||
#pragma warning (pop)
|
||||
#endif // ICC 11.0 warning 991 is back
|
||||
|
||||
#endif /* __TBB_scalable_allocator_H */
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_spin_mutex_H
|
||||
#define __TBB_spin_mutex_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <new>
|
||||
#include "aligned_space.h"
|
||||
#include "tbb_stddef.h"
|
||||
#include "tbb_machine.h"
|
||||
#include "tbb_profiling.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
//! A lock that occupies a single byte.
|
||||
/** A spin_mutex is a spin mutex that fits in a single byte.
|
||||
It should be used only for locking short critical sections
|
||||
(typically <20 instructions) when fairness is not an issue.
|
||||
If zero-initialized, the mutex is considered unheld.
|
||||
@ingroup synchronization */
|
||||
class spin_mutex {
|
||||
//! 0 if lock is released, 1 if lock is acquired.
|
||||
unsigned char flag;
|
||||
|
||||
public:
|
||||
//! Construct unacquired lock.
|
||||
/** Equivalent to zero-initialization of *this. */
|
||||
spin_mutex() : flag(0) {
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
internal_construct();
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Represents acquisition of a mutex.
|
||||
class scoped_lock : internal::no_copy {
|
||||
private:
|
||||
//! Points to currently held mutex, or NULL if no lock is held.
|
||||
spin_mutex* my_mutex;
|
||||
|
||||
//! Value to store into spin_mutex::flag to unlock the mutex.
|
||||
internal::uintptr my_unlock_value;
|
||||
|
||||
//! Like acquire, but with ITT instrumentation.
|
||||
void __TBB_EXPORTED_METHOD internal_acquire( spin_mutex& m );
|
||||
|
||||
//! Like try_acquire, but with ITT instrumentation.
|
||||
bool __TBB_EXPORTED_METHOD internal_try_acquire( spin_mutex& m );
|
||||
|
||||
//! Like release, but with ITT instrumentation.
|
||||
void __TBB_EXPORTED_METHOD internal_release();
|
||||
|
||||
friend class spin_mutex;
|
||||
|
||||
public:
|
||||
//! Construct without acquiring a mutex.
|
||||
scoped_lock() : my_mutex(NULL), my_unlock_value(0) {}
|
||||
|
||||
//! Construct and acquire lock on a mutex.
|
||||
scoped_lock( spin_mutex& m ) {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
my_mutex=NULL;
|
||||
internal_acquire(m);
|
||||
#else
|
||||
my_unlock_value = __TBB_LockByte(m.flag);
|
||||
my_mutex=&m;
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/
|
||||
}
|
||||
|
||||
//! Acquire lock.
|
||||
void acquire( spin_mutex& m ) {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
internal_acquire(m);
|
||||
#else
|
||||
my_unlock_value = __TBB_LockByte(m.flag);
|
||||
my_mutex = &m;
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/
|
||||
}
|
||||
|
||||
//! Try acquiring lock (non-blocking)
|
||||
/** Return true if lock acquired; false otherwise. */
|
||||
bool try_acquire( spin_mutex& m ) {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
return internal_try_acquire(m);
|
||||
#else
|
||||
bool result = __TBB_TryLockByte(m.flag);
|
||||
if( result ) {
|
||||
my_unlock_value = 0;
|
||||
my_mutex = &m;
|
||||
}
|
||||
return result;
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT*/
|
||||
}
|
||||
|
||||
//! Release lock
|
||||
void release() {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
internal_release();
|
||||
#else
|
||||
__TBB_store_with_release(my_mutex->flag, static_cast<unsigned char>(my_unlock_value));
|
||||
my_mutex = NULL;
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Destroy lock. If holding a lock, releases the lock first.
|
||||
~scoped_lock() {
|
||||
if( my_mutex ) {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
internal_release();
|
||||
#else
|
||||
__TBB_store_with_release(my_mutex->flag, static_cast<unsigned char>(my_unlock_value));
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void __TBB_EXPORTED_METHOD internal_construct();
|
||||
|
||||
// Mutex traits
|
||||
static const bool is_rw_mutex = false;
|
||||
static const bool is_recursive_mutex = false;
|
||||
static const bool is_fair_mutex = false;
|
||||
|
||||
// ISO C++0x compatibility methods
|
||||
|
||||
//! Acquire lock
|
||||
void lock() {
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
new(tmp.begin()) scoped_lock(*this);
|
||||
#else
|
||||
__TBB_LockByte(flag);
|
||||
#endif /* TBB_USE_THREADING_TOOLS*/
|
||||
}
|
||||
|
||||
//! Try acquiring lock (non-blocking)
|
||||
/** Return true if lock acquired; false otherwise. */
|
||||
bool try_lock() {
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
return (new(tmp.begin()) scoped_lock)->internal_try_acquire(*this);
|
||||
#else
|
||||
return __TBB_TryLockByte(flag);
|
||||
#endif /* TBB_USE_THREADING_TOOLS*/
|
||||
}
|
||||
|
||||
//! Release lock
|
||||
void unlock() {
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
aligned_space<scoped_lock,1> tmp;
|
||||
scoped_lock& s = *tmp.begin();
|
||||
s.my_mutex = this;
|
||||
s.my_unlock_value = 0;
|
||||
s.internal_release();
|
||||
#else
|
||||
__TBB_store_with_release(flag, 0);
|
||||
#endif /* TBB_USE_THREADING_TOOLS */
|
||||
}
|
||||
|
||||
friend class scoped_lock;
|
||||
};
|
||||
|
||||
__TBB_DEFINE_PROFILING_SET_NAME(spin_mutex)
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_spin_mutex_H */
|
||||
|
|
@ -1,229 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_spin_rw_mutex_H
|
||||
#define __TBB_spin_rw_mutex_H
|
||||
|
||||
#include "tbb_stddef.h"
|
||||
#include "tbb_machine.h"
|
||||
#include "tbb_profiling.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
class spin_rw_mutex_v3;
|
||||
typedef spin_rw_mutex_v3 spin_rw_mutex;
|
||||
|
||||
//! Fast, unfair, spinning reader-writer lock with backoff and writer-preference
|
||||
/** @ingroup synchronization */
|
||||
class spin_rw_mutex_v3 {
|
||||
//! @cond INTERNAL
|
||||
|
||||
//! Internal acquire write lock.
|
||||
bool __TBB_EXPORTED_METHOD internal_acquire_writer();
|
||||
|
||||
//! Out of line code for releasing a write lock.
|
||||
/** This code is has debug checking and instrumentation for Intel(R) Thread Checker and Intel(R) Thread Profiler. */
|
||||
void __TBB_EXPORTED_METHOD internal_release_writer();
|
||||
|
||||
//! Internal acquire read lock.
|
||||
void __TBB_EXPORTED_METHOD internal_acquire_reader();
|
||||
|
||||
//! Internal upgrade reader to become a writer.
|
||||
bool __TBB_EXPORTED_METHOD internal_upgrade();
|
||||
|
||||
//! Out of line code for downgrading a writer to a reader.
|
||||
/** This code is has debug checking and instrumentation for Intel(R) Thread Checker and Intel(R) Thread Profiler. */
|
||||
void __TBB_EXPORTED_METHOD internal_downgrade();
|
||||
|
||||
//! Internal release read lock.
|
||||
void __TBB_EXPORTED_METHOD internal_release_reader();
|
||||
|
||||
//! Internal try_acquire write lock.
|
||||
bool __TBB_EXPORTED_METHOD internal_try_acquire_writer();
|
||||
|
||||
//! Internal try_acquire read lock.
|
||||
bool __TBB_EXPORTED_METHOD internal_try_acquire_reader();
|
||||
|
||||
//! @endcond
|
||||
public:
|
||||
//! Construct unacquired mutex.
|
||||
spin_rw_mutex_v3() : state(0) {
|
||||
#if TBB_USE_THREADING_TOOLS
|
||||
internal_construct();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TBB_USE_ASSERT
|
||||
//! Destructor asserts if the mutex is acquired, i.e. state is zero.
|
||||
~spin_rw_mutex_v3() {
|
||||
__TBB_ASSERT( !state, "destruction of an acquired mutex");
|
||||
};
|
||||
#endif /* TBB_USE_ASSERT */
|
||||
|
||||
//! The scoped locking pattern
|
||||
/** It helps to avoid the common problem of forgetting to release lock.
|
||||
It also nicely provides the "node" for queuing locks. */
|
||||
class scoped_lock : internal::no_copy {
|
||||
public:
|
||||
//! Construct lock that has not acquired a mutex.
|
||||
/** Equivalent to zero-initialization of *this. */
|
||||
scoped_lock() : mutex(NULL), is_writer(false) {}
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
/** Upon entry, *this should not be in the "have acquired a mutex" state. */
|
||||
scoped_lock( spin_rw_mutex& m, bool write = true ) : mutex(NULL) {
|
||||
acquire(m, write);
|
||||
}
|
||||
|
||||
//! Release lock (if lock is held).
|
||||
~scoped_lock() {
|
||||
if( mutex ) release();
|
||||
}
|
||||
|
||||
//! Acquire lock on given mutex.
|
||||
void acquire( spin_rw_mutex& m, bool write = true ) {
|
||||
__TBB_ASSERT( !mutex, "holding mutex already" );
|
||||
is_writer = write;
|
||||
mutex = &m;
|
||||
if( write ) mutex->internal_acquire_writer();
|
||||
else mutex->internal_acquire_reader();
|
||||
}
|
||||
|
||||
//! Upgrade reader to become a writer.
|
||||
/** Returns true if the upgrade happened without re-acquiring the lock and false if opposite */
|
||||
bool upgrade_to_writer() {
|
||||
__TBB_ASSERT( mutex, "lock is not acquired" );
|
||||
__TBB_ASSERT( !is_writer, "not a reader" );
|
||||
is_writer = true;
|
||||
return mutex->internal_upgrade();
|
||||
}
|
||||
|
||||
//! Release lock.
|
||||
void release() {
|
||||
__TBB_ASSERT( mutex, "lock is not acquired" );
|
||||
spin_rw_mutex *m = mutex;
|
||||
mutex = NULL;
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
if( is_writer ) m->internal_release_writer();
|
||||
else m->internal_release_reader();
|
||||
#else
|
||||
if( is_writer ) __TBB_AtomicAND( &m->state, READERS );
|
||||
else __TBB_FetchAndAddWrelease( &m->state, -(intptr_t)ONE_READER);
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Downgrade writer to become a reader.
|
||||
bool downgrade_to_reader() {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
__TBB_ASSERT( mutex, "lock is not acquired" );
|
||||
__TBB_ASSERT( is_writer, "not a writer" );
|
||||
mutex->internal_downgrade();
|
||||
#else
|
||||
__TBB_FetchAndAddW( &mutex->state, ((intptr_t)ONE_READER-WRITER));
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
|
||||
is_writer = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//! Try acquire lock on given mutex.
|
||||
bool try_acquire( spin_rw_mutex& m, bool write = true ) {
|
||||
__TBB_ASSERT( !mutex, "holding mutex already" );
|
||||
bool result;
|
||||
is_writer = write;
|
||||
result = write? m.internal_try_acquire_writer()
|
||||
: m.internal_try_acquire_reader();
|
||||
if( result )
|
||||
mutex = &m;
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
//! The pointer to the current mutex that is held, or NULL if no mutex is held.
|
||||
spin_rw_mutex* mutex;
|
||||
|
||||
//! If mutex!=NULL, then is_writer is true if holding a writer lock, false if holding a reader lock.
|
||||
/** Not defined if not holding a lock. */
|
||||
bool is_writer;
|
||||
};
|
||||
|
||||
// Mutex traits
|
||||
static const bool is_rw_mutex = true;
|
||||
static const bool is_recursive_mutex = false;
|
||||
static const bool is_fair_mutex = false;
|
||||
|
||||
// ISO C++0x compatibility methods
|
||||
|
||||
//! Acquire writer lock
|
||||
void lock() {internal_acquire_writer();}
|
||||
|
||||
//! Try acquiring writer lock (non-blocking)
|
||||
/** Return true if lock acquired; false otherwise. */
|
||||
bool try_lock() {return internal_try_acquire_writer();}
|
||||
|
||||
//! Release lock
|
||||
void unlock() {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
if( state&WRITER ) internal_release_writer();
|
||||
else internal_release_reader();
|
||||
#else
|
||||
if( state&WRITER ) __TBB_AtomicAND( &state, READERS );
|
||||
else __TBB_FetchAndAddWrelease( &state, -(intptr_t)ONE_READER);
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
// Methods for reader locks that resemble ISO C++0x compatibility methods.
|
||||
|
||||
//! Acquire reader lock
|
||||
void lock_read() {internal_acquire_reader();}
|
||||
|
||||
//! Try acquiring reader lock (non-blocking)
|
||||
/** Return true if reader lock acquired; false otherwise. */
|
||||
bool try_lock_read() {return internal_try_acquire_reader();}
|
||||
|
||||
private:
|
||||
typedef intptr_t state_t;
|
||||
static const state_t WRITER = 1;
|
||||
static const state_t WRITER_PENDING = 2;
|
||||
static const state_t READERS = ~(WRITER | WRITER_PENDING);
|
||||
static const state_t ONE_READER = 4;
|
||||
static const state_t BUSY = WRITER | READERS;
|
||||
//! State of lock
|
||||
/** Bit 0 = writer is holding lock
|
||||
Bit 1 = request by a writer to acquire lock (hint to readers to wait)
|
||||
Bit 2..N = number of readers holding lock */
|
||||
state_t state;
|
||||
|
||||
void __TBB_EXPORTED_METHOD internal_construct();
|
||||
};
|
||||
|
||||
__TBB_DEFINE_PROFILING_SET_NAME(spin_rw_mutex)
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_spin_rw_mutex_H */
|
||||
|
|
@ -1,787 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_task_H
|
||||
#define __TBB_task_H
|
||||
|
||||
#include "tbb_stddef.h"
|
||||
#include "tbb_machine.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
class task;
|
||||
class task_list;
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
class task_group_context;
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
|
||||
class scheduler: no_copy {
|
||||
public:
|
||||
//! For internal use only
|
||||
virtual void spawn( task& first, task*& next ) = 0;
|
||||
|
||||
//! For internal use only
|
||||
virtual void wait_for_all( task& parent, task* child ) = 0;
|
||||
|
||||
//! For internal use only
|
||||
virtual void spawn_root_and_wait( task& first, task*& next ) = 0;
|
||||
|
||||
//! Pure virtual destructor;
|
||||
// Have to have it just to shut up overzealous compilation warnings
|
||||
virtual ~scheduler() = 0;
|
||||
};
|
||||
|
||||
//! A reference count
|
||||
/** Should always be non-negative. A signed type is used so that underflow can be detected. */
|
||||
typedef intptr reference_count;
|
||||
|
||||
//! An id as used for specifying affinity.
|
||||
typedef unsigned short affinity_id;
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
struct context_list_node_t {
|
||||
context_list_node_t *my_prev,
|
||||
*my_next;
|
||||
};
|
||||
|
||||
class allocate_root_with_context_proxy: no_assign {
|
||||
task_group_context& my_context;
|
||||
public:
|
||||
allocate_root_with_context_proxy ( task_group_context& ctx ) : my_context(ctx) {}
|
||||
task& __TBB_EXPORTED_METHOD allocate( size_t size ) const;
|
||||
void __TBB_EXPORTED_METHOD free( task& ) const;
|
||||
};
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
class allocate_root_proxy: no_assign {
|
||||
public:
|
||||
static task& __TBB_EXPORTED_FUNC allocate( size_t size );
|
||||
static void __TBB_EXPORTED_FUNC free( task& );
|
||||
};
|
||||
|
||||
class allocate_continuation_proxy: no_assign {
|
||||
public:
|
||||
task& __TBB_EXPORTED_METHOD allocate( size_t size ) const;
|
||||
void __TBB_EXPORTED_METHOD free( task& ) const;
|
||||
};
|
||||
|
||||
class allocate_child_proxy: no_assign {
|
||||
public:
|
||||
task& __TBB_EXPORTED_METHOD allocate( size_t size ) const;
|
||||
void __TBB_EXPORTED_METHOD free( task& ) const;
|
||||
};
|
||||
|
||||
class allocate_additional_child_of_proxy: no_assign {
|
||||
task& self;
|
||||
task& parent;
|
||||
public:
|
||||
allocate_additional_child_of_proxy( task& self_, task& parent_ ) : self(self_), parent(parent_) {}
|
||||
task& __TBB_EXPORTED_METHOD allocate( size_t size ) const;
|
||||
void __TBB_EXPORTED_METHOD free( task& ) const;
|
||||
};
|
||||
|
||||
class task_group_base;
|
||||
|
||||
//! Memory prefix to a task object.
|
||||
/** This class is internal to the library.
|
||||
Do not reference it directly, except within the library itself.
|
||||
Fields are ordered in way that preserves backwards compatibility and yields
|
||||
good packing on typical 32-bit and 64-bit platforms.
|
||||
@ingroup task_scheduling */
|
||||
class task_prefix {
|
||||
private:
|
||||
friend class tbb::task;
|
||||
friend class tbb::task_list;
|
||||
friend class internal::scheduler;
|
||||
friend class internal::allocate_root_proxy;
|
||||
friend class internal::allocate_child_proxy;
|
||||
friend class internal::allocate_continuation_proxy;
|
||||
friend class internal::allocate_additional_child_of_proxy;
|
||||
friend class internal::task_group_base;
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Shared context that is used to communicate asynchronous state changes
|
||||
/** Currently it is used to broadcast cancellation requests generated both
|
||||
by users and as the result of unhandled exceptions in the task::execute()
|
||||
methods. */
|
||||
task_group_context *context;
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
//! The scheduler that allocated the task, or NULL if the task is big.
|
||||
/** Small tasks are pooled by the scheduler that allocated the task.
|
||||
If a scheduler needs to free a small task allocated by another scheduler,
|
||||
it returns the task to that other scheduler. This policy avoids
|
||||
memory space blowup issues for memory allocators that allocate from
|
||||
thread-specific pools. */
|
||||
scheduler* origin;
|
||||
|
||||
//! The scheduler that owns the task.
|
||||
scheduler* owner;
|
||||
|
||||
//! The task whose reference count includes me.
|
||||
/** In the "blocking style" of programming, this field points to the parent task.
|
||||
In the "continuation-passing style" of programming, this field points to the
|
||||
continuation of the parent. */
|
||||
tbb::task* parent;
|
||||
|
||||
//! Reference count used for synchronization.
|
||||
/** In the "continuation-passing style" of programming, this field is
|
||||
the difference of the number of allocated children minus the
|
||||
number of children that have completed.
|
||||
In the "blocking style" of programming, this field is one more than the difference. */
|
||||
reference_count ref_count;
|
||||
|
||||
//! Obsolete. Used to be scheduling depth before TBB 2.2
|
||||
/** Retained only for the sake of backward binary compatibility. **/
|
||||
int depth;
|
||||
|
||||
//! A task::state_type, stored as a byte for compactness.
|
||||
/** This state is exposed to users via method task::state(). */
|
||||
unsigned char state;
|
||||
|
||||
//! Miscellaneous state that is not directly visible to users, stored as a byte for compactness.
|
||||
/** 0x0 -> version 1.0 task
|
||||
0x1 -> version 3.0 task
|
||||
0x2 -> task_proxy
|
||||
0x40 -> task has live ref_count */
|
||||
unsigned char extra_state;
|
||||
|
||||
affinity_id affinity;
|
||||
|
||||
//! "next" field for list of task
|
||||
tbb::task* next;
|
||||
|
||||
//! The task corresponding to this task_prefix.
|
||||
tbb::task& task() {return *reinterpret_cast<tbb::task*>(this+1);}
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
|
||||
#if TBB_USE_CAPTURED_EXCEPTION
|
||||
class tbb_exception;
|
||||
#else
|
||||
namespace internal {
|
||||
class tbb_exception_ptr;
|
||||
}
|
||||
#endif /* !TBB_USE_CAPTURED_EXCEPTION */
|
||||
|
||||
//! Used to form groups of tasks
|
||||
/** @ingroup task_scheduling
|
||||
The context services explicit cancellation requests from user code, and unhandled
|
||||
exceptions intercepted during tasks execution. Intercepting an exception results
|
||||
in generating internal cancellation requests (which is processed in exactly the
|
||||
same way as external ones).
|
||||
|
||||
The context is associated with one or more root tasks and defines the cancellation
|
||||
group that includes all the descendants of the corresponding root task(s). Association
|
||||
is established when a context object is passed as an argument to the task::allocate_root()
|
||||
method. See task_group_context::task_group_context for more details.
|
||||
|
||||
The context can be bound to another one, and other contexts can be bound to it,
|
||||
forming a tree-like structure: parent -> this -> children. Arrows here designate
|
||||
cancellation propagation direction. If a task in a cancellation group is canceled
|
||||
all the other tasks in this group and groups bound to it (as children) get canceled too.
|
||||
|
||||
IMPLEMENTATION NOTE:
|
||||
When adding new members to task_group_context or changing types of existing ones,
|
||||
update the size of both padding buffers (_leading_padding and _trailing_padding)
|
||||
appropriately. See also VERSIONING NOTE at the constructor definition below. **/
|
||||
class task_group_context : internal::no_copy
|
||||
{
|
||||
private:
|
||||
#if TBB_USE_CAPTURED_EXCEPTION
|
||||
typedef tbb_exception exception_container_type;
|
||||
#else
|
||||
typedef internal::tbb_exception_ptr exception_container_type;
|
||||
#endif
|
||||
|
||||
enum version_traits_word_layout {
|
||||
traits_offset = 16,
|
||||
version_mask = 0xFFFF,
|
||||
traits_mask = 0xFFFFul << traits_offset
|
||||
};
|
||||
|
||||
public:
|
||||
enum kind_type {
|
||||
isolated,
|
||||
bound
|
||||
};
|
||||
|
||||
enum traits_type {
|
||||
exact_exception = 0x0001ul << traits_offset,
|
||||
no_cancellation = 0x0002ul << traits_offset,
|
||||
concurrent_wait = 0x0004ul << traits_offset,
|
||||
#if TBB_USE_CAPTURED_EXCEPTION
|
||||
default_traits = 0
|
||||
#else
|
||||
default_traits = exact_exception
|
||||
#endif /* !TBB_USE_CAPTURED_EXCEPTION */
|
||||
};
|
||||
|
||||
private:
|
||||
union {
|
||||
//! Flavor of this context: bound or isolated.
|
||||
kind_type my_kind;
|
||||
uintptr_t _my_kind_aligner;
|
||||
};
|
||||
|
||||
//! Pointer to the context of the parent cancellation group. NULL for isolated contexts.
|
||||
task_group_context *my_parent;
|
||||
|
||||
//! Used to form the thread specific list of contexts without additional memory allocation.
|
||||
/** A context is included into the list of the current thread when its binding to
|
||||
its parent happens. Any context can be present in the list of one thread only. **/
|
||||
internal::context_list_node_t my_node;
|
||||
|
||||
//! Leading padding protecting accesses to frequently used members from false sharing.
|
||||
/** Read accesses to the field my_cancellation_requested are on the hot path inside
|
||||
the scheduler. This padding ensures that this field never shares the same cache
|
||||
line with a local variable that is frequently written to. **/
|
||||
char _leading_padding[internal::NFS_MaxLineSize -
|
||||
2 * sizeof(uintptr_t)- sizeof(void*) - sizeof(internal::context_list_node_t)];
|
||||
|
||||
//! Specifies whether cancellation was request for this task group.
|
||||
uintptr_t my_cancellation_requested;
|
||||
|
||||
//! Version for run-time checks and behavioral traits of the context.
|
||||
/** Version occupies low 16 bits, and traits (zero or more ORed enumerators
|
||||
from the traits_type enumerations) take the next 16 bits.
|
||||
Original (zeroth) version of the context did not support any traits. **/
|
||||
uintptr_t my_version_and_traits;
|
||||
|
||||
//! Pointer to the container storing exception being propagated across this task group.
|
||||
exception_container_type *my_exception;
|
||||
|
||||
//! Scheduler that registered this context in its thread specific list.
|
||||
/** This field is not terribly necessary, but it allows to get a small performance
|
||||
benefit by getting us rid of using thread local storage. We do not care
|
||||
about extra memory it takes since this data structure is excessively padded anyway. **/
|
||||
void *my_owner;
|
||||
|
||||
//! Trailing padding protecting accesses to frequently used members from false sharing
|
||||
/** \sa _leading_padding **/
|
||||
char _trailing_padding[internal::NFS_MaxLineSize - sizeof(intptr_t) - 2 * sizeof(void*)];
|
||||
|
||||
public:
|
||||
//! Default & binding constructor.
|
||||
/** By default a bound context is created. That is this context will be bound
|
||||
(as child) to the context of the task calling task::allocate_root(this_context)
|
||||
method. Cancellation requests passed to the parent context are propagated
|
||||
to all the contexts bound to it.
|
||||
|
||||
If task_group_context::isolated is used as the argument, then the tasks associated
|
||||
with this context will never be affected by events in any other context.
|
||||
|
||||
Creating isolated contexts involve much less overhead, but they have limited
|
||||
utility. Normally when an exception occurs in an algorithm that has nested
|
||||
ones running, it is desirably to have all the nested algorithms canceled
|
||||
as well. Such a behavior requires nested algorithms to use bound contexts.
|
||||
|
||||
There is one good place where using isolated algorithms is beneficial. It is
|
||||
a master thread. That is if a particular algorithm is invoked directly from
|
||||
the master thread (not from a TBB task), supplying it with explicitly
|
||||
created isolated context will result in a faster algorithm startup.
|
||||
|
||||
VERSIONING NOTE:
|
||||
Implementation(s) of task_group_context constructor(s) cannot be made
|
||||
entirely out-of-line because the run-time version must be set by the user
|
||||
code. This will become critically important for binary compatibility, if
|
||||
we ever have to change the size of the context object.
|
||||
|
||||
Boosting the runtime version will also be necessary whenever new fields
|
||||
are introduced in the currently unused padding areas or the meaning of
|
||||
the existing fields is changed or extended. **/
|
||||
task_group_context ( kind_type relation_with_parent = bound,
|
||||
uintptr_t traits = default_traits )
|
||||
: my_kind(relation_with_parent)
|
||||
, my_version_and_traits(1 | traits)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
__TBB_EXPORTED_METHOD ~task_group_context ();
|
||||
|
||||
//! Forcefully reinitializes the context after the task tree it was associated with is completed.
|
||||
/** Because the method assumes that all the tasks that used to be associated with
|
||||
this context have already finished, calling it while the context is still
|
||||
in use somewhere in the task hierarchy leads to undefined behavior.
|
||||
|
||||
IMPORTANT: This method is not thread safe!
|
||||
|
||||
The method does not change the context's parent if it is set. **/
|
||||
void __TBB_EXPORTED_METHOD reset ();
|
||||
|
||||
//! Initiates cancellation of all tasks in this cancellation group and its subordinate groups.
|
||||
/** \return false if cancellation has already been requested, true otherwise.
|
||||
|
||||
Note that canceling never fails. When false is returned, it just means that
|
||||
another thread (or this one) has already sent cancellation request to this
|
||||
context or to one of its ancestors (if this context is bound). It is guaranteed
|
||||
that when this method is concurrently called on the same not yet cancelled
|
||||
context, true will be returned by one and only one invocation. **/
|
||||
bool __TBB_EXPORTED_METHOD cancel_group_execution ();
|
||||
|
||||
//! Returns true if the context received cancellation request.
|
||||
bool __TBB_EXPORTED_METHOD is_group_execution_cancelled () const;
|
||||
|
||||
//! Records the pending exception, and cancels the task group.
|
||||
/** May be called only from inside a catch-block. If the context is already
|
||||
canceled, does nothing.
|
||||
The method brings the task group associated with this context exactly into
|
||||
the state it would be in, if one of its tasks threw the currently pending
|
||||
exception during its execution. In other words, it emulates the actions
|
||||
of the scheduler's dispatch loop exception handler. **/
|
||||
void __TBB_EXPORTED_METHOD register_pending_exception ();
|
||||
|
||||
protected:
|
||||
//! Out-of-line part of the constructor.
|
||||
/** Singled out to ensure backward binary compatibility of the future versions. **/
|
||||
void __TBB_EXPORTED_METHOD init ();
|
||||
|
||||
private:
|
||||
friend class task;
|
||||
friend class internal::allocate_root_with_context_proxy;
|
||||
|
||||
static const kind_type binding_required = bound;
|
||||
static const kind_type binding_completed = kind_type(bound+1);
|
||||
|
||||
//! Checks if any of the ancestors has a cancellation request outstanding,
|
||||
//! and propagates it back to descendants.
|
||||
void propagate_cancellation_from_ancestors ();
|
||||
|
||||
//! For debugging purposes only.
|
||||
bool is_alive () {
|
||||
#if TBB_USE_DEBUG
|
||||
return my_version_and_traits != 0xDeadBeef;
|
||||
#else
|
||||
return true;
|
||||
#endif /* TBB_USE_DEBUG */
|
||||
}
|
||||
}; // class task_group_context
|
||||
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
//! Base class for user-defined tasks.
|
||||
/** @ingroup task_scheduling */
|
||||
class task: internal::no_copy {
|
||||
//! Set reference count
|
||||
void __TBB_EXPORTED_METHOD internal_set_ref_count( int count );
|
||||
|
||||
//! Decrement reference count and return true if non-zero.
|
||||
internal::reference_count __TBB_EXPORTED_METHOD internal_decrement_ref_count();
|
||||
|
||||
protected:
|
||||
//! Default constructor.
|
||||
task() {prefix().extra_state=1;}
|
||||
|
||||
public:
|
||||
//! Destructor.
|
||||
virtual ~task() {}
|
||||
|
||||
//! Should be overridden by derived classes.
|
||||
virtual task* execute() = 0;
|
||||
|
||||
//! Enumeration of task states that the scheduler considers.
|
||||
enum state_type {
|
||||
//! task is running, and will be destroyed after method execute() completes.
|
||||
executing,
|
||||
//! task to be rescheduled.
|
||||
reexecute,
|
||||
//! task is in ready pool, or is going to be put there, or was just taken off.
|
||||
ready,
|
||||
//! task object is freshly allocated or recycled.
|
||||
allocated,
|
||||
//! task object is on free list, or is going to be put there, or was just taken off.
|
||||
freed,
|
||||
//! task to be recycled as continuation
|
||||
recycle
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Allocating tasks
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//! Returns proxy for overloaded new that allocates a root task.
|
||||
static internal::allocate_root_proxy allocate_root() {
|
||||
return internal::allocate_root_proxy();
|
||||
}
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Returns proxy for overloaded new that allocates a root task associated with user supplied context.
|
||||
static internal::allocate_root_with_context_proxy allocate_root( task_group_context& ctx ) {
|
||||
return internal::allocate_root_with_context_proxy(ctx);
|
||||
}
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
//! Returns proxy for overloaded new that allocates a continuation task of *this.
|
||||
/** The continuation's parent becomes the parent of *this. */
|
||||
internal::allocate_continuation_proxy& allocate_continuation() {
|
||||
return *reinterpret_cast<internal::allocate_continuation_proxy*>(this);
|
||||
}
|
||||
|
||||
//! Returns proxy for overloaded new that allocates a child task of *this.
|
||||
internal::allocate_child_proxy& allocate_child() {
|
||||
return *reinterpret_cast<internal::allocate_child_proxy*>(this);
|
||||
}
|
||||
|
||||
//! Like allocate_child, except that task's parent becomes "t", not this.
|
||||
/** Typically used in conjunction with schedule_to_reexecute to implement while loops.
|
||||
Atomically increments the reference count of t.parent() */
|
||||
internal::allocate_additional_child_of_proxy allocate_additional_child_of( task& t ) {
|
||||
return internal::allocate_additional_child_of_proxy(*this,t);
|
||||
}
|
||||
|
||||
//! Destroy a task.
|
||||
/** Usually, calling this method is unnecessary, because a task is
|
||||
implicitly deleted after its execute() method runs. However,
|
||||
sometimes a task needs to be explicitly deallocated, such as
|
||||
when a root task is used as the parent in spawn_and_wait_for_all. */
|
||||
void __TBB_EXPORTED_METHOD destroy( task& victim );
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Recycling of tasks
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//! Change this to be a continuation of its former self.
|
||||
/** The caller must guarantee that the task's refcount does not become zero until
|
||||
after the method execute() returns. Typically, this is done by having
|
||||
method execute() return a pointer to a child of the task. If the guarantee
|
||||
cannot be made, use method recycle_as_safe_continuation instead.
|
||||
|
||||
Because of the hazard, this method may be deprecated in the future. */
|
||||
void recycle_as_continuation() {
|
||||
__TBB_ASSERT( prefix().state==executing, "execute not running?" );
|
||||
prefix().state = allocated;
|
||||
}
|
||||
|
||||
//! Recommended to use, safe variant of recycle_as_continuation
|
||||
/** For safety, it requires additional increment of ref_count. */
|
||||
void recycle_as_safe_continuation() {
|
||||
__TBB_ASSERT( prefix().state==executing, "execute not running?" );
|
||||
prefix().state = recycle;
|
||||
}
|
||||
|
||||
//! Change this to be a child of new_parent.
|
||||
void recycle_as_child_of( task& new_parent ) {
|
||||
internal::task_prefix& p = prefix();
|
||||
__TBB_ASSERT( prefix().state==executing||prefix().state==allocated, "execute not running, or already recycled" );
|
||||
__TBB_ASSERT( prefix().ref_count==0, "no child tasks allowed when recycled as a child" );
|
||||
__TBB_ASSERT( p.parent==NULL, "parent must be null" );
|
||||
__TBB_ASSERT( new_parent.prefix().state<=recycle, "corrupt parent's state" );
|
||||
__TBB_ASSERT( new_parent.prefix().state!=freed, "parent already freed" );
|
||||
p.state = allocated;
|
||||
p.parent = &new_parent;
|
||||
#if __TBB_EXCEPTIONS
|
||||
p.context = new_parent.prefix().context;
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
}
|
||||
|
||||
//! Schedule this for reexecution after current execute() returns.
|
||||
/** Requires that this.execute() be running. */
|
||||
void recycle_to_reexecute() {
|
||||
__TBB_ASSERT( prefix().state==executing, "execute not running, or already recycled" );
|
||||
__TBB_ASSERT( prefix().ref_count==0, "no child tasks allowed when recycled for reexecution" );
|
||||
prefix().state = reexecute;
|
||||
}
|
||||
|
||||
// All depth-related methods are obsolete, and are retained for the sake
|
||||
// of backward source compatibility only
|
||||
intptr_t depth() const {return 0;}
|
||||
void set_depth( intptr_t ) {}
|
||||
void add_to_depth( int ) {}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Spawning and blocking
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//! Set reference count
|
||||
void set_ref_count( int count ) {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
internal_set_ref_count(count);
|
||||
#else
|
||||
prefix().ref_count = count;
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Atomically increment reference count.
|
||||
/** Has acquire semantics */
|
||||
void increment_ref_count() {
|
||||
__TBB_FetchAndIncrementWacquire( &prefix().ref_count );
|
||||
}
|
||||
|
||||
//! Atomically decrement reference count.
|
||||
/** Has release semanics. */
|
||||
int decrement_ref_count() {
|
||||
#if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT
|
||||
return int(internal_decrement_ref_count());
|
||||
#else
|
||||
return int(__TBB_FetchAndDecrementWrelease( &prefix().ref_count ))-1;
|
||||
#endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */
|
||||
}
|
||||
|
||||
//! Schedule task for execution when a worker becomes available.
|
||||
/** After all children spawned so far finish their method task::execute,
|
||||
their parent's method task::execute may start running. Therefore, it
|
||||
is important to ensure that at least one child has not completed until
|
||||
the parent is ready to run. */
|
||||
void spawn( task& child ) {
|
||||
prefix().owner->spawn( child, child.prefix().next );
|
||||
}
|
||||
|
||||
//! Spawn multiple tasks and clear list.
|
||||
void spawn( task_list& list );
|
||||
|
||||
//! Similar to spawn followed by wait_for_all, but more efficient.
|
||||
void spawn_and_wait_for_all( task& child ) {
|
||||
prefix().owner->wait_for_all( *this, &child );
|
||||
}
|
||||
|
||||
//! Similar to spawn followed by wait_for_all, but more efficient.
|
||||
void __TBB_EXPORTED_METHOD spawn_and_wait_for_all( task_list& list );
|
||||
|
||||
//! Spawn task allocated by allocate_root, wait for it to complete, and deallocate it.
|
||||
/** The thread that calls spawn_root_and_wait must be the same thread
|
||||
that allocated the task. */
|
||||
static void spawn_root_and_wait( task& root ) {
|
||||
root.prefix().owner->spawn_root_and_wait( root, root.prefix().next );
|
||||
}
|
||||
|
||||
//! Spawn root tasks on list and wait for all of them to finish.
|
||||
/** If there are more tasks than worker threads, the tasks are spawned in
|
||||
order of front to back. */
|
||||
static void spawn_root_and_wait( task_list& root_list );
|
||||
|
||||
//! Wait for reference count to become one, and set reference count to zero.
|
||||
/** Works on tasks while waiting. */
|
||||
void wait_for_all() {
|
||||
prefix().owner->wait_for_all( *this, NULL );
|
||||
}
|
||||
|
||||
//! The innermost task being executed or destroyed by the current thread at the moment.
|
||||
static task& __TBB_EXPORTED_FUNC self();
|
||||
|
||||
//! task on whose behalf this task is working, or NULL if this is a root.
|
||||
task* parent() const {return prefix().parent;}
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Shared context that is used to communicate asynchronous state changes
|
||||
task_group_context* context() {return prefix().context;}
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
//! True if task is owned by different thread than thread that owns its parent.
|
||||
bool is_stolen_task() const {
|
||||
internal::task_prefix& p = prefix();
|
||||
internal::task_prefix& q = parent()->prefix();
|
||||
return p.owner!=q.owner;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Debugging
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//! Current execution state
|
||||
state_type state() const {return state_type(prefix().state);}
|
||||
|
||||
//! The internal reference count.
|
||||
int ref_count() const {
|
||||
#if TBB_USE_ASSERT
|
||||
internal::reference_count ref_count = prefix().ref_count;
|
||||
__TBB_ASSERT( ref_count==int(ref_count), "integer overflow error");
|
||||
#endif
|
||||
return int(prefix().ref_count);
|
||||
}
|
||||
|
||||
//! Obsolete, and only retained for the sake of backward compatibility. Always returns true.
|
||||
bool __TBB_EXPORTED_METHOD is_owned_by_current_thread() const;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Affinity
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//! An id as used for specifying affinity.
|
||||
/** Guaranteed to be integral type. Value of 0 means no affinity. */
|
||||
typedef internal::affinity_id affinity_id;
|
||||
|
||||
//! Set affinity for this task.
|
||||
void set_affinity( affinity_id id ) {prefix().affinity = id;}
|
||||
|
||||
//! Current affinity of this task
|
||||
affinity_id affinity() const {return prefix().affinity;}
|
||||
|
||||
//! Invoked by scheduler to notify task that it ran on unexpected thread.
|
||||
/** Invoked before method execute() runs, if task is stolen, or task has
|
||||
affinity but will be executed on another thread.
|
||||
|
||||
The default action does nothing. */
|
||||
virtual void __TBB_EXPORTED_METHOD note_affinity( affinity_id id );
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
//! Initiates cancellation of all tasks in this cancellation group and its subordinate groups.
|
||||
/** \return false if cancellation has already been requested, true otherwise. **/
|
||||
bool cancel_group_execution () { return prefix().context->cancel_group_execution(); }
|
||||
|
||||
//! Returns true if the context received cancellation request.
|
||||
bool is_cancelled () const { return prefix().context->is_group_execution_cancelled(); }
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
private:
|
||||
friend class task_list;
|
||||
friend class internal::scheduler;
|
||||
friend class internal::allocate_root_proxy;
|
||||
#if __TBB_EXCEPTIONS
|
||||
friend class internal::allocate_root_with_context_proxy;
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
friend class internal::allocate_continuation_proxy;
|
||||
friend class internal::allocate_child_proxy;
|
||||
friend class internal::allocate_additional_child_of_proxy;
|
||||
|
||||
friend class internal::task_group_base;
|
||||
|
||||
//! Get reference to corresponding task_prefix.
|
||||
/** Version tag prevents loader on Linux from using the wrong symbol in debug builds. **/
|
||||
internal::task_prefix& prefix( internal::version_tag* = NULL ) const {
|
||||
return reinterpret_cast<internal::task_prefix*>(const_cast<task*>(this))[-1];
|
||||
}
|
||||
}; // class task
|
||||
|
||||
//! task that does nothing. Useful for synchronization.
|
||||
/** @ingroup task_scheduling */
|
||||
class empty_task: public task {
|
||||
/*override*/ task* execute() {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
//! A list of children.
|
||||
/** Used for method task::spawn_children
|
||||
@ingroup task_scheduling */
|
||||
class task_list: internal::no_copy {
|
||||
private:
|
||||
task* first;
|
||||
task** next_ptr;
|
||||
friend class task;
|
||||
public:
|
||||
//! Construct empty list
|
||||
task_list() : first(NULL), next_ptr(&first) {}
|
||||
|
||||
//! Destroys the list, but does not destroy the task objects.
|
||||
~task_list() {}
|
||||
|
||||
//! True if list if empty; false otherwise.
|
||||
bool empty() const {return !first;}
|
||||
|
||||
//! Push task onto back of list.
|
||||
void push_back( task& task ) {
|
||||
task.prefix().next = NULL;
|
||||
*next_ptr = &task;
|
||||
next_ptr = &task.prefix().next;
|
||||
}
|
||||
|
||||
//! Pop the front task from the list.
|
||||
task& pop_front() {
|
||||
__TBB_ASSERT( !empty(), "attempt to pop item from empty task_list" );
|
||||
task* result = first;
|
||||
first = result->prefix().next;
|
||||
if( !first ) next_ptr = &first;
|
||||
return *result;
|
||||
}
|
||||
|
||||
//! Clear the list
|
||||
void clear() {
|
||||
first=NULL;
|
||||
next_ptr=&first;
|
||||
}
|
||||
};
|
||||
|
||||
inline void task::spawn( task_list& list ) {
|
||||
if( task* t = list.first ) {
|
||||
prefix().owner->spawn( *t, *list.next_ptr );
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
inline void task::spawn_root_and_wait( task_list& root_list ) {
|
||||
if( task* t = root_list.first ) {
|
||||
t->prefix().owner->spawn_root_and_wait( *t, *root_list.next_ptr );
|
||||
root_list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
inline void *operator new( size_t bytes, const tbb::internal::allocate_root_proxy& ) {
|
||||
return &tbb::internal::allocate_root_proxy::allocate(bytes);
|
||||
}
|
||||
|
||||
inline void operator delete( void* task, const tbb::internal::allocate_root_proxy& ) {
|
||||
tbb::internal::allocate_root_proxy::free( *static_cast<tbb::task*>(task) );
|
||||
}
|
||||
|
||||
#if __TBB_EXCEPTIONS
|
||||
inline void *operator new( size_t bytes, const tbb::internal::allocate_root_with_context_proxy& p ) {
|
||||
return &p.allocate(bytes);
|
||||
}
|
||||
|
||||
inline void operator delete( void* task, const tbb::internal::allocate_root_with_context_proxy& p ) {
|
||||
p.free( *static_cast<tbb::task*>(task) );
|
||||
}
|
||||
#endif /* __TBB_EXCEPTIONS */
|
||||
|
||||
inline void *operator new( size_t bytes, const tbb::internal::allocate_continuation_proxy& p ) {
|
||||
return &p.allocate(bytes);
|
||||
}
|
||||
|
||||
inline void operator delete( void* task, const tbb::internal::allocate_continuation_proxy& p ) {
|
||||
p.free( *static_cast<tbb::task*>(task) );
|
||||
}
|
||||
|
||||
inline void *operator new( size_t bytes, const tbb::internal::allocate_child_proxy& p ) {
|
||||
return &p.allocate(bytes);
|
||||
}
|
||||
|
||||
inline void operator delete( void* task, const tbb::internal::allocate_child_proxy& p ) {
|
||||
p.free( *static_cast<tbb::task*>(task) );
|
||||
}
|
||||
|
||||
inline void *operator new( size_t bytes, const tbb::internal::allocate_additional_child_of_proxy& p ) {
|
||||
return &p.allocate(bytes);
|
||||
}
|
||||
|
||||
inline void operator delete( void* task, const tbb::internal::allocate_additional_child_of_proxy& p ) {
|
||||
p.free( *static_cast<tbb::task*>(task) );
|
||||
}
|
||||
|
||||
#endif /* __TBB_task_H */
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_task_group_H
|
||||
#define __TBB_task_group_H
|
||||
|
||||
#include "task.h"
|
||||
#include <exception>
|
||||
|
||||
namespace tbb {
|
||||
|
||||
template<typename F>
|
||||
class task_handle {
|
||||
F my_func;
|
||||
|
||||
public:
|
||||
task_handle( const F& f ) : my_func(f) {}
|
||||
|
||||
void operator()() { my_func(); }
|
||||
};
|
||||
|
||||
enum task_group_status {
|
||||
not_complete,
|
||||
complete,
|
||||
canceled
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
|
||||
// Suppress gratuitous warnings from icc 11.0 when lambda expressions are used in instances of function_task.
|
||||
//#pragma warning(disable: 588)
|
||||
|
||||
template<typename F>
|
||||
class function_task : public task {
|
||||
F my_func;
|
||||
/*override*/ task* execute() {
|
||||
my_func();
|
||||
return NULL;
|
||||
}
|
||||
public:
|
||||
function_task( const F& f ) : my_func(f) {}
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
class task_handle_task : public task {
|
||||
task_handle<F>& my_handle;
|
||||
/*override*/ task* execute() {
|
||||
my_handle();
|
||||
return NULL;
|
||||
}
|
||||
public:
|
||||
task_handle_task( task_handle<F>& h ) : my_handle(h) {}
|
||||
};
|
||||
|
||||
class task_group_base : internal::no_copy {
|
||||
protected:
|
||||
empty_task* my_root;
|
||||
task_group_context my_context;
|
||||
|
||||
task& owner () { return *my_root; }
|
||||
|
||||
template<typename F>
|
||||
task_group_status internal_run_and_wait( F& f ) {
|
||||
try {
|
||||
if ( !my_context.is_group_execution_cancelled() )
|
||||
f();
|
||||
} catch ( ... ) {
|
||||
my_context.register_pending_exception();
|
||||
}
|
||||
return wait();
|
||||
}
|
||||
|
||||
template<typename F, typename Task>
|
||||
void internal_run( F& f ) {
|
||||
owner().spawn( *new( owner().allocate_additional_child_of(*my_root) ) Task(f) );
|
||||
}
|
||||
|
||||
public:
|
||||
task_group_base( uintptr_t traits = 0 )
|
||||
: my_context(task_group_context::bound, task_group_context::default_traits | traits)
|
||||
{
|
||||
my_root = new( task::allocate_root(my_context) ) empty_task;
|
||||
my_root->set_ref_count(1);
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
void run( task_handle<F>& h ) {
|
||||
internal_run< task_handle<F>, internal::task_handle_task<F> >( h );
|
||||
}
|
||||
|
||||
task_group_status wait() {
|
||||
try {
|
||||
owner().prefix().owner->wait_for_all( *my_root, NULL );
|
||||
} catch ( ... ) {
|
||||
my_context.reset();
|
||||
throw;
|
||||
}
|
||||
if ( my_context.is_group_execution_cancelled() ) {
|
||||
my_context.reset();
|
||||
return canceled;
|
||||
}
|
||||
return complete;
|
||||
}
|
||||
|
||||
bool is_canceling() {
|
||||
return my_context.is_group_execution_cancelled();
|
||||
}
|
||||
|
||||
void cancel() {
|
||||
my_context.cancel_group_execution();
|
||||
}
|
||||
}; // class task_group_base
|
||||
|
||||
} // namespace internal
|
||||
|
||||
class task_group : public internal::task_group_base {
|
||||
public:
|
||||
task_group () : task_group_base( task_group_context::concurrent_wait ) {}
|
||||
|
||||
~task_group() try {
|
||||
__TBB_ASSERT( my_root->ref_count() != 0, NULL );
|
||||
if( my_root->ref_count() > 1 )
|
||||
my_root->wait_for_all();
|
||||
owner().destroy(*my_root);
|
||||
}
|
||||
catch (...) {
|
||||
owner().destroy(*my_root);
|
||||
throw;
|
||||
}
|
||||
|
||||
#if __SUNPRO_CC
|
||||
template<typename F>
|
||||
void run( task_handle<F>& h ) {
|
||||
internal_run< task_handle<F>, internal::task_handle_task<F> >( h );
|
||||
}
|
||||
#else
|
||||
using task_group_base::run;
|
||||
#endif
|
||||
|
||||
template<typename F>
|
||||
void run( const F& f ) {
|
||||
internal_run< const F, internal::function_task<F> >( f );
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
task_group_status run_and_wait( const F& f ) {
|
||||
return internal_run_and_wait<const F>( f );
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
task_group_status run_and_wait( task_handle<F>& h ) {
|
||||
return internal_run_and_wait< task_handle<F> >( h );
|
||||
}
|
||||
}; // class task_group
|
||||
|
||||
class missing_wait : public std::exception {
|
||||
public:
|
||||
/*override*/
|
||||
const char* what() const throw() { return "wait() was not called on the structured_task_group"; }
|
||||
};
|
||||
|
||||
class structured_task_group : public internal::task_group_base {
|
||||
public:
|
||||
~structured_task_group() {
|
||||
if( my_root->ref_count() > 1 ) {
|
||||
bool stack_unwinding_in_progress = std::uncaught_exception();
|
||||
// Always attempt to do proper cleanup to avoid inevitable memory corruption
|
||||
// in case of missing wait (for the sake of better testability & debuggability)
|
||||
if ( !is_canceling() )
|
||||
cancel();
|
||||
my_root->wait_for_all();
|
||||
owner().destroy(*my_root);
|
||||
if ( !stack_unwinding_in_progress )
|
||||
throw missing_wait();
|
||||
}
|
||||
else
|
||||
owner().destroy(*my_root);
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
task_group_status run_and_wait ( task_handle<F>& h ) {
|
||||
return internal_run_and_wait< task_handle<F> >( h );
|
||||
}
|
||||
|
||||
task_group_status wait() {
|
||||
__TBB_ASSERT ( my_root->ref_count() != 0, "wait() can be called only once during the structured_task_group lifetime" );
|
||||
return task_group_base::wait();
|
||||
}
|
||||
}; // class structured_task_group
|
||||
|
||||
inline
|
||||
bool is_current_task_group_canceling() {
|
||||
return task::self().is_cancelled();
|
||||
}
|
||||
|
||||
template<class F>
|
||||
task_handle<F> make_task( const F& f ) {
|
||||
return task_handle<F>( f );
|
||||
}
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_task_group_H */
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_task_scheduler_init_H
|
||||
#define __TBB_task_scheduler_init_H
|
||||
|
||||
#include "tbb_stddef.h"
|
||||
|
||||
namespace tbb {
|
||||
|
||||
typedef std::size_t stack_size_type;
|
||||
|
||||
//! @cond INTERNAL
|
||||
namespace internal {
|
||||
//! Internal to library. Should not be used by clients.
|
||||
/** @ingroup task_scheduling */
|
||||
class scheduler;
|
||||
} // namespace internal
|
||||
//! @endcond
|
||||
|
||||
//! Class representing reference to tbb scheduler.
|
||||
/** A thread must construct a task_scheduler_init, and keep it alive,
|
||||
during the time that it uses the services of class task.
|
||||
@ingroup task_scheduling */
|
||||
class task_scheduler_init: internal::no_copy {
|
||||
/** NULL if not currently initialized. */
|
||||
internal::scheduler* my_scheduler;
|
||||
public:
|
||||
|
||||
//! Typedef for number of threads that is automatic.
|
||||
static const int automatic = -1;
|
||||
|
||||
//! Argument to initialize() or constructor that causes initialization to be deferred.
|
||||
static const int deferred = -2;
|
||||
|
||||
//! Ensure that scheduler exists for this thread
|
||||
/** A value of -1 lets tbb decide on the number of threads, which is typically
|
||||
the number of hardware threads. For production code, the default value of -1
|
||||
should be used, particularly if the client code is mixed with third party clients
|
||||
that might also use tbb.
|
||||
|
||||
The number_of_threads is ignored if any other task_scheduler_inits
|
||||
currently exist. A thread may construct multiple task_scheduler_inits.
|
||||
Doing so does no harm because the underlying scheduler is reference counted. */
|
||||
void __TBB_EXPORTED_METHOD initialize( int number_of_threads=automatic );
|
||||
|
||||
//! The overloaded method with stack size parameter
|
||||
/** Overloading is necessary to preserve ABI compatibility */
|
||||
void __TBB_EXPORTED_METHOD initialize( int number_of_threads, stack_size_type thread_stack_size );
|
||||
|
||||
//! Inverse of method initialize.
|
||||
void __TBB_EXPORTED_METHOD terminate();
|
||||
|
||||
//! Shorthand for default constructor followed by call to intialize(number_of_threads).
|
||||
task_scheduler_init( int number_of_threads=automatic, stack_size_type thread_stack_size=0 ) : my_scheduler(NULL) {
|
||||
initialize( number_of_threads, thread_stack_size );
|
||||
}
|
||||
|
||||
//! Destroy scheduler for this thread if thread has no other live task_scheduler_inits.
|
||||
~task_scheduler_init() {
|
||||
if( my_scheduler )
|
||||
terminate();
|
||||
internal::poison_pointer( my_scheduler );
|
||||
}
|
||||
//! Returns the number of threads tbb scheduler would create if initialized by default.
|
||||
/** Result returned by this method does not depend on whether the scheduler
|
||||
has already been initialized.
|
||||
|
||||
Because tbb 2.0 does not support blocking tasks yet, you may use this method
|
||||
to boost the number of threads in the tbb's internal pool, if your tasks are
|
||||
doing I/O operations. The optimal number of additional threads depends on how
|
||||
much time your tasks spend in the blocked state. */
|
||||
static int __TBB_EXPORTED_FUNC default_num_threads ();
|
||||
|
||||
//! Returns true if scheduler is active (initialized); false otherwise
|
||||
bool is_active() const { return my_scheduler != NULL; }
|
||||
};
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_task_scheduler_init_H */
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
Copyright 2005-2009 Intel Corporation. All Rights Reserved.
|
||||
|
||||
This file is part of Threading Building Blocks.
|
||||
|
||||
Threading Building Blocks is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
Threading Building Blocks is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Threading Building Blocks; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __TBB_task_scheduler_observer_H
|
||||
#define __TBB_task_scheduler_observer_H
|
||||
|
||||
#include "atomic.h"
|
||||
|
||||
#if __TBB_SCHEDULER_OBSERVER
|
||||
|
||||
namespace tbb {
|
||||
|
||||
namespace internal {
|
||||
|
||||
class observer_proxy;
|
||||
|
||||
class task_scheduler_observer_v3 {
|
||||
friend class observer_proxy;
|
||||
observer_proxy* my_proxy;
|
||||
atomic<intptr> my_busy_count;
|
||||
public:
|
||||
//! Enable or disable observation
|
||||
void __TBB_EXPORTED_METHOD observe( bool state=true );
|
||||
|
||||
//! True if observation is enables; false otherwise.
|
||||
bool is_observing() const {return my_proxy!=NULL;}
|
||||
|
||||
//! Construct observer with observation disabled.
|
||||
task_scheduler_observer_v3() : my_proxy(NULL) {my_busy_count=0;}
|
||||
|
||||
//! Called by thread before first steal since observation became enabled
|
||||
virtual void on_scheduler_entry( bool /*is_worker*/ ) {}
|
||||
|
||||
//! Called by thread when it no longer takes part in task stealing.
|
||||
virtual void on_scheduler_exit( bool /*is_worker*/ ) {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~task_scheduler_observer_v3() {observe(false);}
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
typedef internal::task_scheduler_observer_v3 task_scheduler_observer;
|
||||
|
||||
} // namespace tbb
|
||||
|
||||
#endif /* __TBB_SCHEDULER_OBSERVER */
|
||||
|
||||
#endif /* __TBB_task_scheduler_observer_H */
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue