MCPcopy Index your code
hub / github.com/python/cpython / _start_thread

Method _start_thread

Lib/multiprocessing/queues.py:173–210  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

171 self.join_thread()
172
173 def _start_thread(self):
174 debug('Queue._start_thread()')
175
176 # Start thread which transfers data from buffer to pipe
177 self._buffer.clear()
178 self._thread = threading.Thread(
179 target=Queue._feed,
180 args=(self._buffer, self._notempty, self._send_bytes,
181 self._wlock, self._reader.close, self._writer.close,
182 self._ignore_epipe, self._on_queue_feeder_error,
183 self._sem),
184 name='QueueFeederThread',
185 daemon=True,
186 )
187
188 try:
189 debug('doing self._thread.start()')
190 self._thread.start()
191 debug('... done self._thread.start()')
192 except:
193 # gh-109047: During Python finalization, creating a thread
194 # can fail with RuntimeError.
195 self._thread = None
196 raise
197
198 if not self._joincancelled:
199 self._jointhread = Finalize(
200 self._thread, Queue._finalize_join,
201 [weakref.ref(self._thread)],
202 exitpriority=-5
203 )
204
205 # Send sentinel to the thread queue object when garbage collected
206 self._close = Finalize(
207 self, Queue._finalize_close,
208 [self._buffer, self._notempty],
209 exitpriority=10
210 )
211
212 @staticmethod
213 def _finalize_join(twr):

Callers 2

putMethod · 0.95
putMethod · 0.80

Calls 4

FinalizeClass · 0.85
debugFunction · 0.70
clearMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected