• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

src/TestRingBuffer.h

Go to the documentation of this file.
00001 #ifndef __TESTRINGBUFFER__
00002 #define __TESTRINGBUFFER__
00003 
00004 #include "RingBuffer.h"
00005 #include <QThread>
00006 #include <iostream>
00007 
00008 static RingBuffer rb(2,100);
00009 
00010 class TestRingBufferWrite : public QThread
00011 {
00012 public:
00013   
00014   void run()
00015   {
00016     int8_t* writeSlot;
00017     writeSlot = new int8_t[2];
00018     writeSlot[0] = *"a";
00019     writeSlot[1] = *"b";    
00020     while (true) {
00021       //std::cout << "writing BEFORE" << std::endl;
00022       rb.insertSlotBlocking(writeSlot);
00023       //std::cout << "writing AFTER" << std::endl;
00024     }
00025   }
00026 
00027 };
00028 
00029 
00030 class TestRingBufferRead : public QThread
00031 {
00032 public:
00033   
00034   void run()
00035   {
00036     int8_t* readSlot;
00037     readSlot = new int8_t[2];
00038     while (true) {
00039       //std::cout << "reading BEFORE" << std::endl;
00040       rb.readSlotBlocking(readSlot);
00041       //std::cout << "reading AFTER" << std::endl;
00042       //std::cout << *(readSlot) << std::endl;
00043       //std::cout << *(readSlot+1) << std::endl;
00044     }
00045   }
00046 };
00047 
00048 #endif
00049 

 

Documentation generated by Doxygen 1.7.1 on Thu Feb 10 2011 18:57:32

© 2008 by Juan-Pablo Caceres (jcaceres at ccrma dot stanford dot edu) and Chris Chafe
SoundWIRE Group at CCRMA - Stanford University

SourceForge.net Logo