YANE-Framework Tutorial 1.1.0

examples/semaphore/src/pcthread.h

00001 /***************************************************************************
00002  *                                                                         *
00003  * Copyright (C) 2011 by www.nonlinearmpc.com                              *
00004  *                                                                         *
00005  * Authors:                                                                *
00006  *  Juergen Pannek <juergen.pannek@googlemail.com>                         *
00007  *  Michael Schamel <michael.schamel@uni-bayreuth.de>                      *
00008  *                                                                         *
00009  ***************************************************************************/
00010 
00011 #ifndef PCTHREAD_H
00012 #define PCTHREAD_H
00013 
00014 #include <yane/utils/thread.h>
00015 #include <string>
00016 
00017 namespace yane
00018 {
00019 
00020         namespace Utils
00021         {
00022 
00023                 class Semaphore;
00024         }
00025 }
00026 
00031 class ProduceConsumeThread : public yane::Utils::Thread
00032 {
00033         public:
00042                 ProduceConsumeThread ( const std::string & name,
00043                         yane::Utils::DebugMaster *dm,
00044                         yane::Utils::Semaphore *semaphore, bool produce );
00045 
00050                 ~ProduceConsumeThread ( );
00051 
00052         protected:
00057                 virtual void run ( );
00058 
00059         private:
00061                 bool _produce;
00062                 yane::Utils::Semaphore * _semaphore;
00063 };
00064 
00065 #endif