Skip to content

Use Portable TimerQueue when using Portable ThreadPool #46266

@davidfowl

Description

@davidfowl

We should use the portable timer queue when the portable thread pool has been selected. As for some of the benefits:

  • The managed timer queue doesn't need to allocate when being scheduled to the thread pool since it implements IThreadPoolWorkItem
  • It simplifies the native/managed interaction between the thread pool and timer queue. Today if you switch to the portable thread pool, the native timer queue needs to schedule work onto it (
    if (UsePortableThreadPool())
    {
    GCX_COOP();
    ARG_SLOT args[] = { PtrToArgSlot(AsyncTimerCallbackCompletion), PtrToArgSlot(timerInfo) };
    MethodDescCallSite(METHOD__THREAD_POOL__UNSAFE_QUEUE_UNMANAGED_WORK_ITEM).Call(args);
    }
    else
    {
    QueueUserWorkItem(AsyncTimerCallbackCompletion,
    timerInfo,
    QUEUE_ONLY /* TimerInfo take care of deleting*/);
    }
    )
  • The other benefits from moving to managed code (easier to maintain, same code on all platforms, etc)

I've spoke to @kouvel about this in passing so filing something just to track it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions