Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
A buffer of input items for a filter. More...
Public Member Functions | |
input_buffer (bool is_ordered_, bool is_bound_) | |
Construct empty buffer. More... | |
~input_buffer () | |
Destroy the buffer. More... | |
bool | put_token (task_info &info_, bool force_put=false) |
Put a token into the buffer. More... | |
template<typename StageTask > | |
void | note_done (Token token, StageTask &spawner) |
Note that processing of a token is finished. More... | |
bool | return_item (task_info &info, bool advance) |
return an item, invalidate the queued item, but only advance if the filter More... | |
bool | has_item () |
true if the current low_token is valid. More... | |
void | create_my_tls () |
void | destroy_my_tls () |
bool | my_tls_end_of_input () |
void | set_my_tls_end_of_input () |
Private Types | |
typedef Token | size_type |
typedef basic_tls< intptr_t > | end_of_input_tls_t |
for parallel filters that accepts NULLs, thread-local flag for reaching end_of_input More... | |
Private Member Functions | |
void | grow (size_type minimum_size) |
Resize "array". More... | |
void | create_sema (size_t initial_tokens) |
void | free_sema () |
void | sema_P () |
void | sema_V () |
![]() | |
no_copy (const no_copy &)=delete | |
no_copy ()=default | |
Private Attributes | |
task_info * | array |
Array of deferred tasks that cannot yet start executing. More... | |
semaphore * | my_sem |
for thread-bound filter, semaphore for waiting, NULL otherwise. More... | |
size_type | array_size |
Size of array. More... | |
Token | low_token |
Lowest token that can start executing. More... | |
spin_mutex | array_mutex |
Serializes updates. More... | |
Token | high_token |
Used for out of order buffer, and for assigning my_token if is_ordered and my_token not already assigned. More... | |
bool | is_ordered |
True for ordered filter, false otherwise. More... | |
bool | is_bound |
True for thread-bound filter, false otherwise. More... | |
end_of_input_tls_t | end_of_input_tls |
bool | end_of_input_tls_allocated |
Static Private Attributes | |
static const size_type | initial_buffer_size = 4 |
Initial size for "array". More... | |
Friends | |
class | tbb::internal::pipeline_root_task |
class | tbb::filter |
class | tbb::thread_bound_filter |
class | tbb::internal::stage_task |
class | tbb::pipeline |
A buffer of input items for a filter.
Each item is a task_info, inserted into a position in the buffer corresponding to a Token.
Definition at line 48 of file pipeline.cpp.
|
private |
for parallel filters that accepts NULLs, thread-local flag for reaching end_of_input
Definition at line 92 of file pipeline.cpp.
|
private |
Definition at line 55 of file pipeline.cpp.
|
inline |
Construct empty buffer.
Definition at line 103 of file pipeline.cpp.
References __TBB_ASSERT, array, create_sema(), grow(), initial_buffer_size, and is_bound.
|
inline |
Destroy the buffer.
Definition at line 114 of file pipeline.cpp.
References __TBB_ASSERT, array, array_size, tbb::cache_aligned_allocator< T >::deallocate(), destroy_my_tls(), end_of_input_tls_allocated, free_sema(), my_sem, and tbb::internal::poison_pointer().
|
inline |
Definition at line 225 of file pipeline.cpp.
References tbb::internal::basic_tls< T >::create(), end_of_input_tls, end_of_input_tls_allocated, and tbb::internal::handle_perror().
|
inlineprivate |
Definition at line 96 of file pipeline.cpp.
References __TBB_ASSERT, and my_sem.
Referenced by input_buffer().
|
inline |
Definition at line 226 of file pipeline.cpp.
References tbb::internal::basic_tls< T >::destroy(), end_of_input_tls, and tbb::internal::handle_perror().
Referenced by ~input_buffer().
|
inlineprivate |
Definition at line 97 of file pipeline.cpp.
References __TBB_ASSERT, and my_sem.
Referenced by ~input_buffer().
Resize "array".
Caller is responsible to acquiring a lock on "array_mutex".
Definition at line 231 of file pipeline.cpp.
References tbb::cache_aligned_allocator< T >::allocate(), array, array_size, tbb::cache_aligned_allocator< T >::deallocate(), initial_buffer_size, low_token, and new_size.
Referenced by input_buffer(), and put_token().
|
inline |
true if the current low_token is valid.
Definition at line 222 of file pipeline.cpp.
References array, array_mutex, array_size, lock, and low_token.
|
inline |
Definition at line 227 of file pipeline.cpp.
References end_of_input_tls, and tbb::internal::basic_tls< T >::get().
Referenced by tbb::internal::stage_task::execute().
|
inline |
Note that processing of a token is finished.
Fires up processing of the next token, if processing was deferred.
Definition at line 174 of file pipeline.cpp.
References array, array_mutex, array_size, is_ordered, tbb::internal::task_info::is_valid, ITT_NOTIFY, lock, low_token, and tbb::internal::task_info::reset().
Referenced by tbb::internal::stage_task::execute().
|
inline |
Put a token into the buffer.
If task information was placed into buffer, returns true; otherwise returns false, informing the caller to create and spawn a task. If input buffer owned by thread-bound filter and the item at low_token was not valid, issue a V() If the input_buffer is owned by a successor to a thread-bound filter, the force_put parameter should be true to ensure the token is inserted in the buffer.
Definition at line 135 of file pipeline.cpp.
References __TBB_ASSERT, array, array_mutex, array_size, grow(), high_token, is_bound, is_ordered, tbb::internal::task_info::is_valid, ITT_NOTIFY, lock, low_token, tbb::internal::task_info::my_token, tbb::internal::task_info::my_token_ready, sema_V(), and sync_releasing.
Referenced by tbb::internal::stage_task::execute().
|
inline |
return an item, invalidate the queued item, but only advance if the filter
Definition at line 208 of file pipeline.cpp.
References array, array_mutex, array_size, tbb::internal::task_info::is_valid, ITT_NOTIFY, lock, and low_token.
Referenced by tbb::internal::stage_task::execute(), and tbb::internal::pipeline_root_task::execute().
|
inlineprivate |
Definition at line 98 of file pipeline.cpp.
References __TBB_ASSERT, my_sem, and tbb::internal::semaphore::P().
|
inlineprivate |
Definition at line 99 of file pipeline.cpp.
References __TBB_ASSERT, my_sem, and tbb::internal::semaphore::V().
Referenced by put_token().
|
inline |
Definition at line 228 of file pipeline.cpp.
References end_of_input_tls, and tbb::internal::basic_tls< T >::set().
|
friend |
Definition at line 50 of file pipeline.cpp.
|
friend |
Definition at line 49 of file pipeline.cpp.
|
friend |
Definition at line 52 of file pipeline.cpp.
|
friend |
Definition at line 53 of file pipeline.cpp.
|
friend |
Definition at line 51 of file pipeline.cpp.
|
private |
Array of deferred tasks that cannot yet start executing.
Definition at line 58 of file pipeline.cpp.
Referenced by grow(), has_item(), input_buffer(), note_done(), put_token(), return_item(), and ~input_buffer().
|
private |
Serializes updates.
Definition at line 72 of file pipeline.cpp.
Referenced by has_item(), note_done(), put_token(), and return_item().
|
private |
Size of array.
Always 0 or a power of 2
Definition at line 65 of file pipeline.cpp.
Referenced by grow(), has_item(), note_done(), put_token(), return_item(), and ~input_buffer().
|
private |
Definition at line 93 of file pipeline.cpp.
Referenced by create_my_tls(), destroy_my_tls(), my_tls_end_of_input(), and set_my_tls_end_of_input().
|
private |
Definition at line 94 of file pipeline.cpp.
Referenced by create_my_tls(), and ~input_buffer().
|
private |
Used for out of order buffer, and for assigning my_token if is_ordered and my_token not already assigned.
Definition at line 83 of file pipeline.cpp.
Referenced by put_token().
|
staticprivate |
Initial size for "array".
Must be a power of 2
Definition at line 80 of file pipeline.cpp.
Referenced by grow(), and input_buffer().
|
private |
True for thread-bound filter, false otherwise.
Definition at line 89 of file pipeline.cpp.
Referenced by input_buffer(), and put_token().
|
private |
True for ordered filter, false otherwise.
Definition at line 86 of file pipeline.cpp.
Referenced by note_done(), and put_token().
|
private |
Lowest token that can start executing.
All prior Token have already been seen.
Definition at line 69 of file pipeline.cpp.
Referenced by grow(), has_item(), note_done(), put_token(), and return_item().
|
private |
for thread-bound filter, semaphore for waiting, NULL otherwise.
Definition at line 61 of file pipeline.cpp.
Referenced by create_sema(), free_sema(), sema_P(), sema_V(), and ~input_buffer().