Interface IResourceCounter
Interface for generic common resource counter, which allows instant freeing, and asynchronous taking.
Namespace: Cognite.Extractor.Common
Assembly: Cognite.Common.dll
Syntax
public interface IResourceCounter
Methods
| Edit this page View SourceFree(int)
Releases count resources.
Behavior is not defined if this number was not taken before.
Declaration
void Free(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | Number of resources to free. |
Take(int, bool)
Take up to count instances of the resource.
If shouldBlock is true, returns at least 1 and blocks until
this is possible.
Declaration
Task<int> Take(int count, bool shouldBlock)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | Maximum number to take |
| bool | shouldBlock | True if this request should block if no resources are available |
Returns
| Type | Description |
|---|---|
| Task<int> | The number of resources granted.
If |