Skip to content

Common: hold Thread, FireForgetDispatcher and ScheduledTaskRunner tasks in MoveOnlyFunction - #88

Draft
dayfine wants to merge 4 commits into
common/move-only-function-migratefrom
common/move-only-tasks-threads
Draft

dayfine wants to merge 4 commits into
common/move-only-function-migratefrom
common/move-only-tasks-threads

Conversation

@dayfine

@dayfine dayfine commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Depends on #87 (base common/move-only-function-migrate; the diff shows only this change).

Thread, FireForgetDispatcher and ScheduledTaskRunner now hold their tasks as MoveOnlyFunction<void()>, as the thread pool does after #87.

  • Each one owns its task until it runs and never copies it. All callers pass a lambda, so none of them change.
  • Thread_StdThreadDetach.tpp isn't built today. Its wrapper lambda becomes mutable so it can still call the task if it is turned back on.
  • run_in_parallel keeps std::function because it calls the function through a const reference. ThreadPool_Default's new_thread_callback stays as it is; it is outside this batch.

Testing

  • Built on fork CI on the top of the stack: Mac (fallback MoveOnlyFunction), Windows clang and Ubuntu (std::move_only_function). Each run also runs the command-line unit tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

…ks in MoveOnlyFunction

Each of these owns its task until it runs and never copies it. The
detached std::thread backend, which is not built today, needs its
wrapper lambda to be mutable to call the task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 3 commits November 2, 2026 15:18
…tasks-threads

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…tasks-threads

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…tasks-threads

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

game:shared Shared or game-neutral code refactor No behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant