Table of Contents

AdjustConcurrencyLevel Method

AdjustConcurrencyLevel(int)

public int AdjustConcurrencyLevel(int delta)

Adjusts the concurrency level by the specified delta in a thread-safe manner.

Parameters

delta int

The amount to change the concurrency level by.

Returns

int

The new concurrency level. Note that the value is just for reference because it may be immediately modified by another thread.

Remarks

Important

Increment exactly same value you've previously decrement or vice versa to restore original state in thread-safe manner. (i.e., you should not calculate delta right before restoring your modification. it's not thread-safe)