| _tbb_strings.h | | _tbb_strings.h | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| | | | |
| TBB_STRING_RESOURCE(FLOW_BROADCAST_NODE, "broadcast_node") | | TBB_STRING_RESOURCE(FLOW_BROADCAST_NODE, "broadcast_node") | |
| TBB_STRING_RESOURCE(FLOW_BUFFER_NODE, "buffer_node") | | TBB_STRING_RESOURCE(FLOW_BUFFER_NODE, "buffer_node") | |
| TBB_STRING_RESOURCE(FLOW_CONTINUE_NODE, "continue_node") | | TBB_STRING_RESOURCE(FLOW_CONTINUE_NODE, "continue_node") | |
| TBB_STRING_RESOURCE(FLOW_FUNCTION_NODE, "function_node") | | TBB_STRING_RESOURCE(FLOW_FUNCTION_NODE, "function_node") | |
| TBB_STRING_RESOURCE(FLOW_JOIN_NODE_QUEUEING, "join_node (queueing)") | | TBB_STRING_RESOURCE(FLOW_JOIN_NODE_QUEUEING, "join_node (queueing)") | |
| TBB_STRING_RESOURCE(FLOW_JOIN_NODE_RESERVING, "join_node (reserving)") | | TBB_STRING_RESOURCE(FLOW_JOIN_NODE_RESERVING, "join_node (reserving)") | |
| TBB_STRING_RESOURCE(FLOW_JOIN_NODE_TAG_MATCHING, "join_node (tag_matching)"
) | | TBB_STRING_RESOURCE(FLOW_JOIN_NODE_TAG_MATCHING, "join_node (tag_matching)"
) | |
| TBB_STRING_RESOURCE(FLOW_LIMITER_NODE, "limiter_node") | | TBB_STRING_RESOURCE(FLOW_LIMITER_NODE, "limiter_node") | |
| TBB_STRING_RESOURCE(FLOW_MULTIFUNCTION_NODE, "multifunction_node") | | TBB_STRING_RESOURCE(FLOW_MULTIFUNCTION_NODE, "multifunction_node") | |
|
| TBB_STRING_RESOURCE(FLOW_OR_NODE, "or_node") //no longer in use, kept for b
ackward compatibilty | | TBB_STRING_RESOURCE(FLOW_OR_NODE, "or_node") //no longer in use, kept for b
ackward compatibility | |
| TBB_STRING_RESOURCE(FLOW_OVERWRITE_NODE, "overwrite_node") | | TBB_STRING_RESOURCE(FLOW_OVERWRITE_NODE, "overwrite_node") | |
| TBB_STRING_RESOURCE(FLOW_PRIORITY_QUEUE_NODE, "priority_queue_node") | | TBB_STRING_RESOURCE(FLOW_PRIORITY_QUEUE_NODE, "priority_queue_node") | |
| TBB_STRING_RESOURCE(FLOW_QUEUE_NODE, "queue_node") | | TBB_STRING_RESOURCE(FLOW_QUEUE_NODE, "queue_node") | |
| TBB_STRING_RESOURCE(FLOW_SEQUENCER_NODE, "sequencer_node") | | TBB_STRING_RESOURCE(FLOW_SEQUENCER_NODE, "sequencer_node") | |
| TBB_STRING_RESOURCE(FLOW_SOURCE_NODE, "source_node") | | TBB_STRING_RESOURCE(FLOW_SOURCE_NODE, "source_node") | |
| TBB_STRING_RESOURCE(FLOW_SPLIT_NODE, "split_node") | | TBB_STRING_RESOURCE(FLOW_SPLIT_NODE, "split_node") | |
| TBB_STRING_RESOURCE(FLOW_WRITE_ONCE_NODE, "write_once_node") | | TBB_STRING_RESOURCE(FLOW_WRITE_ONCE_NODE, "write_once_node") | |
| TBB_STRING_RESOURCE(FLOW_BODY, "body") | | TBB_STRING_RESOURCE(FLOW_BODY, "body") | |
| TBB_STRING_RESOURCE(FLOW_GRAPH, "graph") | | TBB_STRING_RESOURCE(FLOW_GRAPH, "graph") | |
| TBB_STRING_RESOURCE(FLOW_NODE, "node") | | TBB_STRING_RESOURCE(FLOW_NODE, "node") | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| memory_pool.h | | memory_pool.h | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| #ifndef __TBB_memory_pool_H | | #ifndef __TBB_memory_pool_H | |
| #define __TBB_memory_pool_H | | #define __TBB_memory_pool_H | |
| | | | |
| #if !TBB_PREVIEW_MEMORY_POOL | | #if !TBB_PREVIEW_MEMORY_POOL | |
| #error Set TBB_PREVIEW_MEMORY_POOL to include memory_pool.h | | #error Set TBB_PREVIEW_MEMORY_POOL to include memory_pool.h | |
| #endif | | #endif | |
| /** @file */ | | /** @file */ | |
| | | | |
| #include "scalable_allocator.h" | | #include "scalable_allocator.h" | |
| #include <new> // std::bad_alloc | | #include <new> // std::bad_alloc | |
|
| | | #include <stdexcept> // std::runtime_error, std::invalid_argument | |
| | | // required in C++03 to construct std::runtime_error and std::invalid_argum | |
| | | ent | |
| | | #include <string> | |
| #if __TBB_ALLOCATOR_CONSTRUCT_VARIADIC | | #if __TBB_ALLOCATOR_CONSTRUCT_VARIADIC | |
| #include <utility> // std::forward | | #include <utility> // std::forward | |
| #endif | | #endif | |
| | | | |
| #if __TBB_EXTRA_DEBUG | | #if __TBB_EXTRA_DEBUG | |
| #define __TBBMALLOC_ASSERT ASSERT | | #define __TBBMALLOC_ASSERT ASSERT | |
| #else | | #else | |
| #define __TBBMALLOC_ASSERT(a,b) ((void)0) | | #define __TBBMALLOC_ASSERT(a,b) ((void)0) | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 117 | | skipping to change at line 120 | |
| memory_pool_allocator(pool_type &pool) throw() : my_pool(&pool) {} | | memory_pool_allocator(pool_type &pool) throw() : my_pool(&pool) {} | |
| memory_pool_allocator(const memory_pool_allocator& src) throw() : my_po
ol(src.my_pool) {} | | memory_pool_allocator(const memory_pool_allocator& src) throw() : my_po
ol(src.my_pool) {} | |
| template<typename U> | | template<typename U> | |
| memory_pool_allocator(const memory_pool_allocator<U,P>& src) throw() :
my_pool(src.my_pool) {} | | memory_pool_allocator(const memory_pool_allocator<U,P>& src) throw() :
my_pool(src.my_pool) {} | |
| | | | |
| pointer address(reference x) const { return &x; } | | pointer address(reference x) const { return &x; } | |
| const_pointer address(const_reference x) const { return &x; } | | const_pointer address(const_reference x) const { return &x; } | |
| | | | |
| //! Allocate space for n objects. | | //! Allocate space for n objects. | |
| pointer allocate( size_type n, const void* /*hint*/ = 0) { | | pointer allocate( size_type n, const void* /*hint*/ = 0) { | |
|
| return static_cast<pointer>( my_pool->malloc( n*sizeof(value_type) | | pointer p = static_cast<pointer>( my_pool->malloc( n*sizeof(value_t | |
| ) ); | | ype) ) ); | |
| | | if (!p) | |
| | | tbb::internal::throw_exception(std::bad_alloc()); | |
| | | return p; | |
| } | | } | |
| //! Free previously allocated block of memory. | | //! Free previously allocated block of memory. | |
| void deallocate( pointer p, size_type ) { | | void deallocate( pointer p, size_type ) { | |
| my_pool->free(p); | | my_pool->free(p); | |
| } | | } | |
| //! Largest value for which method allocate might succeed. | | //! Largest value for which method allocate might succeed. | |
| size_type max_size() const throw() { | | size_type max_size() const throw() { | |
| size_type max = static_cast<size_type>(-1) / sizeof (value_type); | | size_type max = static_cast<size_type>(-1) / sizeof (value_type); | |
| return (max > 0 ? max : 1); | | return (max > 0 ? max : 1); | |
| } | | } | |
| | | | |
| skipping to change at line 218 | | skipping to change at line 224 | |
| ~fixed_pool() { destroy(); } | | ~fixed_pool() { destroy(); } | |
| }; | | }; | |
| | | | |
| //////////////// Implementation /////////////// | | //////////////// Implementation /////////////// | |
| | | | |
| template <typename Alloc> | | template <typename Alloc> | |
| memory_pool<Alloc>::memory_pool(const Alloc &src) : my_alloc(src) { | | memory_pool<Alloc>::memory_pool(const Alloc &src) : my_alloc(src) { | |
| rml::MemPoolPolicy args(allocate_request, deallocate_request, | | rml::MemPoolPolicy args(allocate_request, deallocate_request, | |
| sizeof(typename Alloc::value_type)); | | sizeof(typename Alloc::value_type)); | |
| rml::MemPoolError res = rml::pool_create_v1(intptr_t(this), &args, &my_
pool); | | rml::MemPoolError res = rml::pool_create_v1(intptr_t(this), &args, &my_
pool); | |
|
| if( res!=rml::POOL_OK ) __TBB_THROW(std::bad_alloc()); | | if (res!=rml::POOL_OK) | |
| | | tbb::internal::throw_exception(std::runtime_error("Can't create poo | |
| | | l")); | |
| } | | } | |
| template <typename Alloc> | | template <typename Alloc> | |
| void *memory_pool<Alloc>::allocate_request(intptr_t pool_id, size_t & bytes
) { | | void *memory_pool<Alloc>::allocate_request(intptr_t pool_id, size_t & bytes
) { | |
| memory_pool<Alloc> &self = *reinterpret_cast<memory_pool<Alloc>*>(pool_
id); | | memory_pool<Alloc> &self = *reinterpret_cast<memory_pool<Alloc>*>(pool_
id); | |
| const size_t unit_size = sizeof(typename Alloc::value_type); | | const size_t unit_size = sizeof(typename Alloc::value_type); | |
| __TBBMALLOC_ASSERT( 0 == bytes%unit_size, NULL); | | __TBBMALLOC_ASSERT( 0 == bytes%unit_size, NULL); | |
| void *ptr; | | void *ptr; | |
| __TBB_TRY { ptr = self.my_alloc.allocate( bytes/unit_size ); } | | __TBB_TRY { ptr = self.my_alloc.allocate( bytes/unit_size ); } | |
| __TBB_CATCH(...) { return 0; } | | __TBB_CATCH(...) { return 0; } | |
| return ptr; | | return ptr; | |
| | | | |
| skipping to change at line 248 | | skipping to change at line 255 | |
| memory_pool<Alloc> &self = *reinterpret_cast<memory_pool<Alloc>*>(pool_
id); | | memory_pool<Alloc> &self = *reinterpret_cast<memory_pool<Alloc>*>(pool_
id); | |
| const size_t unit_size = sizeof(typename Alloc::value_type); | | const size_t unit_size = sizeof(typename Alloc::value_type); | |
| __TBBMALLOC_ASSERT( 0 == raw_bytes%unit_size, NULL); | | __TBBMALLOC_ASSERT( 0 == raw_bytes%unit_size, NULL); | |
| self.my_alloc.deallocate( static_cast<typename Alloc::value_type*>(raw_
ptr), raw_bytes/unit_size ); | | self.my_alloc.deallocate( static_cast<typename Alloc::value_type*>(raw_
ptr), raw_bytes/unit_size ); | |
| return 0; | | return 0; | |
| } | | } | |
| #if __TBB_MSVC_UNREACHABLE_CODE_IGNORED | | #if __TBB_MSVC_UNREACHABLE_CODE_IGNORED | |
| #pragma warning (pop) | | #pragma warning (pop) | |
| #endif | | #endif | |
| inline fixed_pool::fixed_pool(void *buf, size_t size) : my_buffer(buf), my_
size(size) { | | inline fixed_pool::fixed_pool(void *buf, size_t size) : my_buffer(buf), my_
size(size) { | |
|
| if( !buf || !size ) __TBB_THROW(std::bad_alloc()); | | if (!buf || !size) | |
| | | // TODO: improve support for mode with exceptions disabled | |
| | | tbb::internal::throw_exception(std::invalid_argument("Zero in param | |
| | | eter is invalid")); | |
| rml::MemPoolPolicy args(allocate_request, 0, size, /*fixedPool=*/true); | | rml::MemPoolPolicy args(allocate_request, 0, size, /*fixedPool=*/true); | |
| rml::MemPoolError res = rml::pool_create_v1(intptr_t(this), &args, &my_
pool); | | rml::MemPoolError res = rml::pool_create_v1(intptr_t(this), &args, &my_
pool); | |
|
| if( res!=rml::POOL_OK ) __TBB_THROW(std::bad_alloc()); | | if (res!=rml::POOL_OK) | |
| | | tbb::internal::throw_exception(std::runtime_error("Can't create poo | |
| | | l")); | |
| } | | } | |
| inline void *fixed_pool::allocate_request(intptr_t pool_id, size_t & bytes)
{ | | inline void *fixed_pool::allocate_request(intptr_t pool_id, size_t & bytes)
{ | |
| fixed_pool &self = *reinterpret_cast<fixed_pool*>(pool_id); | | fixed_pool &self = *reinterpret_cast<fixed_pool*>(pool_id); | |
| __TBBMALLOC_ASSERT(0 != self.my_size, "The buffer must not be used twic
e."); | | __TBBMALLOC_ASSERT(0 != self.my_size, "The buffer must not be used twic
e."); | |
| bytes = self.my_size; | | bytes = self.my_size; | |
| self.my_size = 0; // remember that buffer has been used | | self.my_size = 0; // remember that buffer has been used | |
| return self.my_buffer; | | return self.my_buffer; | |
| } | | } | |
| | | | |
| } //namespace interface6 | | } //namespace interface6 | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 19 lines changed or added | |
|
| pipeline.h | | pipeline.h | |
| | | | |
| skipping to change at line 598 | | skipping to change at line 598 | |
| filter_node* root; | | filter_node* root; | |
| filter_t( filter_node* root_ ) : root(root_) { | | filter_t( filter_node* root_ ) : root(root_) { | |
| root->add_ref(); | | root->add_ref(); | |
| } | | } | |
| friend class internal::pipeline_proxy; | | friend class internal::pipeline_proxy; | |
| template<typename T_, typename U_, typename Body> | | template<typename T_, typename U_, typename Body> | |
| friend filter_t<T_,U_> make_filter(tbb::filter::mode, const Body& ); | | friend filter_t<T_,U_> make_filter(tbb::filter::mode, const Body& ); | |
| template<typename T_, typename V_, typename U_> | | template<typename T_, typename V_, typename U_> | |
| friend filter_t<T_,U_> operator& (const filter_t<T_,V_>& , const filter
_t<V_,U_>& ); | | friend filter_t<T_,U_> operator& (const filter_t<T_,V_>& , const filter
_t<V_,U_>& ); | |
| public: | | public: | |
|
| | | // TODO: add move-constructors, move-assignment, etc. where C++11 is av
ailable. | |
| filter_t() : root(NULL) {} | | filter_t() : root(NULL) {} | |
| filter_t( const filter_t<T,U>& rhs ) : root(rhs.root) { | | filter_t( const filter_t<T,U>& rhs ) : root(rhs.root) { | |
| if( root ) root->add_ref(); | | if( root ) root->add_ref(); | |
| } | | } | |
| template<typename Body> | | template<typename Body> | |
| filter_t( tbb::filter::mode mode, const Body& body ) : | | filter_t( tbb::filter::mode mode, const Body& body ) : | |
| root( new internal::filter_node_leaf<T,U,Body>(mode, body) ) { | | root( new internal::filter_node_leaf<T,U,Body>(mode, body) ) { | |
| root->add_ref(); | | root->add_ref(); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 1 lines changed or added | |
|
| scalable_allocator.h | | scalable_allocator.h | |
| | | | |
| skipping to change at line 219 | | skipping to change at line 219 | |
| #endif | | #endif | |
| | | | |
| namespace tbb { | | namespace tbb { | |
| | | | |
| #if _MSC_VER && !defined(__INTEL_COMPILER) | | #if _MSC_VER && !defined(__INTEL_COMPILER) | |
| // Workaround for erroneous "unreferenced parameter" warning in method
destroy. | | // Workaround for erroneous "unreferenced parameter" warning in method
destroy. | |
| #pragma warning (push) | | #pragma warning (push) | |
| #pragma warning (disable: 4100) | | #pragma warning (disable: 4100) | |
| #endif | | #endif | |
| | | | |
|
| | | //! @cond INTERNAL | |
| | | namespace internal { | |
| | | | |
| | | #if TBB_USE_EXCEPTIONS | |
| | | // forward declaration is for inlining prevention | |
| | | template<typename E> __TBB_NOINLINE( void throw_exception(const E &e) ); | |
| | | #endif | |
| | | | |
| | | // keep throw in a separate function to prevent code bloat | |
| | | template<typename E> | |
| | | void throw_exception(const E &e) { | |
| | | __TBB_THROW(e); | |
| | | } | |
| | | | |
| | | } // namespace internal | |
| | | //! @endcond | |
| | | | |
| //! Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5 | | //! 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 | | /** The members are ordered the same way they are in section 20.4.1 | |
| of the ISO C++ standard. | | of the ISO C++ standard. | |
| @ingroup memory_allocation */ | | @ingroup memory_allocation */ | |
| template<typename T> | | template<typename T> | |
| class scalable_allocator { | | class scalable_allocator { | |
| public: | | public: | |
| typedef typename internal::allocator_type<T>::value_type value_type; | | typedef typename internal::allocator_type<T>::value_type value_type; | |
| typedef value_type* pointer; | | typedef value_type* pointer; | |
| typedef const value_type* const_pointer; | | typedef const value_type* const_pointer; | |
| | | | |
| skipping to change at line 246 | | skipping to change at line 263 | |
| | | | |
| scalable_allocator() throw() {} | | scalable_allocator() throw() {} | |
| scalable_allocator( const scalable_allocator& ) throw() {} | | scalable_allocator( const scalable_allocator& ) throw() {} | |
| template<typename U> scalable_allocator(const scalable_allocator<U>&) t
hrow() {} | | template<typename U> scalable_allocator(const scalable_allocator<U>&) t
hrow() {} | |
| | | | |
| pointer address(reference x) const {return &x;} | | pointer address(reference x) const {return &x;} | |
| const_pointer address(const_reference x) const {return &x;} | | const_pointer address(const_reference x) const {return &x;} | |
| | | | |
| //! Allocate space for n objects. | | //! Allocate space for n objects. | |
| pointer allocate( size_type n, const void* /*hint*/ =0 ) { | | pointer allocate( size_type n, const void* /*hint*/ =0 ) { | |
|
| return static_cast<pointer>( scalable_malloc( n * sizeof(value_type | | pointer p = static_cast<pointer>( scalable_malloc( n * sizeof(value | |
| ) ) ); | | _type) ) ); | |
| | | if (!p) | |
| | | internal::throw_exception(std::bad_alloc()); | |
| | | return p; | |
| } | | } | |
| | | | |
| //! Free previously allocated block of memory | | //! Free previously allocated block of memory | |
| void deallocate( pointer p, size_type ) { | | void deallocate( pointer p, size_type ) { | |
| scalable_free( p ); | | scalable_free( p ); | |
| } | | } | |
| | | | |
| //! Largest value for which method allocate might succeed. | | //! Largest value for which method allocate might succeed. | |
| size_type max_size() const throw() { | | size_type max_size() const throw() { | |
| size_type absolutemax = static_cast<size_type>(-1) / sizeof (value_
type); | | size_type absolutemax = static_cast<size_type>(-1) / sizeof (value_
type); | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 22 lines changed or added | |
|
| task.h | | task.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| an executable, this file does not by itself cause the resulting execut
able to be covered | | an executable, this file does not by itself cause the resulting execut
able to be covered | |
| by the GNU General Public License. This exception does not however inva
lidate any other | | by the GNU General Public License. This exception does not however inva
lidate any other | |
| reasons why the executable file might be covered by the GNU General Pub
lic License. | | reasons why the executable file might be covered by the GNU General Pub
lic License. | |
| */ | | */ | |
| | | | |
| #ifndef __TBB_task_H | | #ifndef __TBB_task_H | |
| #define __TBB_task_H | | #define __TBB_task_H | |
| | | | |
| #include "tbb_stddef.h" | | #include "tbb_stddef.h" | |
| #include "tbb_machine.h" | | #include "tbb_machine.h" | |
|
| | | #include "tbb_profiling.h" | |
| #include <climits> | | #include <climits> | |
| | | | |
| typedef struct ___itt_caller *__itt_caller; | | typedef struct ___itt_caller *__itt_caller; | |
| | | | |
| namespace tbb { | | namespace tbb { | |
| | | | |
| class task; | | class task; | |
| class task_list; | | class task_list; | |
| class task_group_context; | | class task_group_context; | |
| | | | |
| | | | |
| skipping to change at line 692 | | skipping to change at line 693 | |
| | | | |
| //! Set reference count | | //! Set reference count | |
| void set_ref_count( int count ) { | | void set_ref_count( int count ) { | |
| #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT | | #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT | |
| internal_set_ref_count(count); | | internal_set_ref_count(count); | |
| #else | | #else | |
| prefix().ref_count = count; | | prefix().ref_count = count; | |
| #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ | | #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ | |
| } | | } | |
| | | | |
|
| //! Atomically increment reference count and returns its old value. | | //! Atomically increment reference count. | |
| /** Has acquire semantics */ | | /** Has acquire semantics */ | |
| void increment_ref_count() { | | void increment_ref_count() { | |
| __TBB_FetchAndIncrementWacquire( &prefix().ref_count ); | | __TBB_FetchAndIncrementWacquire( &prefix().ref_count ); | |
| } | | } | |
| | | | |
|
| | | //! Atomically adds to reference count and returns its new value. | |
| | | /** Has release-acquire semantics */ | |
| | | int add_ref_count( int count ) { | |
| | | internal::call_itt_notify( internal::releasing, &prefix().ref_count | |
| | | ); | |
| | | internal::reference_count k = count+__TBB_FetchAndAddW( &prefix().r | |
| | | ef_count, count ); | |
| | | __TBB_ASSERT( k>=0, "task's reference count underflowed" ); | |
| | | if( k==0 ) | |
| | | internal::call_itt_notify( internal::acquired, &prefix().ref_co | |
| | | unt ); | |
| | | return int(k); | |
| | | } | |
| | | | |
| //! Atomically decrement reference count and returns its new value. | | //! Atomically decrement reference count and returns its new value. | |
| /** Has release semantics. */ | | /** Has release semantics. */ | |
| int decrement_ref_count() { | | int decrement_ref_count() { | |
| #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT | | #if TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT | |
| return int(internal_decrement_ref_count()); | | return int(internal_decrement_ref_count()); | |
| #else | | #else | |
| return int(__TBB_FetchAndDecrementWrelease( &prefix().ref_count ))-
1; | | return int(__TBB_FetchAndDecrementWrelease( &prefix().ref_count ))-
1; | |
| #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ | | #endif /* TBB_USE_THREADING_TOOLS||TBB_USE_ASSERT */ | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 769 | | skipping to change at line 781 | |
| | | | |
| //! The innermost task being executed or destroyed by the current threa
d at the moment. | | //! The innermost task being executed or destroyed by the current threa
d at the moment. | |
| static task& __TBB_EXPORTED_FUNC self(); | | static task& __TBB_EXPORTED_FUNC self(); | |
| | | | |
| //! task on whose behalf this task is working, or NULL if this is a roo
t. | | //! task on whose behalf this task is working, or NULL if this is a roo
t. | |
| task* parent() const {return prefix().parent;} | | task* parent() const {return prefix().parent;} | |
| | | | |
| //! sets parent task pointer to specified value | | //! sets parent task pointer to specified value | |
| void set_parent(task* p) { | | void set_parent(task* p) { | |
| #if __TBB_TASK_GROUP_CONTEXT | | #if __TBB_TASK_GROUP_CONTEXT | |
|
| __TBB_ASSERT(prefix().context == p->prefix().context, "The tasks mu
st be in the same context"); | | __TBB_ASSERT(!p || prefix().context == p->prefix().context, "The ta
sks must be in the same context"); | |
| #endif | | #endif | |
| prefix().parent = p; | | prefix().parent = p; | |
| } | | } | |
| | | | |
| #if __TBB_TASK_GROUP_CONTEXT | | #if __TBB_TASK_GROUP_CONTEXT | |
| //! This method is deprecated and will be removed in the future. | | //! This method is deprecated and will be removed in the future. | |
| /** Use method group() instead. **/ | | /** Use method group() instead. **/ | |
| task_group_context* context() {return prefix().context;} | | task_group_context* context() {return prefix().context;} | |
| | | | |
| //! Pointer to the task group descriptor. | | //! Pointer to the task group descriptor. | |
| | | | |
| skipping to change at line 928 | | skipping to change at line 940 | |
| | | | |
| //! True if list if empty; false otherwise. | | //! True if list if empty; false otherwise. | |
| bool empty() const {return !first;} | | bool empty() const {return !first;} | |
| | | | |
| //! Push task onto back of list. | | //! Push task onto back of list. | |
| void push_back( task& task ) { | | void push_back( task& task ) { | |
| task.prefix().next = NULL; | | task.prefix().next = NULL; | |
| *next_ptr = &task; | | *next_ptr = &task; | |
| next_ptr = &task.prefix().next; | | next_ptr = &task.prefix().next; | |
| } | | } | |
|
| | | #if __TBB_TODO | |
| | | // TODO: add this method and implement&document the local execution ord | |
| | | ering. See more in generic_scheduler::local_spawn | |
| | | //! Push task onto front of list (FIFO local execution, like individual | |
| | | spawning in the same order). | |
| | | void push_front( task& task ) { | |
| | | if( empty() ) { | |
| | | push_back(task); | |
| | | } else { | |
| | | task.prefix().next = first; | |
| | | first = &task; | |
| | | } | |
| | | } | |
| | | #endif | |
| //! Pop the front task from the list. | | //! Pop the front task from the list. | |
| task& pop_front() { | | task& pop_front() { | |
| __TBB_ASSERT( !empty(), "attempt to pop item from empty task_list"
); | | __TBB_ASSERT( !empty(), "attempt to pop item from empty task_list"
); | |
| task* result = first; | | task* result = first; | |
| first = result->prefix().next; | | first = result->prefix().next; | |
| if( !first ) next_ptr = &first; | | if( !first ) next_ptr = &first; | |
| return *result; | | return *result; | |
| } | | } | |
| | | | |
| //! Clear the list | | //! Clear the list | |
| | | | |
End of changes. 5 change blocks. |
| 3 lines changed or deleted | | 31 lines changed or added | |
|
| tbb_stddef.h | | tbb_stddef.h | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| */ | | */ | |
| | | | |
| #ifndef __TBB_tbb_stddef_H | | #ifndef __TBB_tbb_stddef_H | |
| #define __TBB_tbb_stddef_H | | #define __TBB_tbb_stddef_H | |
| | | | |
| // Marketing-driven product version | | // Marketing-driven product version | |
| #define TBB_VERSION_MAJOR 4 | | #define TBB_VERSION_MAJOR 4 | |
| #define TBB_VERSION_MINOR 3 | | #define TBB_VERSION_MINOR 3 | |
| | | | |
| // Engineering-focused interface version | | // Engineering-focused interface version | |
|
| #define TBB_INTERFACE_VERSION 8004 | | #define TBB_INTERFACE_VERSION 8005 | |
| #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000 | | #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000 | |
| | | | |
| // The oldest major interface version still supported | | // The oldest major interface version still supported | |
| // To be used in SONAME, manifests, etc. | | // To be used in SONAME, manifests, etc. | |
| #define TBB_COMPATIBLE_INTERFACE_VERSION 2 | | #define TBB_COMPATIBLE_INTERFACE_VERSION 2 | |
| | | | |
| #define __TBB_STRING_AUX(x) #x | | #define __TBB_STRING_AUX(x) #x | |
| #define __TBB_STRING(x) __TBB_STRING_AUX(x) | | #define __TBB_STRING(x) __TBB_STRING_AUX(x) | |
| | | | |
| // We do not need defines below for resource processing on windows | | // We do not need defines below for resource processing on windows | |
| | | | |
| skipping to change at line 133 | | skipping to change at line 133 | |
| #include "internal/_tbb_windef.h" | | #include "internal/_tbb_windef.h" | |
| #undef __TBB_tbb_windef_H | | #undef __TBB_tbb_windef_H | |
| #endif | | #endif | |
| #if !defined(_MSC_VER) || _MSC_VER>=1600 | | #if !defined(_MSC_VER) || _MSC_VER>=1600 | |
| #include <stdint.h> | | #include <stdint.h> | |
| #endif | | #endif | |
| | | | |
| //! Type for an assertion handler | | //! Type for an assertion handler | |
| typedef void(*assertion_handler_type)( const char* filename, int line, cons
t char* expression, const char * comment ); | | typedef void(*assertion_handler_type)( const char* filename, int line, cons
t char* expression, const char * comment ); | |
| | | | |
|
| #if TBB_USE_ASSERT | | | |
| | | | |
| //! Assert that x is true. | | | |
| #define __TBB_ASSERT_NS(predicate,message,ns) ((predicate)?((void)0) : | | | |
| ns::assertion_failure(__FILE__,__LINE__,#predicate,message)) | | | |
| /** If x is false, print assertion failure message. | | | |
| If the comment argument is not NULL, it is printed as part of the f | | | |
| ailure message. | | | |
| The comment argument has no other effect. */ | | | |
| | | | |
| #if __TBBMALLOC_BUILD | | #if __TBBMALLOC_BUILD | |
| namespace rml { namespace internal { | | namespace rml { namespace internal { | |
|
| #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,messa
ge,rml::internal) | | #define __TBB_ASSERT_RELEASE(predicate,message) ((predicate)?((void)0) : r
ml::internal::assertion_failure(__FILE__,__LINE__,#predicate,message)) | |
| #else | | #else | |
| namespace tbb { | | namespace tbb { | |
|
| #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,messa
ge,tbb) | | #define __TBB_ASSERT_RELEASE(predicate,message) ((predicate)?((void)0) : t
bb::assertion_failure(__FILE__,__LINE__,#predicate,message)) | |
| #endif | | #endif | |
|
| #define __TBB_ASSERT_EX __TBB_ASSERT | | | |
| | | | |
| //! Set assertion handler and return previous value of it. | | //! Set assertion handler and return previous value of it. | |
| assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( asser
tion_handler_type new_handler ); | | assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( asser
tion_handler_type new_handler ); | |
| | | | |
| //! Process an assertion failure. | | //! Process an assertion failure. | |
| /** Normally called from __TBB_ASSERT macro. | | /** Normally called from __TBB_ASSERT macro. | |
| If assertion handler is null, print message for assertion failure a
nd abort. | | If assertion handler is null, print message for assertion failure a
nd abort. | |
| Otherwise call the assertion handler. */ | | Otherwise call the assertion handler. */ | |
| void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int l
ine, const char* expression, const char* comment ); | | void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int l
ine, const char* expression, const char* comment ); | |
| | | | |
| #if __TBBMALLOC_BUILD | | #if __TBBMALLOC_BUILD | |
| }} // namespace rml::internal | | }} // namespace rml::internal | |
| #else | | #else | |
| } // namespace tbb | | } // namespace tbb | |
| #endif | | #endif | |
| | | | |
|
| | | #if TBB_USE_ASSERT | |
| | | | |
| | | //! Assert that x is true. | |
| | | /** If x is false, print assertion failure message. | |
| | | If the comment argument is not NULL, it is printed as part of the f | |
| | | ailure message. | |
| | | The comment argument has no other effect. */ | |
| | | #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_RELEASE(predicate, | |
| | | message) | |
| | | | |
| | | #define __TBB_ASSERT_EX __TBB_ASSERT | |
| | | | |
| #else /* !TBB_USE_ASSERT */ | | #else /* !TBB_USE_ASSERT */ | |
| | | | |
| //! No-op version of __TBB_ASSERT. | | //! No-op version of __TBB_ASSERT. | |
| #define __TBB_ASSERT(predicate,comment) ((void)0) | | #define __TBB_ASSERT(predicate,comment) ((void)0) | |
| //! "Extended" version is useful to suppress warnings if a variable is
only used with an assert | | //! "Extended" version is useful to suppress warnings if a variable is
only used with an assert | |
| #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate))) | | #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate))) | |
| | | | |
| #endif /* !TBB_USE_ASSERT */ | | #endif /* !TBB_USE_ASSERT */ | |
| | | | |
| //! The namespace tbb contains all components of the library. | | //! The namespace tbb contains all components of the library. | |
| | | | |
End of changes. 6 change blocks. |
| 14 lines changed or deleted | | 15 lines changed or added | |
|