Software Open Access
BS_thread_pool.hpp
:BS::thread_pool
class:push_loop()
, which does the same thing as parallelize_loop()
, except that it does not return a BS::multi_future
with the futures for each block. Just like push_task()
vs. submit()
, this avoids the overhead of creating the futures, but the user must use wait_for_tasks()
or some other method to ensure that the loop finishes executing, otherwise bad things will happen.push_task()
and submit()
now utilize perfect forwarding in order to support more types of tasks - in particular member functions, which in previous versions could not be submitted unless wrapped in a lambda. To submit a member function, use the syntax submit(&class::function, &object, args)
. More information can be found in README.md
. See #9.push_loop()
and parallelize_loop()
now have overloads where the first argument (the first index in the loop) is omitted, in which case it is assumed to be 0. This is for convenience, as the case where the first index is 0 is very common.BS::synced_stream
now utilizes perfect forwarding in the member functions print()
and println()
.std::endl
and std::flush
to print()
and println()
, since the compiler could not figure out which template specializations to use. The new objects BS::endl
and BS::flush
are explicit casts of these manipulators, whose sole purpose is to enable passing them to print()
and println()
.BS::multi_future::get()
now rethrows exceptions generated by the futures, even if the futures return void
. See #62.BS::blocks
, which is used by parallelize_loop()
and push_loop()
to divide a range into blocks. This class is not documented in README.md
, as it most likely will not be of interest to most users, but it is still publicly available, in case you want to parallelize something manually but still benefit from the built-in algorithm for splitting a range into blocks.BS_thread_pool_test.cpp
:count_unique_threads()
that caused it to get stuck on certain systems.dual_println()
now also flushes the stream using BS::endl
, so that if the test gets stuck, the log file will still contain everything up to that point. (Note: It is a common misconception that std::endl
and '\n'
are interchangeable. std::endl
not only prints a newline character, it also flushes the stream, which is not always desirable, as it may reduce performance.)std::mersenne_twister_engine
, which proved to be inconsistent across different compilers and systems, the test now generates each element via an arbitrarily-chosen numerical operation. In my testing, this provided much more consistent results.parallelize_loop()
, the test now uses the new push_loop()
function to squeeze out a bit more performance.README.md
:parallelize_loop()
to make it clearer.Name | Size | |
---|---|---|
bshoshany/thread-pool-v3.2.0.zip
md5:eaa30920f93f902561c03ba2d7684589 |
48.5 kB | Download |
All versions | This version | |
---|---|---|
Views | 736 | 8 |
Downloads | 23 | 0 |
Data volume | 621.5 kB | 0 Bytes |
Unique views | 678 | 8 |
Unique downloads | 13 | 0 |