A helper class to divide a range into blocks. Used by detach_blocks()
, submit_blocks()
, detach_loop()
, and submit_loop()
.
More...
|
| blocks (const T first_index_, const T index_after_last_, const size_t num_blocks_) |
| Construct a blocks object with the given specifications.
|
|
T | start (const size_t block) const |
| Get the first index of a block.
|
|
T | end (const size_t block) const |
| Get the index after the last index of a block.
|
|
size_t | get_num_blocks () const |
| Get the number of blocks. Note that this may be different than the desired number of blocks that was passed to the constructor.
|
|
|
size_t | block_size = 0 |
| The size of each block (except possibly the last block).
|
|
T | first_index = 0 |
| The first index in the range.
|
|
T | index_after_last = 0 |
| The index after the last index in the range.
|
|
size_t | num_blocks = 0 |
| The number of blocks.
|
|
size_t | remainder = 0 |
| The remainder obtained after dividing the total size by the number of blocks.
|
|
template<typename T>
class BS::thread_pool::blocks< T >
A helper class to divide a range into blocks. Used by detach_blocks()
, submit_blocks()
, detach_loop()
, and submit_loop()
.
- Template Parameters
-
T | The type of the indices. Should be a signed or unsigned integer. |
◆ blocks()
Construct a blocks
object with the given specifications.
- Parameters
-
first_index_ | The first index in the range. |
index_after_last_ | The index after the last index in the range. |
num_blocks_ | The desired number of blocks to divide the range into. |
966 {
968 {
975 {
977 num_blocks = (total_size > 1) ? total_size : 1;
978 }
979 }
980 else
981 {
983 }
984 }
size_t block_size
The size of each block (except possibly the last block).
Definition BS_thread_pool.hpp:1022
size_t num_blocks
The number of blocks.
Definition BS_thread_pool.hpp:1037
T index_after_last
The index after the last index in the range.
Definition BS_thread_pool.hpp:1032
T first_index
The first index in the range.
Definition BS_thread_pool.hpp:1027
size_t remainder
The remainder obtained after dividing the total size by the number of blocks.
Definition BS_thread_pool.hpp:1042
◆ start()
Get the first index of a block.
- Parameters
-
- Returns
- The first index.
◆ end()
Get the index after the last index of a block.
- Parameters
-
- Returns
- The index after the last index.
1004 {
1006 }
T start(const size_t block) const
Get the first index of a block.
Definition BS_thread_pool.hpp:992
◆ get_num_blocks()
Get the number of blocks. Note that this may be different than the desired number of blocks that was passed to the constructor.
- Returns
- The number of blocks.
The documentation for this class was generated from the following file: