MCPcopy Index your code
hub / github.com/reactive-python/reactpy / _ThreadSafeQueue

Class _ThreadSafeQueue

src/py/reactpy/reactpy/core/layout.py:709–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707
708
709class _ThreadSafeQueue(Generic[_Type]):
710 def __init__(self) -> None:
711 self._loop = get_running_loop()
712 self._queue: Queue[_Type] = Queue()
713 self._pending: set[_Type] = set()
714
715 def put(self, value: _Type) -> None:
716 if value not in self._pending:
717 self._pending.add(value)
718 self._loop.call_soon_threadsafe(self._queue.put_nowait, value)
719
720 async def get(self) -> _Type:
721 value = await self._queue.get()
722 self._pending.remove(value)
723 return value
724
725
726def _get_children_info(children: list[VdomChild]) -> Sequence[_ChildInfo]:

Callers 1

__aenter__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected