Yurttas/PL/OOL/Cplusplus/F/02/08/01/00/consumer.cpp
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 consumer.cpp
14*/
15
16
17#include "consumer.h"
18
19#include <iostream>
20
21using namespace std;
22
23void
24consumer::
25consume(int items) {
26 num_items = items;
27 start();
28}
29
30void
31consumer::
32run() {
33 for(int i=0; i<num_items; ++i) {
34 int item = ch->get();
35 cout << "Consumer #" << id << " got: " << item << endl;
36 usleep(320);
37 }
38}