(self, ident)
| 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(): |