Skip to content

Commit

Permalink
Use object() for sentinel value in threading article
Browse files Browse the repository at this point in the history
  • Loading branch information
jima80525 committed Mar 25, 2019
1 parent e63e7ae commit 5c89452
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions intro-to-threading/prodcom_lock.py
Expand Up @@ -4,7 +4,7 @@
import random
import threading

SENTINEL = -1
SENTINEL = object()


class Pipeline:
Expand Down Expand Up @@ -51,9 +51,9 @@ def producer(pipeline):
def consumer(pipeline):
""" Pretend we're saving a number in the database. """
message = 0
while message != SENTINEL:
while message is not SENTINEL:
message = pipeline.get_message("Consumer")
if message != SENTINEL:
if message is not SENTINEL:
logging.info("Consumer storing message: %s", message)


Expand Down

0 comments on commit 5c89452

Please sign in to comment.