MCPcopy Index your code
hub / github.com/python/cpython / _DummyList

Class _DummyList

Lib/test/_test_multiprocessing.py:2155–2176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2153# for the same purpose.
2154
2155class _DummyList(object):
2156
2157 def __init__(self):
2158 wrapper = multiprocessing.heap.BufferWrapper(struct.calcsize('i'))
2159 lock = multiprocessing.Lock()
2160 self.__setstate__((wrapper, lock))
2161 self._lengthbuf[0] = 0
2162
2163 def __setstate__(self, state):
2164 (self._wrapper, self._lock) = state
2165 self._lengthbuf = self._wrapper.create_memoryview().cast('i')
2166
2167 def __getstate__(self):
2168 return (self._wrapper, self._lock)
2169
2170 def append(self, _):
2171 with self._lock:
2172 self._lengthbuf[0] += 1
2173
2174 def __len__(self):
2175 with self._lock:
2176 return self._lengthbuf[0]
2177
2178def _wait():
2179 # A crude wait/yield function not relying on synchronization primitives.

Callers 1

DummyListMethod · 0.85

Calls

no outgoing calls

Tested by 1

DummyListMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…