Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Whom to ask questions about book content?


If I have the question to the author regarding the book content, what do I do?

Parallel Programming in Python - Jan Palach.

What is the point of using Condition together with Queue (in book example or in general)?
For example why not to solve the problem just with the Queue, as the queue already implements the locking mechanisms.

fibo_dict = {}
shared_queue = Queue()
input_list = [3, 10, 5, 7]
def fibonacci_task(shared_queue):"Waiting - {}".format(threading.current_thread().name))
value = shared_queue.get()
a, b = 0, 1
for item in range(value):
a, b = b, a + b
fibo_dict[value] = a
shared_queue.task_done()"{} fibonacci of key {} with result {}".format(threading.current_thread().name, value, fibo_dict[value]))
def queue_task(shared_queue):'Starting queue_task...')
for item in input_list:
shared_queue.put(item)'Notifying fibonacci task threads that the queue is ready to consume...')
threads = [threading.Thread(target=fibonacci_task, args=(shared_queue,)) for i in range(4)]
for thread in threads:
thread.daemon = True
prod = threading.Thread(target=queue_task, name='queue_task_thread', args=(shared_queue,))

Best regards,
1 person has
this question