IJobSchedulerContext.ReserveResource Method (String, Int64, Boolean, Int32) |
Reserves the resource with the specified amount, possibly restricting to children jobs, and with the specified time-out.
Namespace:
AGI.Parallel.Infrastructure
Assembly:
AGI.Parallel.Infrastructure (in AGI.Parallel.Infrastructure.dll) Version: 2.10.0.1777 (2.10.0.1777)
Syntaxlong ReserveResource(
string resource,
long amount,
bool restrictToChildren,
int millisecondsTimeout
)
Function ReserveResource (
resource As String,
amount As Long,
restrictToChildren As Boolean,
millisecondsTimeout As Integer
) As Long
Parameters
- resource
- Type: System.String
The resource. You can find common values for resources using ConsumableResources. - amount
- Type: System.Int64
The amount. - restrictToChildren
- Type: System.Boolean
if set to true will reserve resources only from child jobs. - millisecondsTimeout
- Type: System.Int32
The number of milliseconds to wait, or System.Threading.Timeout.Infinite (-1) to wait indefinitely.
Return Value
Type:
Int64The resource amount currently consumed by the task.
ExceptionsException | Condition |
---|
ArgumentNullException | If resource is null. |
ArgumentOutOfRangeException | If amount if less than 0. |
JobSchedulerException | If error occurred during operation. For instance, there were not enough resources to satisfy reserve request. |
Remarks
Blocks until the resource becomes available or the time-out expires. If the time-out expires a
JobSchedulerException is thrown.
See Also