Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7275370

Browse files
committed
Merged revisions 65824 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r65824 | benjamin.peterson | 2008-08-18 13:01:43 -0500 (Mon, 18 Aug 2008) | 1 line change a few uses of the threading APIs ........
1 parent c16a7f3 commit 7275370

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

Lib/logging/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def __init__(self, name, level, pathname, lineno,
258258
self.relativeCreated = (self.created - _startTime) * 1000
259259
if logThreads and thread:
260260
self.thread = thread.get_ident()
261-
self.threadName = threading.current_thread().get_name()
261+
self.threadName = threading.current_thread().name
262262
else:
263263
self.thread = None
264264
self.threadName = None

Lib/multiprocessing/managers.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def serve_client(self, conn):
207207
Handle requests from the proxies in a particular process/thread
208208
'''
209209
util.debug('starting server thread to service %r',
210-
threading.current_thread().get_name())
210+
threading.current_thread().name)
211211

212212
recv = conn.recv
213213
send = conn.send
@@ -257,7 +257,7 @@ def serve_client(self, conn):
257257

258258
except EOFError:
259259
util.debug('got EOF -- exiting thread serving %r',
260-
threading.current_thread().get_name())
260+
threading.current_thread().name)
261261
sys.exit(0)
262262

263263
except Exception:
@@ -270,7 +270,7 @@ def serve_client(self, conn):
270270
send(('#UNSERIALIZABLE', repr(msg)))
271271
except Exception as e:
272272
util.info('exception in thread serving %r',
273-
threading.current_thread().get_name())
273+
threading.current_thread().name)
274274
util.info(' ... message was %r', msg)
275275
util.info(' ... exception was %r', e)
276276
conn.close()
@@ -392,7 +392,7 @@ def accept_connection(self, c, name):
392392
'''
393393
Spawn a new thread to serve this connection
394394
'''
395-
threading.current_thread().set_name(name)
395+
threading.current_thread().name = name
396396
c.send(('#RETURN', None))
397397
self.serve_client(c)
398398

@@ -706,8 +706,8 @@ def __init__(self, token, serializer, manager=None,
706706
def _connect(self):
707707
util.debug('making connection to manager')
708708
name = current_process().get_name()
709-
if threading.current_thread().get_name() != 'MainThread':
710-
name += '|' + threading.current_thread().get_name()
709+
if threading.current_thread().name != 'MainThread':
710+
name += '|' + threading.current_thread().name
711711
conn = self._Client(self._token.address, authkey=self._authkey)
712712
dispatch(conn, None, 'accept_connection', (name,))
713713
self._tls.connection = conn
@@ -720,7 +720,7 @@ def _callmethod(self, methodname, args=(), kwds={}):
720720
conn = self._tls.connection
721721
except AttributeError:
722722
util.debug('thread %r does not own a connection',
723-
threading.current_thread().get_name())
723+
threading.current_thread().name)
724724
self._connect()
725725
conn = self._tls.connection
726726

@@ -781,7 +781,7 @@ def _decref(token, authkey, state, tls, idset, _Client):
781781
# the process owns no more references to objects for this manager
782782
if not idset and hasattr(tls, 'connection'):
783783
util.debug('thread %r has no more proxies so closing conn',
784-
threading.current_thread().get_name())
784+
threading.current_thread().name)
785785
tls.connection.close()
786786
del tls.connection
787787

Lib/multiprocessing/queues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def _start_thread(self):
155155
self._wlock, self._writer.close),
156156
name='QueueFeederThread'
157157
)
158-
self._thread.set_daemon(True)
158+
self._thread.daemon = True
159159

160160
debug('doing self._thread.start()')
161161
self._thread.start()

Lib/test/test_dummy_threading.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def run(self):
1616
#delay = random.random() * 2
1717
delay = 0
1818
if support.verbose:
19-
print('task', self.get_name(), 'will run for', delay, 'sec')
19+
print('task', self.name, 'will run for', delay, 'sec')
2020
sema.acquire()
2121
mutex.acquire()
2222
running += 1
@@ -25,11 +25,11 @@ def run(self):
2525
mutex.release()
2626
time.sleep(delay)
2727
if support.verbose:
28-
print('task', self.get_name(), 'done')
28+
print('task', self.name, 'done')
2929
mutex.acquire()
3030
running -= 1
3131
if support.verbose:
32-
print(self.get_name(), 'is finished.', running, 'tasks are running')
32+
print(self.name, 'is finished.', running, 'tasks are running')
3333
mutex.release()
3434
sema.release()
3535

Lib/test/test_multiprocessing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def test_notify_all(self):
671671

672672
t = threading.Thread(target=self.f,
673673
args=(cond, sleeping, woken, TIMEOUT1))
674-
t.set_daemon(True)
674+
t.daemon = True
675675
t.start()
676676

677677
# wait for them all to sleep
@@ -693,7 +693,7 @@ def test_notify_all(self):
693693
p.start()
694694

695695
t = threading.Thread(target=self.f, args=(cond, sleeping, woken))
696-
t.set_daemon(True)
696+
t.daemon = True
697697
t.start()
698698

699699
# wait for them to all sleep

Lib/test/test_socketserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def run_server(self, svrcls, hdlrbase, testfunc):
139139
# Time between requests is short enough that we won't wake
140140
# up spuriously too many times.
141141
kwargs={'poll_interval':0.01})
142-
t.set_daemon(True) # In case this function raises.
142+
t.daemon = True # In case this function raises.
143143
t.start()
144144
if verbose: print("server running")
145145
for i in range(3):

0 commit comments

Comments
 (0)