Avoid loading posix unlinker, use shm bytes size
parent
8c39ff307e
commit
583cafc947
|
@ -22,6 +22,8 @@ from sys import byteorder
|
||||||
from typing import List, Tuple, Optional
|
from typing import List, Tuple, Optional
|
||||||
from multiprocessing.shared_memory import SharedMemory, _USE_POSIX
|
from multiprocessing.shared_memory import SharedMemory, _USE_POSIX
|
||||||
from multiprocessing import resource_tracker as mantracker
|
from multiprocessing import resource_tracker as mantracker
|
||||||
|
|
||||||
|
if _USE_POSIX:
|
||||||
from _posixshmem import shm_unlink
|
from _posixshmem import shm_unlink
|
||||||
|
|
||||||
import tractor
|
import tractor
|
||||||
|
@ -73,7 +75,7 @@ class SharedInt:
|
||||||
|
|
||||||
@value.setter
|
@value.setter
|
||||||
def value(self, value) -> None:
|
def value(self, value) -> None:
|
||||||
self._shm.buf[:] = value.to_bytes(4, byteorder)
|
self._shm.buf[:] = value.to_bytes(self._shm.size, byteorder)
|
||||||
|
|
||||||
def destroy(self) -> None:
|
def destroy(self) -> None:
|
||||||
if _USE_POSIX:
|
if _USE_POSIX:
|
||||||
|
|
Loading…
Reference in New Issue