#include <math.h>#include <list>#include <rpa/iota_iterator.h>#include <rpa/algorithms/accumulate.h>#include <rpa/containers/pipeline.h>#include <rpa/algorithms/remove_copy_if.h>Defines | |
| #define | Test21(t) _Test21( #t, t ) |
Typedefs | |
| typedef long long | big_int_t |
| typedef std::list< big_int_t > | LstBigIntT |
| typedef rpa::pipe_circular< LstBigIntT, rpa::posix_condition > | BufferLstBigIntT |
| typedef std::back_insert_iterator< BufferLstBigIntT > | BackInsT |
| typedef big_int_t | BufTyp [BufSiz] |
| typedef rpa::posix_thread | thrArrayRemo [nbThrsRemo] |
| typedef rpa::thread_tree< thrArrayRemo, rpa::posix_thread * > | thr_tree_remo_t |
| typedef rpa::posix_thread | thrArrayAccm [nbThrsAccm] |
| typedef rpa::thread_tree< thrArrayAccm, void > | thr_tree_accm_t |
Functions | |
| static void | _Test21 (const char *msg, bool expr) |
| static bool | is_square (big_int_t bigInt) |
| Tells whether it is a suqare number. Acts as a predicate for std::remove. | |
| static double | test1 (void) |
| static double | test2 (void) |
| int | main (int aArgC, const char **aArgV) |
Variables | |
| static const size_t | maxBigInt = 1000000000L |
| const size_t | BufSiz = 10 |
| static const size_t | nbThrsRemo = 5 |
| static thrArrayRemo | thrsRemo |
| static const size_t | nbThrsAccm = 7 |
| static thrArrayAccm | thrsAccm |
| rpa::posix_mutex | mtxBuffer |
| static rpa::posix_thread | thrRemAcc |
| #define Test21 | ( | t | ) | _Test21( #t, t ) |
| typedef std::back_insert_iterator< BufferLstBigIntT > BackInsT |
| typedef long long big_int_t |
| typedef std::list< big_int_t > LstBigIntT |
| typedef rpa::thread_tree< thrArrayAccm, void > thr_tree_accm_t |
| typedef rpa::thread_tree< thrArrayRemo, rpa::posix_thread * > thr_tree_remo_t |
| typedef rpa::posix_thread thrArrayAccm[nbThrsAccm] |
| typedef rpa::posix_thread thrArrayRemo[nbThrsRemo] |
| static void _Test21 | ( | const char * | msg, | |
| bool | expr | |||
| ) | [static] |
| static bool is_square | ( | big_int_t | bigInt | ) | [static] |
Tells whether it is a suqare number. Acts as a predicate for std::remove.
| int main | ( | int | aArgC, | |
| const char ** | aArgV | |||
| ) |
| static double test1 | ( | void | ) | [static] |
| static double test2 | ( | void | ) | [static] |
| const size_t BufSiz = 10 |
const size_t maxBigInt = 1000000000L [static] |
This mutex locks the buffer between the removal of square numbers, and the addition of non-square numbers. It is not worth to have thread-specific buffers, because the insertion of non-square numbers is not a bottleneck, because it takes time to compute them.
const size_t nbThrsAccm = 7 [static] |
const size_t nbThrsRemo = 5 [static] |
rpa::posix_thread thrRemAcc [static] |
thrArrayAccm thrsAccm [static] |
thrArrayRemo thrsRemo [static] |
1.4.7