class SharedArray[T: int | float]
A fixed-length array of kind elements in shared memory (Effect's
Shared<A>), indexed like a list. Made by make.
Workers on other threads index the one view the array holds, and no view is
ever made from it: free-threaded CPython counts a buffer's views without a
lock (tests/test_memoryview_ownership.py), so a slice reads and writes
element by element and no memoryview of the array is handed out.
Attributes#
| Attribute | Type | Description |
|---|---|---|
kind | Kind[T] | |
name | str | The segment's name, as |
Functions#
__init__#
__init__(kind, length, name, view) -> None| Parameter | Type | Description |
|---|---|---|
kind | Kind[T] | |
length | int | |
name | str | |
view | memoryview[Any] |
def __init__(self, kind: Kind[T], length: int, name: str, view: memoryview[Any]) -> None:
self._kind = kind
self._length = length
self._name = name
self._view = viewtolist#
tolist() -> list[T]Returns list[T]
def tolist(self) -> list[T]:
return cast("list[T]", self._view.tolist())