| _concurrent_queue_impl.h | | _concurrent_queue_impl.h | |
| | | | |
| skipping to change at line 437 | | skipping to change at line 437 | |
| } | | } | |
| }; | | }; | |
| | | | |
| //! base class of concurrent_queue | | //! base class of concurrent_queue | |
| /** | | /** | |
| * The class implements the interface defined by concurrent_queue_page_allo
cator | | * The class implements the interface defined by concurrent_queue_page_allo
cator | |
| * and has a pointer to an instance of concurrent_queue_rep. | | * and has a pointer to an instance of concurrent_queue_rep. | |
| */ | | */ | |
| template<typename T> | | template<typename T> | |
| class concurrent_queue_base_v3: public concurrent_queue_page_allocator { | | class concurrent_queue_base_v3: public concurrent_queue_page_allocator { | |
|
| | | private: | |
| //! Internal representation | | //! Internal representation | |
| concurrent_queue_rep<T>* my_rep; | | concurrent_queue_rep<T>* my_rep; | |
| | | | |
| friend struct concurrent_queue_rep<T>; | | friend struct concurrent_queue_rep<T>; | |
| friend class micro_queue<T>; | | friend class micro_queue<T>; | |
| friend class concurrent_queue_iterator_rep<T>; | | friend class concurrent_queue_iterator_rep<T>; | |
| friend class concurrent_queue_iterator_base_v3<T>; | | friend class concurrent_queue_iterator_base_v3<T>; | |
| | | | |
| protected: | | protected: | |
| typedef typename concurrent_queue_rep<T>::page page; | | typedef typename concurrent_queue_rep<T>::page page; | |
| | | | |
| skipping to change at line 763 | | skipping to change at line 764 | |
| //! Meets requirements of a forward iterator for STL. | | //! Meets requirements of a forward iterator for STL. | |
| /** Value is either the T or const T type of the container. | | /** Value is either the T or const T type of the container. | |
| @ingroup containers */ | | @ingroup containers */ | |
| template<typename Container, typename Value> | | template<typename Container, typename Value> | |
| class concurrent_queue_iterator: public concurrent_queue_iterator_base_v3<t
ypename tbb_remove_cv<Value>::type>, | | class concurrent_queue_iterator: public concurrent_queue_iterator_base_v3<t
ypename tbb_remove_cv<Value>::type>, | |
| public std::iterator<std::forward_iterator_tag,Value> { | | public std::iterator<std::forward_iterator_tag,Value> { | |
| #if !__TBB_TEMPLATE_FRIENDS_BROKEN | | #if !__TBB_TEMPLATE_FRIENDS_BROKEN | |
| template<typename T, class A> | | template<typename T, class A> | |
| friend class ::tbb::strict_ppl::concurrent_queue; | | friend class ::tbb::strict_ppl::concurrent_queue; | |
| #else | | #else | |
|
| public: // workaround for MSVC | | public: | |
| #endif | | #endif | |
| //! Construct iterator pointing to head of queue. | | //! Construct iterator pointing to head of queue. | |
| concurrent_queue_iterator( const concurrent_queue_base_v3<Value>& queue
) : | | concurrent_queue_iterator( const concurrent_queue_base_v3<Value>& queue
) : | |
| concurrent_queue_iterator_base_v3<typename tbb_remove_cv<Value>::ty
pe>(queue) | | concurrent_queue_iterator_base_v3<typename tbb_remove_cv<Value>::ty
pe>(queue) | |
| { | | { | |
| } | | } | |
| | | | |
| public: | | public: | |
| concurrent_queue_iterator() {} | | concurrent_queue_iterator() {} | |
| | | | |
| | | | |
| skipping to change at line 833 | | skipping to change at line 834 | |
| | | | |
| class concurrent_queue_rep; | | class concurrent_queue_rep; | |
| class concurrent_queue_iterator_rep; | | class concurrent_queue_iterator_rep; | |
| class concurrent_queue_iterator_base_v3; | | class concurrent_queue_iterator_base_v3; | |
| template<typename Container, typename Value> class concurrent_queue_iterato
r; | | template<typename Container, typename Value> class concurrent_queue_iterato
r; | |
| | | | |
| //! For internal use only. | | //! For internal use only. | |
| /** Type-independent portion of concurrent_queue. | | /** Type-independent portion of concurrent_queue. | |
| @ingroup containers */ | | @ingroup containers */ | |
| class concurrent_queue_base_v3: no_copy { | | class concurrent_queue_base_v3: no_copy { | |
|
| | | private: | |
| //! Internal representation | | //! Internal representation | |
| concurrent_queue_rep* my_rep; | | concurrent_queue_rep* my_rep; | |
| | | | |
| friend class concurrent_queue_rep; | | friend class concurrent_queue_rep; | |
| friend struct micro_queue; | | friend struct micro_queue; | |
| friend class micro_queue_pop_finalizer; | | friend class micro_queue_pop_finalizer; | |
| friend class concurrent_queue_iterator_rep; | | friend class concurrent_queue_iterator_rep; | |
| friend class concurrent_queue_iterator_base_v3; | | friend class concurrent_queue_iterator_base_v3; | |
| protected: | | protected: | |
| //! Prefix on a page | | //! Prefix on a page | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 3 lines changed or added | |
|
| concurrent_vector.h | | concurrent_vector.h | |
| | | | |
| skipping to change at line 323 | | skipping to change at line 323 | |
| | | | |
| template<typename C, typename T, typename U> | | template<typename C, typename T, typename U> | |
| friend bool operator<( const vector_iterator<C,T>& i, const vector_
iterator<C,U>& j ); | | friend bool operator<( const vector_iterator<C,T>& i, const vector_
iterator<C,U>& j ); | |
| | | | |
| template<typename C, typename T, typename U> | | template<typename C, typename T, typename U> | |
| friend ptrdiff_t operator-( const vector_iterator<C,T>& i, const ve
ctor_iterator<C,U>& j ); | | friend ptrdiff_t operator-( const vector_iterator<C,T>& i, const ve
ctor_iterator<C,U>& j ); | |
| | | | |
| template<typename C, typename U> | | template<typename C, typename U> | |
| friend class internal::vector_iterator; | | friend class internal::vector_iterator; | |
| | | | |
|
| #if !defined(_MSC_VER) || defined(__INTEL_COMPILER) | | #if !__TBB_TEMPLATE_FRIENDS_BROKEN | |
| template<typename T, class A> | | template<typename T, class A> | |
| friend class tbb::concurrent_vector; | | friend class tbb::concurrent_vector; | |
| #else | | #else | |
|
| public: // workaround for MSVC | | public: | |
| #endif | | #endif | |
| | | | |
| vector_iterator( const Container& vector, size_t index, void *ptr =
0 ) : | | vector_iterator( const Container& vector, size_t index, void *ptr =
0 ) : | |
| my_vector(const_cast<Container*>(&vector)), | | my_vector(const_cast<Container*>(&vector)), | |
| my_index(index), | | my_index(index), | |
| my_item(static_cast<Value*>(ptr)) | | my_item(static_cast<Value*>(ptr)) | |
| {} | | {} | |
| | | | |
| public: | | public: | |
| //! Default constructor | | //! Default constructor | |
| | | | |
| skipping to change at line 837 | | skipping to change at line 837 | |
| m = internal_grow_to_at_least_with_result( n, sizeof(T), &initi
alize_array_by, &t); | | m = internal_grow_to_at_least_with_result( n, sizeof(T), &initi
alize_array_by, &t); | |
| if( m>n ) m=n; | | if( m>n ) m=n; | |
| } | | } | |
| return iterator(*this, m); | | return iterator(*this, m); | |
| }; | | }; | |
| | | | |
| //! Push item | | //! Push item | |
| /** Returns iterator pointing to the new element. */ | | /** Returns iterator pointing to the new element. */ | |
| iterator push_back( const_reference item ) | | iterator push_back( const_reference item ) | |
| { | | { | |
|
| size_type k; | | push_back_helper prolog(*this); | |
| T* ptr = static_cast<T*>(internal_push_back(sizeof(T),k)); | | new(prolog.internal_push_back_result()) T(item); | |
| element_construction_guard g(ptr); | | return prolog.return_iterator_and_dismiss(); | |
| new(ptr) T(item); | | | |
| g.dismiss(); | | | |
| return iterator(*this, k, ptr); | | | |
| } | | } | |
| | | | |
| #if __TBB_CPP11_RVALUE_REF_PRESENT | | #if __TBB_CPP11_RVALUE_REF_PRESENT | |
| //! Push item, move-aware | | //! Push item, move-aware | |
| /** Returns iterator pointing to the new element. */ | | /** Returns iterator pointing to the new element. */ | |
| iterator push_back( T&& item ) | | iterator push_back( T&& item ) | |
| { | | { | |
|
| size_type k; | | push_back_helper prolog(*this); | |
| T* ptr = static_cast<T*>(internal_push_back(sizeof(T),k)); | | new(prolog.internal_push_back_result()) T(std::move(item)); | |
| element_construction_guard g(ptr); | | return prolog.return_iterator_and_dismiss(); | |
| new(ptr) T(std::move(item)); | | | |
| g.dismiss(); | | | |
| return iterator(*this, k, ptr); | | | |
| } | | } | |
| #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT | | #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT | |
| //! Push item, create item "in place" with provided arguments | | //! Push item, create item "in place" with provided arguments | |
| /** Returns iterator pointing to the new element. */ | | /** Returns iterator pointing to the new element. */ | |
| template<typename... Args> | | template<typename... Args> | |
|
| iterator emplace_back( Args&&... args) | | iterator emplace_back( Args&&... args ) | |
| { | | { | |
|
| size_type k; | | push_back_helper prolog(*this); | |
| T* ptr = static_cast<T*>(internal_push_back(sizeof(T),k)); | | new(prolog.internal_push_back_result()) T(std::forward<Args>(args). | |
| element_construction_guard g(ptr); | | ..); | |
| new(ptr) T( std::forward<Args>(args)...); | | return prolog.return_iterator_and_dismiss(); | |
| g.dismiss(); | | | |
| return iterator(*this, k, ptr); | | | |
| } | | } | |
| #endif //__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT | | #endif //__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT | |
| #endif //__TBB_CPP11_RVALUE_REF_PRESENT | | #endif //__TBB_CPP11_RVALUE_REF_PRESENT | |
| //! Get reference to element at given index. | | //! Get reference to element at given index. | |
| /** This method is thread-safe for concurrent reads, and also while gro
wing the vector, | | /** This method is thread-safe for concurrent reads, and also while gro
wing the vector, | |
| as long as the calling thread has checked that index < size(). */ | | as long as the calling thread has checked that index < size(). */ | |
| reference operator[]( size_type index ) { | | reference operator[]( size_type index ) { | |
| return internal_subscript(index); | | return internal_subscript(index); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 1128 | | skipping to change at line 1119 | |
| #endif | | #endif | |
| //TODO: rename to construct_range | | //TODO: rename to construct_range | |
| template<class I> void iterate(I &src) { for(; i < n; ++i, ++src) n
ew( &array[i] ) T( *src ); } | | template<class I> void iterate(I &src) { for(; i < n; ++i, ++src) n
ew( &array[i] ) T( *src ); } | |
| ~internal_loop_guide() { | | ~internal_loop_guide() { | |
| if(i < n) {// if an exception was raised, fill the rest of item
s with zeros | | if(i < n) {// if an exception was raised, fill the rest of item
s with zeros | |
| internal::handle_unconstructed_elements(array+i, n-i); | | internal::handle_unconstructed_elements(array+i, n-i); | |
| } | | } | |
| } | | } | |
| }; | | }; | |
| | | | |
|
| class element_construction_guard : internal::no_copy{ | | struct push_back_helper : internal::no_copy{ | |
| pointer element; | | struct element_construction_guard : internal::no_copy{ | |
| public: | | pointer element; | |
| element_construction_guard(pointer an_element) : element (an_elemen | | | |
| t){} | | element_construction_guard(pointer an_element) : element (an_el | |
| void dismiss(){ element = NULL; } | | ement){} | |
| ~element_construction_guard(){ | | void dismiss(){ element = NULL; } | |
| if (element){ | | ~element_construction_guard(){ | |
| internal::handle_unconstructed_elements(element, 1); | | if (element){ | |
| | | internal::handle_unconstructed_elements(element, 1); | |
| | | } | |
| } | | } | |
|
| | | }; | |
| | | | |
| | | concurrent_vector & v; | |
| | | size_type k; | |
| | | element_construction_guard g; | |
| | | | |
| | | push_back_helper(concurrent_vector & vector) : | |
| | | v(vector), | |
| | | g (static_cast<T*>(v.internal_push_back(sizeof(T),k))) | |
| | | {} | |
| | | | |
| | | pointer internal_push_back_result(){ return g.element;} | |
| | | iterator return_iterator_and_dismiss(){ | |
| | | g.dismiss(); | |
| | | return iterator(v, k, g.element); | |
| } | | } | |
| }; | | }; | |
| }; | | }; | |
| | | | |
| #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) | | #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) | |
| #pragma warning (push) | | #pragma warning (push) | |
| #pragma warning (disable: 4701) // potentially uninitialized local variable
"old" | | #pragma warning (disable: 4701) // potentially uninitialized local variable
"old" | |
| #endif | | #endif | |
| template<typename T, class A> | | template<typename T, class A> | |
| void concurrent_vector<T, A>::shrink_to_fit() { | | void concurrent_vector<T, A>::shrink_to_fit() { | |
| | | | |
End of changes. 8 change blocks. |
| 30 lines changed or deleted | | 39 lines changed or added | |
|
| parallel_invoke.h | | parallel_invoke.h | |
| | | | |
| skipping to change at line 204 | | skipping to change at line 204 | |
| }; | | }; | |
| | | | |
| template<typename T> struct impl_selector<T> { | | template<typename T> struct impl_selector<T> { | |
| typedef false_type type; | | typedef false_type type; | |
| }; | | }; | |
| template<> struct impl_selector<task_group_context&> { | | template<> struct impl_selector<task_group_context&> { | |
| typedef true_type type; | | typedef true_type type; | |
| }; | | }; | |
| | | | |
| // Select task_group_context parameter from the back of a pack | | // Select task_group_context parameter from the back of a pack | |
|
| task_group_context& get_context( task_group_context& tgc ) { return tgc
; } | | inline task_group_context& get_context( task_group_context& tgc ) { ret
urn tgc; } | |
| | | | |
| template<typename T1, typename... T> | | template<typename T1, typename... T> | |
| task_group_context& get_context( T1&& /*ignored*/, T&&... t ) | | task_group_context& get_context( T1&& /*ignored*/, T&&... t ) | |
| { return get_context( std::forward<T>(t)... ); } | | { return get_context( std::forward<T>(t)... ); } | |
| | | | |
| // task_group_context is known to be at the back of the parameter pack | | // task_group_context is known to be at the back of the parameter pack | |
| template<typename F0, typename F1, typename... F> | | template<typename F0, typename F1, typename... F> | |
| void parallel_invoke_impl(true_type, F0&& f0, F1&& f1, F&&... f) { | | void parallel_invoke_impl(true_type, F0&& f0, F1&& f1, F&&... f) { | |
| __TBB_STATIC_ASSERT(sizeof...(F)>0, "Variadic parallel_invoke imple
mentation broken?"); | | __TBB_STATIC_ASSERT(sizeof...(F)>0, "Variadic parallel_invoke imple
mentation broken?"); | |
| // # of child tasks: f0, f1, and a task for each two elements of th
e pack except the last | | // # of child tasks: f0, f1, and a task for each two elements of th
e pack except the last | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| tbb_config.h | | tbb_config.h | |
| | | | |
| skipping to change at line 420 | | skipping to change at line 420 | |
| | | | |
| #ifndef __TBB_ITT_STRUCTURE_API | | #ifndef __TBB_ITT_STRUCTURE_API | |
| #define __TBB_ITT_STRUCTURE_API ( !__TBB_DEFINE_MIC && (__TBB_CPF_BUILD ||
TBB_PREVIEW_FLOW_GRAPH_TRACE) ) | | #define __TBB_ITT_STRUCTURE_API ( !__TBB_DEFINE_MIC && (__TBB_CPF_BUILD ||
TBB_PREVIEW_FLOW_GRAPH_TRACE) ) | |
| #endif | | #endif | |
| | | | |
| #if TBB_USE_EXCEPTIONS && !__TBB_TASK_GROUP_CONTEXT | | #if TBB_USE_EXCEPTIONS && !__TBB_TASK_GROUP_CONTEXT | |
| #error TBB_USE_EXCEPTIONS requires __TBB_TASK_GROUP_CONTEXT to be enabl
ed | | #error TBB_USE_EXCEPTIONS requires __TBB_TASK_GROUP_CONTEXT to be enabl
ed | |
| #endif | | #endif | |
| | | | |
| #ifndef __TBB_TASK_PRIORITY | | #ifndef __TBB_TASK_PRIORITY | |
|
| #define __TBB_TASK_PRIORITY (!(__TBB_CPF_BUILD||TBB_USE_PREVIEW_BINARY)
&&__TBB_TASK_GROUP_CONTEXT) // TODO: it will be enabled for CPF in the next
versions | | #define __TBB_TASK_PRIORITY (__TBB_TASK_GROUP_CONTEXT) | |
| #endif /* __TBB_TASK_PRIORITY */ | | #endif /* __TBB_TASK_PRIORITY */ | |
| | | | |
| #if __TBB_TASK_PRIORITY && !__TBB_TASK_GROUP_CONTEXT | | #if __TBB_TASK_PRIORITY && !__TBB_TASK_GROUP_CONTEXT | |
| #error __TBB_TASK_PRIORITY requires __TBB_TASK_GROUP_CONTEXT to be enab
led | | #error __TBB_TASK_PRIORITY requires __TBB_TASK_GROUP_CONTEXT to be enab
led | |
| #endif | | #endif | |
| | | | |
| #if TBB_PREVIEW_WAITING_FOR_WORKERS || __TBB_BUILD | | #if TBB_PREVIEW_WAITING_FOR_WORKERS || __TBB_BUILD | |
| #define __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE 1 | | #define __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE 1 | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 497 | | skipping to change at line 497 | |
| #define __TBB_ICC_12_0_INL_ASM_FSTCW_BROKEN 1 | | #define __TBB_ICC_12_0_INL_ASM_FSTCW_BROKEN 1 | |
| #endif | | #endif | |
| | | | |
| #if _MSC_VER && __INTEL_COMPILER && (__INTEL_COMPILER<1110 || __INTEL_COMPI
LER==1110 && __INTEL_COMPILER_BUILD_DATE < 20091012) | | #if _MSC_VER && __INTEL_COMPILER && (__INTEL_COMPILER<1110 || __INTEL_COMPI
LER==1110 && __INTEL_COMPILER_BUILD_DATE < 20091012) | |
| /** Necessary to avoid ICL error (or warning in non-strict mode): | | /** Necessary to avoid ICL error (or warning in non-strict mode): | |
| "exception specification for implicitly declared virtual destructor
is | | "exception specification for implicitly declared virtual destructor
is | |
| incompatible with that of overridden one". **/ | | incompatible with that of overridden one". **/ | |
| #define __TBB_DEFAULT_DTOR_THROW_SPEC_BROKEN 1 | | #define __TBB_DEFAULT_DTOR_THROW_SPEC_BROKEN 1 | |
| #endif | | #endif | |
| | | | |
|
| #if defined(_MSC_VER) && _MSC_VER < 1500 && !defined(__INTEL_COMPILER) | | #if !__INTEL_COMPILER && (_MSC_VER && _MSC_VER < 1500 || __TBB_GCC_VERSION | |
| /** VS2005 and earlier do not allow declaring template class as a frien | | && __TBB_GCC_VERSION < 40102) | |
| d | | /** gcc 3.4.6 (and earlier) and VS2005 (and earlier) do not allow decla | |
| | | ring template class as a friend | |
| of classes defined in other namespaces. **/ | | of classes defined in other namespaces. **/ | |
| #define __TBB_TEMPLATE_FRIENDS_BROKEN 1 | | #define __TBB_TEMPLATE_FRIENDS_BROKEN 1 | |
| #endif | | #endif | |
| | | | |
| //TODO: recheck for different clang versions | | //TODO: recheck for different clang versions | |
| #if __GLIBC__==2 && __GLIBC_MINOR__==3 || (__APPLE__ && ( __INTEL_COMPILER
==1200 && !TBB_USE_DEBUG)) | | #if __GLIBC__==2 && __GLIBC_MINOR__==3 || (__APPLE__ && ( __INTEL_COMPILER
==1200 && !TBB_USE_DEBUG)) | |
| /** Macro controlling EH usages in TBB tests. | | /** Macro controlling EH usages in TBB tests. | |
| Some older versions of glibc crash when exception handling happens
concurrently. **/ | | Some older versions of glibc crash when exception handling happens
concurrently. **/ | |
| #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 1 | | #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 1 | |
| #else | | #else | |
| | | | |
End of changes. 2 change blocks. |
| 4 lines changed or deleted | | 5 lines changed or added | |
|