diff --git a/intro-to-threading/fixrace.py b/intro-to-threading/fixrace.py index 64f01b84e6..f1ce89c49f 100755 --- a/intro-to-threading/fixrace.py +++ b/intro-to-threading/fixrace.py @@ -30,10 +30,8 @@ def locked_update(self, name): # logging.getLogger().setLevel(logging.DEBUG) database = FakeDatabase() - logging.info( - "Testing locked update. Starting value is %d.", database.value - ) + logging.info("Testing update. Starting value is %d.", database.value) with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor: for index in range(2): executor.submit(database.locked_update, index) - logging.info("Testing locked update. Ending value is %d.", database.value) + logging.info("Testing update. Ending value is %d.", database.value) diff --git a/intro-to-threading/prodcom_better_queue.py b/intro-to-threading/prodcom_better_queue.py index 1d12839d14..c9f119cefc 100755 --- a/intro-to-threading/prodcom_better_queue.py +++ b/intro-to-threading/prodcom_better_queue.py @@ -19,7 +19,7 @@ def producer(queue, event): def consumer(queue, event): """Pretend we're saving a number in the database.""" - while not event.is_set() or not pipeline.empty(): + while not event.is_set() or not queue.empty(): message = queue.get() logging.info( "Consumer storing message: %s (size=%d)", message, queue.qsize() diff --git a/intro-to-threading/single_thread.py b/intro-to-threading/single_thread.py index c1b31ac363..1aea586502 100755 --- a/intro-to-threading/single_thread.py +++ b/intro-to-threading/single_thread.py @@ -17,7 +17,7 @@ def thread_function(name): logging.info("Main : before creating thread") x = threading.Thread(target=thread_function, args=(1,)) logging.info("Main : before running thread") - # x.start() + x.start() logging.info("Main : wait for the thread to finish") - x.join() + # x.join() logging.info("Main : all done")