Yurttas/PL/OOL/Cplusplus/F/02/08/01/00/producer consumer 00.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2005
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9 
10   date   : September 1, 2005.
11   author : Austin W. Westfall, Salih Yurttas.
12
13   producer_consumer_00.cpp
14*/
15
16
17#include <string>
18
19using namespace std;
20
21#include "cubby_hole.cpp"
22
23#include "producer.h"
24#include "consumer.h"
25
26int main(int argc, char* argv[]) {
27
28  cubby_hole<int> ch;
29
30  producer p1(&ch, 1);
31
32  consumer c1(&ch, 1);
33
34  p1.produce(10);
35
36  c1.consume(10);
37
38  p1.join();
39  c1.join();
40
41}