Skip to content

Add thread pool work callbacks API#27253

Draft
sdotpeng wants to merge 5 commits intomicrosoft:mainfrom
sdotpeng:sdotpeng/ThreadPoolCallbacks
Draft

Add thread pool work callbacks API#27253
sdotpeng wants to merge 5 commits intomicrosoft:mainfrom
sdotpeng:sdotpeng/ThreadPoolCallbacks

Conversation

@sdotpeng
Copy link

@sdotpeng sdotpeng commented Feb 5, 2026

Description

Add new C API SetGlobalWorkCallbacks to register callbacks for thread pool work lifecycle events:

  • on_enqueue - called when work is submitted to the thread pool
  • on_start - called when a worker thread begins executing the work
  • on_stop - called when work completes (guaranteed even on exception)
    Includes C++ wrapper in Ort::ThreadingOptions and unit tests.

Motivation and Context

Enables external instrumentation and monitoring of thread pool work items (e.g., for profiling, tracing, or custom scheduling insights).

@sdotpeng sdotpeng marked this pull request as draft February 5, 2026 10:45
@sdotpeng
Copy link
Author

sdotpeng commented Feb 5, 2026

@microsoft-github-policy-service agree

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