use self.installSignalHandlers as a default value
This commit is contained in:
@@ -48,6 +48,8 @@ class Hub:
|
|||||||
# 3-restarted
|
# 3-restarted
|
||||||
state = 0
|
state = 0
|
||||||
|
|
||||||
|
installSignalHandlers = True
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
assert Hub.state==0, ('This hub can only be instantiated once', Hub.state)
|
assert Hub.state==0, ('This hub can only be instantiated once', Hub.state)
|
||||||
Hub.state = 1
|
Hub.state = 1
|
||||||
@@ -65,7 +67,10 @@ class Hub:
|
|||||||
pass
|
pass
|
||||||
return greenlib.switch(self.greenlet, *args)
|
return greenlib.switch(self.greenlet, *args)
|
||||||
|
|
||||||
def run(self, installSignalHandlers=True):
|
def run(self, installSignalHandlers=None):
|
||||||
|
if installSignalHandlers is None:
|
||||||
|
installSignalHandlers = self.installSignalHandlers
|
||||||
|
|
||||||
# main loop, executed in a dedicated greenlet
|
# main loop, executed in a dedicated greenlet
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
assert Hub.state in [1, 3], ('run function is not reentrant', Hub.state)
|
assert Hub.state in [1, 3], ('run function is not reentrant', Hub.state)
|
||||||
|
|||||||
Reference in New Issue
Block a user