tty168/ProducerConsumer.cpp
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
This code was originally written between 2002 ~ 2004, more than 20 years ago. ## The core cpp template library is entirely in this single file: ProCon.h ## Goal The paper presents a generic, reusable C++ template library implementing the producer–consumer (PC) concurrency pattern. a. Producers generate tasks and push them into a queue b. Consumers pull tasks from the queue and process them later c. The two are decoupled via a task-delivery queue This abstraction allows concurrent systems to be built independently of application logic and OS-specific threading details. ## There are couple use case examples, 1. a thread pooled httpserver 2. some sort of matrix multiplication that shows threaded approach s efficient (i can't remember detail) The examples show the flexible, extensible, and platform-agnostic concurrency framework that can be reused across a wide range of systems such as servers, pipelines, and multithreaded applications. ## Published Article Luckily, I saved the original article published in www.ddj.com (Dr. Dobb's C/C++ Users Journal), 2004. A C++ Producer-Consumer Concurrency Template Library.pdf Find it in this repo, I think it explains everything, :-). ## Some original notes that I had, was originally on windows and linux, but should be ok on BSD, macos etc., as long as the cpp boost library can be found. gcc-linux.mak is make file for linux win32\ contains VC6.0 workspace files lib\libboost_thread.lib is release build of Boost::Threads lib\libboost_thread_d.lib is debug build of Boost::Threads ## Finally The code has not been tested with the latest boost library. Take and make use of this code if you want. Good Luck!