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

Method task

Lib/test/test_thread.py:52–61  ·  view source on GitHub ↗
(self, ident)

Source from the content-addressed store, hash-verified

50 self.running += 1
51
52 def task(self, ident):
53 with self.random_mutex:
54 delay = random.random() / 10000.0
55 verbose_print("task %s will run for %sus" % (ident, round(delay*1e6)))
56 time.sleep(delay)
57 verbose_print("task %s done" % ident)
58 with self.running_mutex:
59 self.running -= 1
60 if self.created == NUMTASKS and self.running == 0:
61 self.done_mutex.release()
62
63 def test_starting_threads(self):
64 with threading_helper.wait_threads_exit():

Callers

nothing calls this directly

Calls 7

verbose_printFunction · 0.70
randomMethod · 0.45
sleepMethod · 0.45
releaseMethod · 0.45
appendMethod · 0.45
acquireMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected