| _concurrent_queue_impl.h | | _concurrent_queue_impl.h | |
| | | | |
| skipping to change at line 307 | | skipping to change at line 307 | |
| template<typename T> | | template<typename T> | |
| micro_queue<T>& micro_queue<T>::assign( const micro_queue<T>& src, concurre
nt_queue_base_v3<T>& base ) { | | micro_queue<T>& micro_queue<T>::assign( const micro_queue<T>& src, concurre
nt_queue_base_v3<T>& base ) { | |
| head_counter = src.head_counter; | | head_counter = src.head_counter; | |
| tail_counter = src.tail_counter; | | tail_counter = src.tail_counter; | |
| page_mutex = src.page_mutex; | | page_mutex = src.page_mutex; | |
| | | | |
| const page* srcp = src.head_page; | | const page* srcp = src.head_page; | |
| if( is_valid_page(srcp) ) { | | if( is_valid_page(srcp) ) { | |
| ticket g_index = head_counter; | | ticket g_index = head_counter; | |
| __TBB_TRY { | | __TBB_TRY { | |
|
| size_t n_items = (tail_counter-head_counter)/concurrent_queue_
rep_base::n_queue; | | size_t n_items = (tail_counter-head_counter)/concurrent_queue_r
ep_base::n_queue; | |
| size_t index = head_counter/concurrent_queue_rep_base::n_queue
& (base.my_rep->items_per_page-1); | | 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_pe
r_page)?(index+n_items):base.my_rep->items_per_page; | | size_t end_in_first_page = (index+n_items<base.my_rep->items_pe
r_page)?(index+n_items):base.my_rep->items_per_page; | |
| | | | |
| head_page = make_copy( base, srcp, index, end_in_first_page, g_
index ); | | head_page = make_copy( base, srcp, index, end_in_first_page, g_
index ); | |
| page* cur_page = head_page; | | page* cur_page = head_page; | |
| | | | |
| if( srcp != src.tail_page ) { | | if( srcp != src.tail_page ) { | |
| for( srcp = srcp->next; srcp!=src.tail_page; srcp=srcp->nex
t ) { | | for( srcp = srcp->next; srcp!=src.tail_page; srcp=srcp->nex
t ) { | |
| cur_page->next = make_copy( base, srcp, 0, base.my_rep-
>items_per_page, g_index ); | | cur_page->next = make_copy( base, srcp, 0, base.my_rep-
>items_per_page, g_index ); | |
| cur_page = cur_page->next; | | cur_page = cur_page->next; | |
| | | | |
| skipping to change at line 529 | | skipping to change at line 529 | |
| 1; | | 1; | |
| } | | } | |
| | | | |
| template<typename T> | | template<typename T> | |
| bool concurrent_queue_base_v3<T>::internal_try_pop( void* dst ) { | | bool concurrent_queue_base_v3<T>::internal_try_pop( void* dst ) { | |
| concurrent_queue_rep<T>& r = *my_rep; | | concurrent_queue_rep<T>& r = *my_rep; | |
| ticket k; | | ticket k; | |
| do { | | do { | |
| k = r.head_counter; | | k = r.head_counter; | |
| for(;;) { | | for(;;) { | |
|
| if( r.tail_counter<=k ) { | | if( (ptrdiff_t)(r.tail_counter-k)<=0 ) { | |
| // Queue is empty | | // Queue is empty | |
| return false; | | return false; | |
| } | | } | |
| // Queue had item with ticket k when we looked. Attempt to get
that item. | | // Queue had item with ticket k when we looked. Attempt to get
that item. | |
| ticket tk=k; | | ticket tk=k; | |
| #if defined(_MSC_VER) && defined(_Wp64) | | #if defined(_MSC_VER) && defined(_Wp64) | |
| #pragma warning (push) | | #pragma warning (push) | |
| #pragma warning (disable: 4267) | | #pragma warning (disable: 4267) | |
| #endif | | #endif | |
| k = r.head_counter.compare_and_swap( tk+1, tk ); | | k = r.head_counter.compare_and_swap( tk+1, tk ); | |
| | | | |
| skipping to change at line 866 | | skipping to change at line 866 | |
| protected: | | protected: | |
| __TBB_EXPORTED_METHOD concurrent_queue_base_v3( size_t item_size ); | | __TBB_EXPORTED_METHOD concurrent_queue_base_v3( size_t item_size ); | |
| virtual __TBB_EXPORTED_METHOD ~concurrent_queue_base_v3(); | | virtual __TBB_EXPORTED_METHOD ~concurrent_queue_base_v3(); | |
| | | | |
| //! Enqueue item at tail of queue | | //! Enqueue item at tail of queue | |
| void __TBB_EXPORTED_METHOD internal_push( const void* src ); | | void __TBB_EXPORTED_METHOD internal_push( const void* src ); | |
| | | | |
| //! Dequeue item from head of queue | | //! Dequeue item from head of queue | |
| void __TBB_EXPORTED_METHOD internal_pop( void* dst ); | | void __TBB_EXPORTED_METHOD internal_pop( void* dst ); | |
| | | | |
|
| | | //! Abort all pending queue operations | |
| | | void __TBB_EXPORTED_METHOD internal_abort(); | |
| | | | |
| //! Attempt to enqueue item onto queue. | | //! Attempt to enqueue item onto queue. | |
| bool __TBB_EXPORTED_METHOD internal_push_if_not_full( const void* src )
; | | bool __TBB_EXPORTED_METHOD internal_push_if_not_full( const void* src )
; | |
| | | | |
| //! Attempt to dequeue item from queue. | | //! Attempt to dequeue item from queue. | |
| /** NULL if there was no item to dequeue. */ | | /** NULL if there was no item to dequeue. */ | |
| bool __TBB_EXPORTED_METHOD internal_pop_if_present( void* dst ); | | bool __TBB_EXPORTED_METHOD internal_pop_if_present( void* dst ); | |
| | | | |
| //! Get size of queue | | //! Get size of queue | |
| ptrdiff_t __TBB_EXPORTED_METHOD internal_size() const; | | ptrdiff_t __TBB_EXPORTED_METHOD internal_size() const; | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 5 lines changed or added | |
|
| tbb_exception.h | | tbb_exception.h | |
| | | | |
| skipping to change at line 64 | | skipping to change at line 64 | |
| /*override*/ ~bad_last_alloc() throw() {} | | /*override*/ ~bad_last_alloc() throw() {} | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| //! Exception for PPL locks | | //! Exception for PPL locks | |
| class improper_lock : public std::exception { | | class improper_lock : public std::exception { | |
| public: | | public: | |
| /*override*/ const char* what() const throw(); | | /*override*/ const char* what() const throw(); | |
| }; | | }; | |
| | | | |
|
| | | //! Exception for user-initiated abort | |
| | | class user_abort : public std::exception { | |
| | | public: | |
| | | /*override*/ const char* what() const throw(); | |
| | | }; | |
| | | | |
| //! Exception for missing wait on structured_task_group | | //! Exception for missing wait on structured_task_group | |
| class missing_wait : public std::exception { | | class missing_wait : public std::exception { | |
| public: | | public: | |
| /*override*/ const char* what() const throw(); | | /*override*/ const char* what() const throw(); | |
| }; | | }; | |
| | | | |
| //! Exception for repeated scheduling of the same task_handle | | //! Exception for repeated scheduling of the same task_handle | |
| class invalid_multiple_scheduling : public std::exception { | | class invalid_multiple_scheduling : public std::exception { | |
| public: | | public: | |
| /*override*/ const char* what() const throw(); | | /*override*/ const char* what() const throw(); | |
| | | | |
| skipping to change at line 98 | | skipping to change at line 104 | |
| eid_invalid_multiple_scheduling, | | eid_invalid_multiple_scheduling, | |
| eid_improper_lock, | | eid_improper_lock, | |
| eid_possible_deadlock, | | eid_possible_deadlock, | |
| eid_operation_not_permitted, | | eid_operation_not_permitted, | |
| eid_condvar_wait_failed, | | eid_condvar_wait_failed, | |
| eid_invalid_load_factor, | | eid_invalid_load_factor, | |
| eid_reserved, // free slot for backward compatibility, can be reused. | | eid_reserved, // free slot for backward compatibility, can be reused. | |
| eid_invalid_swap, | | eid_invalid_swap, | |
| eid_reservation_length_error, | | eid_reservation_length_error, | |
| eid_invalid_key, | | eid_invalid_key, | |
|
| | | eid_user_abort, | |
| //! The last enumerator tracks the number of defined IDs. It must remai
n the last one. | | //! The last enumerator tracks the number of defined IDs. It must remai
n the last one. | |
| /** When adding new IDs, place them immediately _before_ this comment (
that is | | /** When adding new IDs, place them immediately _before_ this comment (
that is | |
| _after_ all the existing IDs. NEVER insert new IDs between the exis
ting ones. **/ | | _after_ all the existing IDs. NEVER insert new IDs between the exis
ting ones. **/ | |
| eid_max | | eid_max | |
| }; | | }; | |
| | | | |
| //! Gathers all throw operators in one place. | | //! Gathers all throw operators in one place. | |
| /** Its purpose is to minimize code bloat that can be caused by throw opera
tors | | /** Its purpose is to minimize code bloat that can be caused by throw opera
tors | |
| scattered in multiple places, especially in templates. **/ | | scattered in multiple places, especially in templates. **/ | |
| void __TBB_EXPORTED_FUNC throw_exception_v4 ( exception_id ); | | void __TBB_EXPORTED_FUNC throw_exception_v4 ( exception_id ); | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 7 lines changed or added | |
|
| tuple | | tuple | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| struct component<0,null_type> { | | struct component<0,null_type> { | |
| typedef null_type type; | | typedef null_type type; | |
| }; | | }; | |
| | | | |
| // const version of component | | // const version of component | |
| | | | |
| template<int N, class T> | | template<int N, class T> | |
| struct component<N, const T> | | struct component<N, const T> | |
| { | | { | |
| typedef typename T::tail_type next; | | typedef typename T::tail_type next; | |
|
| typedef typename component<N-1,next>::type type; | | typedef const typename component<N-1,next>::type type; | |
| }; | | }; | |
| | | | |
| template<class T> | | template<class T> | |
| struct component<0, const T> | | struct component<0, const T> | |
| { | | { | |
| typedef const typename T::head_type type; | | typedef const typename T::head_type type; | |
| }; | | }; | |
| | | | |
| // helper class for getting components of cons | | // helper class for getting components of cons | |
| template< int N> | | template< int N> | |
| struct get_helper { | | struct get_helper { | |
| template<class HT, class TT> | | template<class HT, class TT> | |
| inline static typename component<N, cons<HT,TT> >::type& get(cons<HT,TT>& t
i) { | | inline static typename component<N, cons<HT,TT> >::type& get(cons<HT,TT>& t
i) { | |
| return get_helper<N-1>::get(ti.tail); | | return get_helper<N-1>::get(ti.tail); | |
| } | | } | |
|
| | | template<class HT, class TT> | |
| | | inline static typename component<N, cons<HT,TT> >::type const& get(const co | |
| | | ns<HT,TT>& ti) { | |
| | | return get_helper<N-1>::get(ti.tail); | |
| | | } | |
| }; | | }; | |
| | | | |
| template<> | | template<> | |
| struct get_helper<0> { | | struct get_helper<0> { | |
| template<class HT, class TT> | | template<class HT, class TT> | |
| inline static typename component<0, cons<HT,TT> >::type& get(cons<HT,TT>& t
i) { | | inline static typename component<0, cons<HT,TT> >::type& get(cons<HT,TT>& t
i) { | |
| return ti.head; | | return ti.head; | |
| } | | } | |
|
| | | template<class HT, class TT> | |
| | | inline static typename component<0, cons<HT,TT> >::type const& get(const co | |
| | | ns<HT,TT>& ti) { | |
| | | return ti.head; | |
| | | } | |
| }; | | }; | |
| | | | |
| // traits adaptor | | // traits adaptor | |
| template <class T0, class T1, class T2, class T3, class T4, class T5, class
T6, class T7, class T8, class T9> | | template <class T0, class T1, class T2, class T3, class T4, class T5, class
T6, class T7, class T8, class T9> | |
| struct tuple_traits { | | struct tuple_traits { | |
| typedef cons <T0, typename tuple_traits<T1, T2, T3, T4, T5, T6, T7, T8,
T9, null_type>::U > U; | | typedef cons <T0, typename tuple_traits<T1, T2, T3, T4, T5, T6, T7, T8,
T9, null_type>::U > U; | |
| }; | | }; | |
| | | | |
| template <> | | template <> | |
| struct tuple_traits<class T0, null_type, null_type, null_type, null_type, n
ull_type, null_type, null_type, null_type, null_type> { | | struct tuple_traits<class T0, null_type, null_type, null_type, null_type, n
ull_type, null_type, null_type, null_type, null_type> { | |
| | | | |
| skipping to change at line 298 | | skipping to change at line 306 | |
| internal::tuple_traits<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>::U(t0,t1,t2,t
3,t4,t5,t6,t7,t8,t9) { } | | internal::tuple_traits<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>::U(t0,t1,t2,t
3,t4,t5,t6,t7,t8,t9) { } | |
| | | | |
| template<int N> | | template<int N> | |
| struct internal_tuple_element { | | struct internal_tuple_element { | |
| typedef typename internal::component<N,my_cons>::type type; | | typedef typename internal::component<N,my_cons>::type type; | |
| }; | | }; | |
| | | | |
| template<int N> | | template<int N> | |
| typename internal_tuple_element<N>::type& get() { return internal::get_
helper<N>::get(*this); } | | typename internal_tuple_element<N>::type& get() { return internal::get_
helper<N>::get(*this); } | |
| | | | |
|
| | | template<int N> | |
| | | typename internal_tuple_element<N>::type const& get() const { return in | |
| | | ternal::get_helper<N>::get(*this); } | |
| | | | |
| template<class U1, class U2> | | template<class U1, class U2> | |
| tuple& operator=(const internal::cons<U1,U2>& other) { | | tuple& operator=(const internal::cons<U1,U2>& other) { | |
| my_cons::operator=(other); | | my_cons::operator=(other); | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<class U1, class U2> | | template<class U1, class U2> | |
| tuple& operator=(const std::pair<U1,U2>& other) { | | tuple& operator=(const std::pair<U1,U2>& other) { | |
| // __TBB_ASSERT(tuple_size<value_type>::value == 2, "Invalid size f
or pair to tuple assignment"); | | // __TBB_ASSERT(tuple_size<value_type>::value == 2, "Invalid size f
or pair to tuple assignment"); | |
| this->head = other.first; | | this->head = other.first; | |
| | | | |
| skipping to change at line 382 | | skipping to change at line 393 | |
| class tuple_size<null_type> { | | class tuple_size<null_type> { | |
| public: | | public: | |
| static const size_t value = 0; | | static const size_t value = 0; | |
| }; | | }; | |
| | | | |
| template<int N, class T> | | template<int N, class T> | |
| struct tuple_element { | | struct tuple_element { | |
| typedef typename internal::component<N, typename T::my_cons>::type type
; | | typedef typename internal::component<N, typename T::my_cons>::type type
; | |
| }; | | }; | |
| | | | |
|
| template<int N, class T> | | template<int N, class T0, class T1, class T2, class T3, class T4, class T5, | |
| inline static typename tuple_element<N,T>::type& get(T &t) { return t.get<N | | class T6, class T7, class T8, class T9> | |
| >(); } | | inline static typename tuple_element<N,tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> | |
| | | >::type& | |
| template<int N, class T> | | get(tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>& t) { return t.get<N>(); } | |
| inline static typename tuple_element<N,T>::type const& get(T const &t) { re | | | |
| turn | | template<int N, class T0, class T1, class T2, class T3, class T4, class T5, | |
| const_cast<typename tuple_element<N,T>::type const &> | | class T6, class T7, class T8, class T9> | |
| (const_cast<T &>(t).get<N>()); } | | inline static typename tuple_element<N,tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> | |
| | | >::type const& | |
| | | get(const tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>& t) { return t.get<N>(); | |
| | | } | |
| | | | |
| } // interface5 | | } // interface5 | |
| } // tbb | | } // tbb | |
| | | | |
| #if TBB_IMPLEMENT_CPP0X | | #if TBB_IMPLEMENT_CPP0X | |
| namespace std { | | namespace std { | |
| using tbb::interface5::tuple; | | using tbb::interface5::tuple; | |
| using tbb::interface5::tuple_size; | | using tbb::interface5::tuple_size; | |
| using tbb::interface5::tuple_element; | | using tbb::interface5::tuple_element; | |
| using tbb::interface5::get; | | using tbb::interface5::get; | |
| | | | |
End of changes. 5 change blocks. |
| 10 lines changed or deleted | | 27 lines changed or added | |
|