Use new global var stack from tractor
parent
cc21b0386c
commit
26adbe382c
|
@ -216,6 +216,7 @@ class ShmArray:
|
||||||
|
|
||||||
_lotsa_5s = int(5*60*60*10/5)
|
_lotsa_5s = int(5*60*60*10/5)
|
||||||
|
|
||||||
|
|
||||||
def open_shm_array(
|
def open_shm_array(
|
||||||
key: Optional[str] = None,
|
key: Optional[str] = None,
|
||||||
# approx number of 5s bars in a "day" x2
|
# approx number of 5s bars in a "day" x2
|
||||||
|
@ -263,9 +264,9 @@ def open_shm_array(
|
||||||
|
|
||||||
# "unlink" created shm on process teardown by
|
# "unlink" created shm on process teardown by
|
||||||
# pushing teardown calls onto actor context stack
|
# pushing teardown calls onto actor context stack
|
||||||
actor = tractor.current_actor()
|
tractor._actor._lifetime_stack.callback(shmarr.close)
|
||||||
actor._lifetime_stack.callback(shmarr.close)
|
tractor._actor._lifetime_stack.callback(shmarr.destroy)
|
||||||
actor._lifetime_stack.callback(shmarr.destroy)
|
|
||||||
return shmarr
|
return shmarr
|
||||||
|
|
||||||
|
|
||||||
|
@ -310,8 +311,8 @@ def attach_shm_array(
|
||||||
_known_tokens[key] = token
|
_known_tokens[key] = token
|
||||||
|
|
||||||
# "close" attached shm on process teardown
|
# "close" attached shm on process teardown
|
||||||
actor = tractor.current_actor()
|
tractor._actor._lifetime_stack.callback(sha.close)
|
||||||
actor._lifetime_stack.callback(sha.close)
|
|
||||||
return sha
|
return sha
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue