Resource
Shared resource with limited capacity.
Resource
Shared resource with limited capacity.
Source code in src/asimpy/resource.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
__aenter__()
async
Acquire one unit of the resource using async with.
Source code in src/asimpy/resource.py
35 36 37 38 | |
__aexit__(exc_type, exc, tb)
async
Release one unit of the resource acquired with async with.
Source code in src/asimpy/resource.py
40 41 42 | |
__init__(env, capacity=1)
Create a new resource.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
Environment
|
simulation environment. |
required |
capacity
|
int
|
maximum simultaneous users. |
1
|
Source code in src/asimpy/resource.py
14 15 16 17 18 19 20 21 22 23 24 25 | |
acquire()
async
Acquire one unit of the resource.
Source code in src/asimpy/resource.py
27 28 29 | |
release()
async
Release one unit of the resource.
Source code in src/asimpy/resource.py
31 32 33 | |