Handle teardown race, add comment about shm subdirs
parent
bbe1ff19ef
commit
1b38628b09
|
@ -98,7 +98,12 @@ class SharedInt:
|
|||
if _USE_POSIX:
|
||||
# We manually unlink to bypass all the "resource tracker"
|
||||
# nonsense meant for non-SC systems.
|
||||
shm_unlink(self._shm.name)
|
||||
name = self._shm.name
|
||||
try:
|
||||
shm_unlink(name)
|
||||
except FileNotFoundError:
|
||||
# might be a teardown race here?
|
||||
log.warning(f'Shm for {name} already unlinked?')
|
||||
|
||||
|
||||
class _Token(BaseModel):
|
||||
|
@ -536,6 +541,10 @@ def attach_shm_array(
|
|||
if key in _known_tokens:
|
||||
assert _Token.from_msg(_known_tokens[key]) == token, "WTF"
|
||||
|
||||
# XXX: ugh, looks like due to the ``shm_open()`` C api we can't
|
||||
# actually place files in a subdir, see discussion here:
|
||||
# https://stackoverflow.com/a/11103289
|
||||
|
||||
# attach to array buffer and view as per dtype
|
||||
shm = SharedMemory(name=key)
|
||||
shmarr = np.ndarray(
|
||||
|
|
Loading…
Reference in New Issue