Skip to content

Missing documentation for QueueUserWorkItem<TState>(Action<TState>, TState, Boolean) .  #959

@pkanavos

Description

@pkanavos

There is no documentation for QueueUserWorkItem(Action, TState, Boolean) that explains what bool preferLocal does.

This was raised in an SO question What is ThreadPool.QueueUserWorkItem preferLocal for?.

The answer shows that the method was added by this pull request fixing this issue. The issue's text and Damien's answer are a good starting point :

The issue is described as:

ThreadPool.QueueUserWorkItem always queues to the global queue; however it would be good to have the option to be able to queue to the current threadpool thread's local queue when a threadpool thread queues extra work items.

...

When the Thread Pool was first built, it only had a single queue of work to be done. However, when all of the Task goodness was being plumbed into the framework, they took the opportunity to introduce thread-local queues (and work stealing) alongside what was now renamed the global queue. It looks like this is clean-up work to allow specific access to these queues.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    new-contentIndicates PRs that contain new articles

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions