Skip to content

Commit

Permalink
Replaced Thread.setDaemon() using new API. (#1276)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajeetdsouza authored and mikepurvis committed Dec 21, 2017
1 parent 9c0db37 commit bc33f0c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion clients/rospy/src/rospy/impl/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def run(self):
for uri in uris:
# #1141: have to multithread this to prevent a bad publisher from hanging us
t = threading.Thread(target=self._connect_topic_thread, args=(topic, uri))
t.setDaemon(True)
t.daemon = True
t.start()

def _connect_topic_thread(self, topic, uri):
Expand Down
2 changes: 1 addition & 1 deletion clients/rospy/src/rospy/impl/tcpros_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(self, inbound_handler, port=0):
def start(self):
"""Runs the run() loop in a separate thread"""
t = threading.Thread(target=self.run, args=())
t.setDaemon(True)
t.daemon = True
t.start()

def run(self):
Expand Down
2 changes: 1 addition & 1 deletion clients/rospy/src/rospy/impl/tcpros_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def service_connection_handler(sock, client_addr, header):
# using threadpool reduced performance by an order of
# magnitude, need to investigate better
t = threading.Thread(target=service.handle, args=(transport, header))
t.setDaemon(True)
t.daemon = True
t.start()


Expand Down
2 changes: 1 addition & 1 deletion clients/rospy/src/rospy/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def __init__(self, period, callback, oneshot=False, reset=False):
self._oneshot = oneshot
self._reset = reset
self._shutdown = False
self.setDaemon(True)
self.daemon = True
self.start()

def shutdown(self):
Expand Down
6 changes: 3 additions & 3 deletions test/test_rospy/test/unit/test_rospy_rostime.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def test_sleep(self):
#start sleeper
self.failIf(test_sleep_done)
sleepthread = threading.Thread(target=sleeper, args=())
sleepthread.setDaemon(True)
sleepthread.daemon = True
sleepthread.start()
time.sleep(1.0) #make sure thread is spun up
self.failIf(test_sleep_done)
Expand All @@ -346,7 +346,7 @@ def test_sleep(self):
#start duration sleeper
self.failIf(test_duration_sleep_done)
dursleepthread = threading.Thread(target=duration_sleeper, args=())
dursleepthread.setDaemon(True)
dursleepthread.daemon = True
dursleepthread.start()
time.sleep(1.0) #make sure thread is spun up
self.failIf(test_duration_sleep_done)
Expand All @@ -359,7 +359,7 @@ def test_sleep(self):
#start backwards sleeper
self.failIf(test_backwards_sleep_done)
backsleepthread = threading.Thread(target=backwards_sleeper, args=())
backsleepthread.setDaemon(True)
backsleepthread.daemon = True
backsleepthread.start()
time.sleep(1.0) #make sure thread is spun up
self.failIf(test_backwards_sleep_done)
Expand Down
2 changes: 1 addition & 1 deletion tools/roslaunch/src/roslaunch/pmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def __init__(self, name="ProcessMonitor"):
self.plock = RLock()
self.is_shutdown = False
self.done = False
self.setDaemon(True)
self.daemon = True
self.reacquire_signals = set()
self.listeners = []
self.dead_list = []
Expand Down
6 changes: 3 additions & 3 deletions tools/roslaunch/test/unit/test_roslaunch_pmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def f():
# and run it -- but setup a safety timer to kill it if it doesn't exit
marker = Marker()
t = threading.Thread(target=kill_pmon, args=(pmon, marker, 10.))
t.setDaemon(True)
t.daemon = True
t.start()

pmon.run()
Expand Down Expand Up @@ -455,7 +455,7 @@ def f():
# and run it -- but setup a safety timer to kill it if it doesn't exit
marker = Marker()
t = threading.Thread(target=kill_pmon, args=(self.pmon, marker, 10.))
t.setDaemon(True)
t.daemon = True
t.start()

pmon.run()
Expand Down Expand Up @@ -565,7 +565,7 @@ def test_mainthread_spin(self):
# can't test actual spin as that would go forever
self.pmon.done = False
t = threading.Thread(target=kill_pmon, args=(self.pmon, Marker()))
t.setDaemon(True)
t.daemon = True
t.start()
self.pmon.mainthread_spin()

Expand Down
2 changes: 1 addition & 1 deletion tools/rosmaster/src/rosmaster/threadpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class ThreadPoolThread(threading.Thread):
def __init__(self, pool):
"""Initialize the thread and remember the pool."""
threading.Thread.__init__(self)
self.setDaemon(True) #don't block program exit
self.daemon = True #don't block program exit
self.__pool = pool
self.__isDying = False

Expand Down

0 comments on commit bc33f0c

Please sign in to comment.