mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Make multiprocessing's shared memory use memoryview instead of raw pointer
This commit is contained in:
parent
1a0df94db3
commit
26cdf1fe5b
3 changed files with 5 additions and 26 deletions
|
@ -205,7 +205,7 @@ class Heap(object):
|
|||
self._lock.release()
|
||||
|
||||
#
|
||||
# Class representing a chunk of an mmap -- can be inherited
|
||||
# Class representing a chunk of an mmap -- can be inherited by child process
|
||||
#
|
||||
|
||||
class BufferWrapper(object):
|
||||
|
@ -218,11 +218,6 @@ class BufferWrapper(object):
|
|||
self._state = (block, size)
|
||||
Finalize(self, BufferWrapper._heap.free, args=(block,))
|
||||
|
||||
def get_address(self):
|
||||
def create_memoryview(self):
|
||||
(arena, start, stop), size = self._state
|
||||
address, length = _multiprocessing.address_of_buffer(arena.buffer)
|
||||
assert size <= length
|
||||
return address + start
|
||||
|
||||
def get_size(self):
|
||||
return self._state[1]
|
||||
return memoryview(arena.buffer)[start:start+size]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue