Skip to content

Gate

Gate that holds multiple processes until flagged.

Gate

Gate that multiple processes can wait on for simultaneous release.

Source code in src/asimpy/gate.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Gate:
    """Gate that multiple processes can wait on for simultaneous release."""

    def __init__(self, env: "Environment"):
        """
        Construct a new gate.

        Args:
            env: simulation environment.
        """
        self._env = env
        self._waiting = []

    async def wait(self):
        """Wait until gate is next opened."""
        await _Wait(self)

    async def release(self):
        """Release all waiting processes."""
        await _Release(self)

__init__(env)

Construct a new gate.

Parameters:

Name Type Description Default
env Environment

simulation environment.

required
Source code in src/asimpy/gate.py
14
15
16
17
18
19
20
21
22
def __init__(self, env: "Environment"):
    """
    Construct a new gate.

    Args:
        env: simulation environment.
    """
    self._env = env
    self._waiting = []

release() async

Release all waiting processes.

Source code in src/asimpy/gate.py
28
29
30
async def release(self):
    """Release all waiting processes."""
    await _Release(self)

wait() async

Wait until gate is next opened.

Source code in src/asimpy/gate.py
24
25
26
async def wait(self):
    """Wait until gate is next opened."""
    await _Wait(self)