Tags: stlab/stlab
Tags
Improvements to coroutine support for `future<>` (#590) * Refactor tests to use doctest and update CMake configuration Replaced Boost.Test with doctest in all test files for improved testing framework consistency. Updated CMakeLists.txt to set the default C++ standard to C++20 and added new build presets for various debug configurations. Integrated doctest as a dependency for testing. Removed redundant CMake configurations related to Boost. This enhances the overall test structure and ensures compatibility with modern C++ standards. * Coroutine Fixes * Reworking Coroutine Support - More efficient - Correctly handles cancellation - Doesn't leak CR handles. * Start of inline documentation * Enhance CMake configuration and future functionality - Added support for AddressSanitizer (ASan) in CMake for both library and test targets. - Updated CMakeLists.txt to include CTest and reorganized module paths. - Introduced new coroutine tests for `resume_on` functionality with executors. - Enhanced `future` class with new methods for completion handling and coroutine support. * Improving process to build docs * Update CMake configuration and improve clang-tidy settings - Removed hardcoded C++ standard from .clang-tidy to avoid conflicts with clang-cl on Windows. - Enhanced CMakeLists.txt to ensure C++ exceptions are always enabled across compilers. - Updated CMakePresets.json to provide clearer instructions for using clang-tidy on Windows and added a new preset for clang-tidy-win64. - Refactored future and channel implementations to exclude enum types from operator overloads, improving type safety. - Cleaned up test files by removing unused includes and redundant test helper files. * Remove unused include for string in channel_tests.cpp to clean up code. * Update CMake presets and GitHub Actions for Clang and sanitizer support - Changed CMake version from 10 to 8 in CMakePresets.json. - Added new presets for Clang with libc++ and sanitizer configurations for Linux. - Updated GitHub Actions workflow to include a new job for macOS TSan builds, enhancing testing capabilities with ThreadSanitizer. * Enhance CMake presets and GitHub Actions for portable sanitizer support - Added a new CMake preset for a debug build with ThreadSanitizer and a portable task system. - Updated GitHub Actions workflow to include a job for macOS builds using the new portable sanitizer preset. - Improved documentation in the future.hpp file for clarity on completion handling. * clang-format * Check point Fixed issue with escaped coroutine handles. Still we need to allow escape for other awaiters. * Enhance coroutine handling in future implementation - Introduced atomic management of coroutine handles in shared_task to ensure proper destruction and ownership transfer. - Updated final_suspend behavior in coroutine traits to utilize the new final_awaiter, improving coroutine lifecycle management. - Added tests for handling coroutine escape scenarios, ensuring that coroutine handles are correctly managed after future destruction. * Refactor coroutine handling in future implementation - Improved clarity and formatting in the `shared` and `resume_on_awaiter_with_control` structures for better readability. - Updated `await_ready` logic to conditionally skip suspension based on the `AllowSkipSuspend` template parameter. - Introduced a new test case for `resume_on` with explicit executor handling, ensuring proper coroutine behavior with cancelled futures. * Remove redundant coroutine handle storage in future implementation - Eliminated unnecessary storage of coroutine handles in the `std::coroutine_traits` for both `stlab::future<T>` and `stlab::future<void>`, streamlining coroutine management. - This change enhances clarity and reduces potential overhead in coroutine lifecycle handling. * Add implementation notes for coroutine ownership and destruction in future.hpp - Documented coroutine ownership and destruction rules, clarifying safe destroy points and management of coroutine handles during suspension. - Enhanced understanding of coroutine lifecycle in relation to stlab::future, ensuring proper handling during abandonment and final suspension. * Refactor coroutine handling and improve documentation in future.hpp - Updated the `weak_state` friend function template to support variadic arguments for better flexibility. - Enhanced the `await_ready` method in `resume_on_awaiter_with_control` to improve clarity with explicit conditional logic. - Removed unnecessary debug output from coroutine tests to streamline test execution and focus on results. * Refactor coroutine handle storage in future.hpp - Changed the type of `_co_handle` in `shared_task` from `void*` to `uintptr_t` to prevent false positives in GCC 13 regarding string operations. - Updated coroutine handle management in `resume_on_awaiter_with_control` and `std::coroutine_traits` to use `uintptr_t`, ensuring proper type safety and clarity in coroutine address handling. - Adjusted memory order semantics for atomic operations to use `0` instead of `nullptr` for consistency. * Update GitHub Actions and matrix configuration for improved compatibility - Simplified compiler names in the matrix configuration for clarity. - Updated all compiler versions to 'latest' and OS to 'ubuntu-latest' for consistency across environments. - Changed the GitHub Actions runner from 'ubuntu-22.04' to 'ubuntu-latest' for better support. - Upgraded the checkout action to version 6 for enhanced performance and features. - Added a step to set up MSVC for Windows builds, improving the workflow for Windows users. * Update GitHub Actions matrix configuration and remove redundant environment variable steps - Removed version specifications for compilers in the matrix configuration to streamline setup. - Eliminated unnecessary environment variable steps for Linux GCC and Clang in the workflow, simplifying the configuration process. * Enhance GitHub Actions workflow and refine coroutine handle management - Added steps to set environment variables for GCC and Clang compilers in the GitHub Actions workflow, improving build configuration for Linux. - Updated coroutine handle management in `future.hpp` to use `void*` instead of `uintptr_t`, addressing GCC warnings and ensuring proper type handling. - Adjusted memory order semantics for atomic operations to utilize `nullptr`, enhancing clarity and consistency in coroutine lifecycle management. * Refactor coroutine handle management in future.hpp - Changed the storage type of `_co_handle` in `shared_task` from `std::atomic<void*>` to `void*`, simplifying the management of coroutine handles. - Removed unnecessary atomic operations and diagnostic pragmas, enhancing code clarity and reducing complexity. - Updated coroutine handle assignment in `await_suspend` and `await_transform` methods to directly use the pointer, streamlining the coroutine lifecycle management. * Refactor coroutine handle management in future.hpp - Removed unnecessary initialization of `_co_handle` in the `operator()` method of `shared`, simplifying the coroutine invocation process. - Updated implementation notes to clarify the destruction rules for coroutine handles, ensuring better understanding of their lifecycle management. * Fix coroutine handle destruction in shared_task - Added a null check for `_co_handle` before calling `destroy()` in the destructor of `shared_task`, preventing potential undefined behavior when the handle is not initialized. This enhances the safety and reliability of coroutine management. * Improve coroutine handle management in future.hpp - Clear _co_handle before invoking packaged_task to prevent destruction of the coroutine in ~shared_task(). - Update final_awaiter to destroy the coroutine handle directly in await_suspend, ensuring proper lifecycle management. - Refine implementation notes for clarity on coroutine ownership and destruction rules. * Add test for exception handling in co_await with future - Introduced a new test case to verify the behavior of coroutines when an exception is thrown during a co_await operation. - The test ensures that the coroutine correctly catches the exception and returns the expected value, enhancing the robustness of coroutine handling in future operations.
Sean parent/install (#589) * Integrate cpp-library for dependency tracking and install Updated CMake configuration to use cpp-library for automatic dependency tracking and installation support. Migrated dependency management to use stlab/stlab-copy-on-write and stlab/stlab-enum-ops. Added installation support with dependency auto-discovery, updated CMake minimum version, and adjusted file set naming for headers. Also added new CMake preset for installation builds and ensured CPM source cache is set in all relevant presets. * Update macos CI runner to latest * Update cpp-library to 5.1.1 and remove clangd target Bumps the stlab/cpp-library dependency from version 5.1.0 to 5.1.1. Also removes the custom target for creating a clangd compile_commands.json symlink. * Refactor to use std::tuple_size_v and std::scoped_lock Replaces uses of std::tuple_size<T>::value with std::tuple_size_v<T> for improved readability and consistency. Updates locking mechanisms from std::lock_guard to std::scoped_lock where appropriate. Refactors system_timer for thread safety and removes unused failing_policy from tests. Also improves include formatting and minor code style issues. * Trying to diagnose a CI failure. * Shooting in the dark - RTTI failure. * Include GNUInstallDirs in CMake configuration Added the GNUInstallDirs module to CMakeLists.txt to standardize installation directory variables. This helps improve portability and consistency of install paths. * Diagnosing failure * Another test * Refactored check_failure<> out of test_fixture<>. * Fix check_failure for CI compatibility and minor cleanup Replaces BOOST_REQUIRE_EXCEPTION in check_failure with a try-catch block to address failures in CI with XCode 16.4, likely due to a compiler bug. Also corrects formatting in test_exception class. * Remove redundant exception test in future_recover_tests.cpp Deleted a block that redundantly tested exceptional future creation and failure checking, as it is not relevant to the current test case for future recover on r-value failures. * Fixing more URLs * Update cpp-library dependency to version 5.2.0 Switched from using a local development version of cpp-library to referencing the official GitHub release at version 5.2.0. This change ensures consistency and easier dependency management. * Update CHANGES.md * Delete VERSION_TEST_RESULTS.md
Working around permissive issue in MSVC (#578) * Working around permissive issue in MSVC future and forest would not compile with `\permissive` in MSVC. Fixed those issues and did some clangd cleanup. * Update README with usage instructions. * Updated version for release.
Adding dependency to new enum_ops library. (#572) * Factored out enum_ops. * Fixed potential issues with default_executor with libdispatch. * clang-tidy fixes * added a missing include. * Removing install option - use CPM. Installation with public dependencies is far too complex.
PreviousNext