-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Portable TimerQueue when using Portable ThreadPool #46266
Comments
Should be possible to do after #45901, then it also wouldn't need to be conditioned on whether the portable thread pool is enabled |
Timer related allocations (UnmanagedThreadPoolWorkItem) Removal of the QCall. WebApplication40.dll!WebApplication40.DelayAwaiter.UnsafeOnCompleted.AnonymousMethod__8_0(object state) Line 78 C#
System.Private.CoreLib.dll!System.Threading.TimerQueueTimer..cctor.AnonymousMethod__23_0(object state) Unknown
System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
System.Private.CoreLib.dll!System.Threading.TimerQueueTimer.CallCallback(bool isThreadPool) Unknown
System.Private.CoreLib.dll!System.Threading.TimerQueueTimer.Fire(bool isThreadPool) Unknown
System.Private.CoreLib.dll!System.Threading.TimerQueue.FireNextTimers() Unknown
-System.Private.CoreLib.dll!System.Threading.TimerQueue.AppDomainTimerCallback(int id) Unknown
-[Native to Managed Transition]
-[Managed to Native Transition]
-System.Private.CoreLib.dll!System.Threading.UnmanagedThreadPoolWorkItem.System.Threading.IThreadPoolWorkItem.Execute() Unknown
System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Unknown
System.Private.CoreLib.dll!System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() Unknown
System.Private.CoreLib.dll!System.Threading.Thread.StartCallback() Unknown |
Could probably be done as a bug fix, will see. It looks like the queuing in the native code above uses recycled memory that would likely amortize the allocations for creating/queuing a new work item. |
Honestly I'm not that worried about the allocations, I just like the idea of all of the managed code pieces being used together. It's not critical for .NET 6 but I would like to see us make more progress on the timers and IO thread pool in .NET 7 |
This should wait till .NET 7. |
@kouvel I think this it the last piece of the puzzle for managed threadpool porting. |
I would also like to get this into 7.0, as it would allow deleting all of the native implementation and simplifying at some point thereafter. |
We should use the portable timer queue when the portable thread pool has been selected. As for some of the benefits:
runtime/src/coreclr/vm/win32threadpool.cpp
Lines 4831 to 4843 in 7e44a6a
I've spoke to @kouvel about this in passing so filing something just to track it.
The text was updated successfully, but these errors were encountered: