| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ jobs: | |||
| 28 | 28 | - name: create-build-dir | |
| 29 | 29 | run: mkdir build | |
| 30 | 30 | - name: configure-cmake | |
| 31 | - run: cd build && cmake -D WAIT_QUEUE_BUILD_TESTS:BOOL=ON -D WAIT_QUEUE_BUILD_EXAMPLES:BOOL=ON -D JM_CIRCULAR_BUFFER_BUILD_TESTS:BOOL=OFF .. | ||
| 31 | + run: cd build && cmake -D CMAKE_POLICY_VERSION_MINIMUM=3.5 -D WAIT_QUEUE_BUILD_TESTS:BOOL=ON -D WAIT_QUEUE_BUILD_EXAMPLES:BOOL=ON -D JM_CIRCULAR_BUFFER_BUILD_TESTS:BOOL=OFF .. | ||
| 32 | 32 | - name: build | |
| 33 | 33 | run: cd build && cmake --build . --config $BUILD_TYPE | |
| 34 | 34 | - name: run-unit-test | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,7 @@ jobs: | |||
| 18 | 18 | - name: checkout | |
| 19 | 19 | uses: actions/checkout@v4 | |
| 20 | 20 | - name: run-doxygen | |
| 21 | - uses: mattnotmitt/doxygen-action@v1.9.8 | ||
| 21 | + uses: mattnotmitt/doxygen-action@v1.12.0 | ||
| 22 | 22 | with: | |
| 23 | 23 | working-directory: doc | |
| 24 | 24 | - name: deploy-pages | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - # Copyright (c) 2024 by Cliff Green | ||
| 1 | + # Copyright (c) 2024-2025 by Cliff Green | ||
| 2 | 2 | # | |
| 3 | 3 | # https://github.com/connectivecpp/wait-queue | |
| 4 | 4 | # | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,8 @@ | |||
| 18 | 18 | ||
| 19 | 19 | Shutdown semantics are available through `std::stop_token` facilities. A `std::stop_token` can be passed in through the constructors, allowing shutdown to be requested externally to the `wait_queue`, or shutdown can be requested through the `wait_queue request_stop` method. | |
| 20 | 20 | ||
| 21 | + [P0260R15 - C++ Concurrent Queues](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p0260r15.html) has recently (February 2025) been accepted by the standards committee for C++ 26. This proposal has more features than `wait_queue`, but much of the API is similar. | ||
| 22 | + | ||
| 21 | 23 | Thanks go to [Louis Langholtz](https://github.com/louis-langholtz) for adding DBC (Design by Contract) asserts and comments. | |
| 22 | 24 | ||
| 23 | 25 | Concepts and various type constraints have been added. Enhancements are always appreciated. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | file( | |
| 6 | 6 | DOWNLOAD | |
| 7 | - https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.39.0/CPM.cmake | ||
| 7 | + https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.8/CPM.cmake | ||
| 8 | 8 | ${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake | |
| 9 | 9 | ) | |
| 10 | 10 | include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - # Copyright (c) 2024 by Cliff Green | ||
| 1 | + # Copyright (c) 2024-2025 by Cliff Green | ||
| 2 | 2 | # | |
| 3 | 3 | # Distributed under the Boost Software License, Version 1.0. | |
| 4 | 4 | # (See accompanying file LICENSE.txt or copy at https://www.boost.org/LICENSE_1_0.txt) | |
@@ -8,15 +8,23 @@ cmake_minimum_required ( VERSION 3.14 FATAL_ERROR ) | |||
| 8 | 8 | # create project | |
| 9 | 9 | project ( wait_queue_example LANGUAGES CXX ) | |
| 10 | 10 | ||
| 11 | - # add executable | ||
| 11 | + # add dependencies | ||
| 12 | + CPMAddPackage ( "gh:connectivecpp/shared-buffer@1.0.2" ) | ||
| 13 | + | ||
| 14 | + # add executables | ||
| 12 | 15 | add_executable ( wait_queue_example wait_queue_example.cpp ) | |
| 13 | 16 | target_compile_features ( wait_queue_example PRIVATE cxx_std_20 ) | |
| 14 | 17 | ||
| 18 | + add_executable ( threaded_queue_buffer_demo threaded_queue_buffer_demo.cpp ) | ||
| 19 | + target_compile_features ( threaded_queue_buffer_demo PRIVATE cxx_std_20 ) | ||
| 20 | + | ||
| 15 | 21 | set ( CMAKE_THREAD_PREFER_PTHREAD TRUE ) | |
| 16 | 22 | set ( THREADS_PREFER_PTHREAD_FLAG TRUE ) | |
| 17 | 23 | find_package ( Threads REQUIRED ) | |
| 18 | 24 | ||
| 19 | 25 | # link dependencies | |
| 20 | 26 | target_link_libraries ( wait_queue_example PRIVATE | |
| 21 | 27 | Threads::Threads wait_queue ) | |
| 28 | + target_link_libraries ( threaded_queue_buffer_demo PRIVATE | ||
| 29 | + Threads::Threads shared_buffer wait_queue ) | ||
| 22 | 30 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,8 @@ | |||
| 7 | 7 | * Copyright (c)2019 by Thurman Gillespy | |
| 8 | 8 | * 3/22/19 | |
| 9 | 9 | * | |
| 10 | + * Minor changes Apr 2025 by Cliff Green to match changed APIs. | ||
| 11 | + * | ||
| 10 | 12 | * Distributed under the Boost Software License, Version 1.0. | |
| 11 | 13 | * (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
| 12 | 14 | * | |
@@ -26,7 +28,7 @@ | |||
| 26 | 28 | #include <ctime> // std::time | |
| 27 | 29 | ||
| 28 | 30 | #include "queue/wait_queue.hpp" | |
| 29 | - #include "marshall/shared_buffer.hpp" | ||
| 31 | + #include "buffer/shared_buffer.hpp" | ||
| 30 | 32 | ||
| 31 | 33 | ||
| 32 | 34 | /** Project Overview | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - # Copyright (c) 2024 by Cliff Green | ||
| 1 | + # Copyright (c) 2024-2025 by Cliff Green | ||
| 2 | 2 | # | |
| 3 | 3 | # Distributed under the Boost Software License, Version 1.0. | |
| 4 | 4 | # (See accompanying file LICENSE.txt or copy at https://www.boost.org/LICENSE_1_0.txt) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ | |||
| 19 | 19 | #include <set> | |
| 20 | 20 | #include <optional> | |
| 21 | 21 | #include <chrono> | |
| 22 | + #include <ranges> // std::views::iota | ||
| 22 | 23 | #include <type_traits> // std::is_arithmetic | |
| 23 | 24 | ||
| 24 | 25 | #include <thread> | |
@@ -45,12 +46,12 @@ void non_threaded_push_test(Q& wq, const typename Q::value_type& val, int count) | |||
| 45 | 46 | REQUIRE (wq.empty()); | |
| 46 | 47 | REQUIRE (wq.size() == 0); | |
| 47 | 48 | ||
| 48 | - for (int i {0}; i < count; ++i) { | ||
| 49 | + for (int i : std::ranges::iota_view{0, count}) { | ||
| 49 | 50 | REQUIRE(wq.push(val)); | |
| 50 | 51 | } | |
| 51 | 52 | REQUIRE_FALSE (wq.empty()); | |
| 52 | 53 | REQUIRE (wq.size() == count); | |
| 53 | - for (int i {0}; i < count; ++i) { | ||
| 54 | + for (int i : std::ranges::iota_view{0, count}) { | ||
| 54 | 55 | auto ret = wq.try_pop(); | |
| 55 | 56 | REQUIRE(*ret == val); | |
| 56 | 57 | } | |
@@ -69,22 +70,22 @@ void non_threaded_arithmetic_test(Q& wq, int count) { | |||
| 69 | 70 | ||
| 70 | 71 | REQUIRE (wq.empty()); | |
| 71 | 72 | ||
| 72 | - for (int i {0}; i < count; ++i) { | ||
| 73 | + for (int i : std::ranges::iota_view{0, count}) { | ||
| 73 | 74 | REQUIRE(wq.push(base_val)); | |
| 74 | 75 | } | |
| 75 | 76 | val_type sum { 0 }; | |
| 76 | 77 | wq.apply( [&sum] (const val_type& x) { sum += x; } ); | |
| 77 | 78 | REQUIRE (sum == expected_sum); | |
| 78 | 79 | ||
| 79 | - for (int i {0}; i < count; ++i) { | ||
| 80 | + for (int i : std::ranges::iota_view{0, count}) { | ||
| 80 | 81 | REQUIRE(*(wq.try_pop()) == base_val); | |
| 81 | 82 | } | |
| 82 | 83 | REQUIRE (wq.empty()); | |
| 83 | 84 | ||
| 84 | - for (int i {0}; i < count; ++i) { | ||
| 85 | + for (int i : std::ranges::iota_view{0, count}) { | ||
| 85 | 86 | wq.push(base_val+i); | |
| 86 | 87 | } | |
| 87 | - for (int i {0}; i < count; ++i) { | ||
| 88 | + for (int i : std::ranges::iota_view{0, count}) { | ||
| 88 | 89 | REQUIRE(*(wq.try_pop()) == (base_val+i)); | |
| 89 | 90 | } | |
| 90 | 91 | REQUIRE (wq.size() == 0); | |
@@ -389,25 +390,25 @@ TEST_CASE ( "Fixed size ring_span, testing wrap around with int type", | |||
| 389 | 390 | constexpr int Answer = 42; | |
| 390 | 391 | constexpr int AnswerPlus = 42+5; | |
| 391 | 392 | ||
| 392 | - for (int i {0}; i < N; ++i) { | ||
| 393 | + for (int i : std::ranges::iota_view{0, N}) { | ||
| 393 | 394 | wq.push(Answer); | |
| 394 | 395 | } | |
| 395 | 396 | REQUIRE (wq.size() == N); | |
| 396 | 397 | wq.apply([Answer] (const int& i) { REQUIRE(i == Answer); } ); | |
| 397 | 398 | ||
| 398 | - for (int i {0}; i < N; ++i) { | ||
| 399 | + for (int i : std::ranges::iota_view{0, N}) { | ||
| 399 | 400 | wq.push(Answer); | |
| 400 | 401 | } | |
| 401 | - for (int i {0}; i < (N/2); ++i) { | ||
| 402 | + for (int i : std::ranges::iota_view{0, N/2}) { | ||
| 402 | 403 | wq.push(AnswerPlus); | |
| 403 | 404 | } | |
| 404 | 405 | // the size is full but half match answer and half answer plus, since there's been wrap | |
| 405 | 406 | REQUIRE (wq.size() == N); | |
| 406 | 407 | // wait_pop should immediately return if the queue is non empty | |
| 407 | - for (int i {0}; i < (N/2); ++i) { | ||
| 408 | + for (int i : std::ranges::iota_view{0, N/2}) { | ||
| 408 | 409 | REQUIRE (wq.wait_and_pop() == Answer); | |
| 409 | 410 | } | |
| 410 | - for (int i {0}; i < (N/2); ++i) { | ||
| 411 | + for (int i : std::ranges::iota_view{0, N/2}) { | ||
| 411 | 412 | REQUIRE (wq.wait_and_pop() == AnswerPlus); | |
| 412 | 413 | } | |
| 413 | 414 | REQUIRE (wq.empty()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments