Closed robhruska closed 7 years ago
Anything I can do to help get this merged and pushed up to a new nuget.org package?
I'm looking to use (this forked version of) STP as a dependency for a public project, but without these changes up on nuget.org I'll have to manually include my forked version of DLL in my nupkg, which would be jank.
Added
Summary:
MaxQueueLength
property that can benull
or>= 0
to control queue bounds.CurrentWorkItemsCount
property fromSmartThreadPool
.MaxQueueLength
Added a configuration property (
MaxQueueLength
) that can be used to enforce an upper-bound on the size of the_workItemsQueue
.If the property value is
null
(default), no upper bound is enforced.If the property value is
0
, items will be rejected instead of queued when the pool is at its maximum thread count and all threads are working on items.The property may be changed after the pool has
.Start()
ed to adjust the maximum queue length.Queue limits configured on a pool will be ignored by
WorkItemsGroup
s that use that pool (i.e. limits are only applied toQueueWorkItem()
calls directly onSmartThreadPool
instances).When checking the queue limit and the queue length == the configured limit, items won't be rejected if the pool is going to immediately scale up (i.e. it hasn't reached its max threads). This means the queue limit bends a little bit (and is essentially the configured limit + potential available threads).
If an item is disallowed because the queue is at its maximum, a
QueueRejectedException
is thrown.CurrentWorkItemsCount
Exposes the total
CurrentWorkItemsCount
. Involved making the private_currentWorkItemsCount
volatile
for better read accuracy.