Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Commit bc33f0c

Browse files
ajeetdsouzamikepurvis
authored andcommitted
Replaced Thread.setDaemon() using new API. (#1276)
1 parent 9c0db37 commit bc33f0c

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

clients/rospy/src/rospy/impl/registration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def run(self):
315315
for uri in uris:
316316
# #1141: have to multithread this to prevent a bad publisher from hanging us
317317
t = threading.Thread(target=self._connect_topic_thread, args=(topic, uri))
318-
t.setDaemon(True)
318+
t.daemon = True
319319
t.start()
320320

321321
def _connect_topic_thread(self, topic, uri):

clients/rospy/src/rospy/impl/tcpros_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(self, inbound_handler, port=0):
138138
def start(self):
139139
"""Runs the run() loop in a separate thread"""
140140
t = threading.Thread(target=self.run, args=())
141-
t.setDaemon(True)
141+
t.daemon = True
142142
t.start()
143143

144144
def run(self):

clients/rospy/src/rospy/impl/tcpros_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def service_connection_handler(sock, client_addr, header):
249249
# using threadpool reduced performance by an order of
250250
# magnitude, need to investigate better
251251
t = threading.Thread(target=service.handle, args=(transport, header))
252-
t.setDaemon(True)
252+
t.daemon = True
253253
t.start()
254254

255255

clients/rospy/src/rospy/timer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def __init__(self, period, callback, oneshot=False, reset=False):
207207
self._oneshot = oneshot
208208
self._reset = reset
209209
self._shutdown = False
210-
self.setDaemon(True)
210+
self.daemon = True
211211
self.start()
212212

213213
def shutdown(self):

test/test_rospy/test/unit/test_rospy_rostime.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def test_sleep(self):
333333
#start sleeper
334334
self.failIf(test_sleep_done)
335335
sleepthread = threading.Thread(target=sleeper, args=())
336-
sleepthread.setDaemon(True)
336+
sleepthread.daemon = True
337337
sleepthread.start()
338338
time.sleep(1.0) #make sure thread is spun up
339339
self.failIf(test_sleep_done)
@@ -346,7 +346,7 @@ def test_sleep(self):
346346
#start duration sleeper
347347
self.failIf(test_duration_sleep_done)
348348
dursleepthread = threading.Thread(target=duration_sleeper, args=())
349-
dursleepthread.setDaemon(True)
349+
dursleepthread.daemon = True
350350
dursleepthread.start()
351351
time.sleep(1.0) #make sure thread is spun up
352352
self.failIf(test_duration_sleep_done)
@@ -359,7 +359,7 @@ def test_sleep(self):
359359
#start backwards sleeper
360360
self.failIf(test_backwards_sleep_done)
361361
backsleepthread = threading.Thread(target=backwards_sleeper, args=())
362-
backsleepthread.setDaemon(True)
362+
backsleepthread.daemon = True
363363
backsleepthread.start()
364364
time.sleep(1.0) #make sure thread is spun up
365365
self.failIf(test_backwards_sleep_done)

tools/roslaunch/src/roslaunch/pmon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def __init__(self, name="ProcessMonitor"):
313313
self.plock = RLock()
314314
self.is_shutdown = False
315315
self.done = False
316-
self.setDaemon(True)
316+
self.daemon = True
317317
self.reacquire_signals = set()
318318
self.listeners = []
319319
self.dead_list = []

tools/roslaunch/test/unit/test_roslaunch_pmon.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def f():
399399
# and run it -- but setup a safety timer to kill it if it doesn't exit
400400
marker = Marker()
401401
t = threading.Thread(target=kill_pmon, args=(pmon, marker, 10.))
402-
t.setDaemon(True)
402+
t.daemon = True
403403
t.start()
404404

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

461461
pmon.run()
@@ -565,7 +565,7 @@ def test_mainthread_spin(self):
565565
# can't test actual spin as that would go forever
566566
self.pmon.done = False
567567
t = threading.Thread(target=kill_pmon, args=(self.pmon, Marker()))
568-
t.setDaemon(True)
568+
t.daemon = True
569569
t.start()
570570
self.pmon.mainthread_spin()
571571

tools/rosmaster/src/rosmaster/threadpool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class ThreadPoolThread(threading.Thread):
198198
def __init__(self, pool):
199199
"""Initialize the thread and remember the pool."""
200200
threading.Thread.__init__(self)
201-
self.setDaemon(True) #don't block program exit
201+
self.daemon = True #don't block program exit
202202
self.__pool = pool
203203
self.__isDying = False
204204

0 commit comments

Comments
 (0)