Skip to content

Bug fixes and improvements#9

Merged
davits merged 1 commit intomasterfrom
coro-all
Nov 6, 2025
Merged

Bug fixes and improvements#9
davits merged 1 commit intomasterfrom
coro-all

Conversation

@davits
Copy link
Copy Markdown
Owner

@davits davits commented Nov 6, 2025

  • Add API to get/set TaskContext from/to Task
  • Add currentContext ReadyAwaitable allowing to get access to the task
    context from inside the coroutine function.
  • Add currentPromise ReadyAwaitable giving access to the PromiseBase of
    the current coroutine. It gives read/write access for advanced use
    cases, and is used in coro::all to severe connection to the StopToken.
  • Refactor Latch so that it stores all necessary information in the
    shared internal state, and now it can be passed around via copying and
    will retain shared ownership of the state.
  • Fix bug in coro::all, when during cancellation it was awakening from
    latch sleep and cancelling without waiting for the child coroutines,
    thus leaving some of the pointers passed to the child coroutines
    dangling. Now coro::all correctly passes StopToken to the child
    coroutines and severes its connection with StopToken, thus waiting for
    all children's cancellation before cancelling itself.
  • Fix a strange decision to fire StopToken callbacks before setting
    stop requested state to true. Now stopped state is true inside the
    callbacks.
  • Fix possible deadlock reported by thread sanitizer on linux. Now we do
    not check if the task was finished during scheduling, leaving that
    check to only be checked in the execution loop, where the
    SerialExecutor's state mutex is unlocked during task.resume().
  • Add github actions to run unit tests on PR(s) and master push.

- Add API to get/set TaskContext from/to Task
- Add currentContext ReadyAwaitable allowing to get access to the task
  context from inside the coroutine function.
- Add currentPromise ReadyAwaitable giving access to the PromiseBase of
  the current coroutine. It gives read/write access for advanced use
  cases, and is used in coro::all to severe connection to the StopToken.
- Refactor Latch so that it stores all necessary information in the
  shared internal state, and now it can be passed around via copying and
  will retain shared ownership of the state.
- Fix bug in coro::all, when during cancellation it was awakening from
  latch sleep and cancelling without waiting for the child coroutines,
  thus leaving some of the pointers passed to the child coroutines
  dangling. Now coro::all correctly passes StopToken to the child
  coroutines and severes its connection with StopToken, thus waiting for
  all children's cancellation before cancelling itself.
- Fix a strange decision to fire StopToken callbacks before setting
  stop requested state to true. Now stopped state is true inside the
  callbacks.
- Fix possible deadlock reported by thread sanitizer on linux. Now we do
  not check if the task was finished during scheduling, leaving that
  check to only be checked in the execution loop, where the
  SerialExecutor's state mutex is unlocked during task.resume().
- Add github actions to run unit tests on PR(s) and master push.
@davits davits changed the title Fix coro::all stop token and cancellation Bug fixes and improvements Nov 6, 2025
@davits davits merged commit 5f7c19b into master Nov 6, 2025
4 checks passed
@davits davits deleted the coro-all branch November 6, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant