preparing test_user_mode, need to generalize stuff as usual

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-05 00:00:00 +00:00
parent 1d766fe3d7
commit abb67c14b8
8 changed files with 173 additions and 67 deletions

View File

@@ -78,6 +78,12 @@ class ThreadPool:
self.threads.append(thread)
thread.start()
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
self.join()
def submit(self, work):
'''
Submit work. Block if there is already enough work scheduled (~nthreads).