Programming: Concurrency Patterns: Difference between revisions
From wikinotes
No edit summary |
|||
Line 1: | Line 1: | ||
= Resources = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| Wikipedia: Concurrency Patterns || https://en.wikipedia.org/wiki/Concurrency_pattern | |||
|- | |||
|} | |||
</blockquote><!-- Resources --> | |||
= Producer/Consumer = | = Producer/Consumer = |
Revision as of 21:53, 6 August 2022
Resources
Wikipedia: Concurrency Patterns https://en.wikipedia.org/wiki/Concurrency_pattern
Producer/Consumer
- A producer adds data to a synchronized queue
- A variable number of consumers process data from a synchronized queue in a loop
- When producer is finished, send a poison pill for each worker, informing it to break/exit the loop gracefully
- Join on worker threads (wait to close)